(svn r16442) -Codechange: use new Vehicle accessors at more places
This commit is contained in:
@@ -440,10 +440,9 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
*/
|
||||
CommandCost CmdSellAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||
if (v == NULL) return CMD_ERROR;
|
||||
Aircraft *v = Aircraft::GetIfValid(p1);
|
||||
|
||||
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
|
||||
if (v == NULL || !CheckOwnership(v->owner)) return CMD_ERROR;
|
||||
if (!v->IsStoppedInDepot()) return_cmd_error(STR_ERROR_AIRCRAFT_MUST_BE_STOPPED);
|
||||
|
||||
if (HASBITS(v->vehstatus, VS_CRASHED)) return_cmd_error(STR_CAN_T_SELL_DESTROYED_VEHICLE);
|
||||
@@ -493,11 +492,9 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, DoCommandFlag flags, uint32
|
||||
return SendAllVehiclesToDepot(VEH_AIRCRAFT, flags, p2 & DEPOT_SERVICE, _current_company, (p2 & VLW_MASK), p1);
|
||||
}
|
||||
|
||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||
Aircraft *v = Aircraft::GetIfValid(p1);
|
||||
if (v == NULL) return CMD_ERROR;
|
||||
|
||||
if (v->type != VEH_AIRCRAFT) return CMD_ERROR;
|
||||
|
||||
return v->SendToDepot(flags, (DepotCommand)(p2 & DEPOT_COMMAND_MASK));
|
||||
}
|
||||
|
||||
@@ -516,10 +513,8 @@ CommandCost CmdRefitAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
{
|
||||
byte new_subtype = GB(p2, 8, 8);
|
||||
|
||||
Vehicle *v = Vehicle::GetIfValid(p1);
|
||||
if (v == NULL) return CMD_ERROR;
|
||||
|
||||
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
|
||||
Aircraft *v = Aircraft::GetIfValid(p1);
|
||||
if (v == NULL || !CheckOwnership(v->owner)) return CMD_ERROR;
|
||||
if (!v->IsStoppedInDepot()) return_cmd_error(STR_ERROR_AIRCRAFT_MUST_BE_STOPPED);
|
||||
if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_CAN_T_REFIT_DESTROYED_VEHICLE);
|
||||
|
||||
|
Reference in New Issue
Block a user