diff options
author | smatz <smatz@openttd.org> | 2009-05-26 22:45:48 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-26 22:45:48 +0000 |
commit | 5a463c8347fe1e68ab31dda1425e9060d52bfbd6 (patch) | |
tree | 55f5c9de8dcbda6268d003b29af59650594ce27a /src/ship_cmd.cpp | |
parent | 7ee882d03f4c41d8659ed82fd5be0d0efbae0a0c (diff) | |
download | openttd-5a463c8347fe1e68ab31dda1425e9060d52bfbd6.tar.xz |
(svn r16442) -Codechange: use new Vehicle accessors at more places
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r-- | src/ship_cmd.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index c2c5a72cd..1ed7a0480 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -838,8 +838,8 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 */ CommandCost CmdSellShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { - Vehicle *v = Vehicle::GetIfValid(p1); - if (v == NULL || v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR; + Ship *v = Ship::GetIfValid(p1); + if (v == NULL || !CheckOwnership(v->owner)) return CMD_ERROR; if (HASBITS(v->vehstatus, VS_CRASHED)) return_cmd_error(STR_CAN_T_SELL_DESTROYED_VEHICLE); @@ -884,8 +884,8 @@ CommandCost CmdSendShipToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u return SendAllVehiclesToDepot(VEH_SHIP, flags, p2 & DEPOT_SERVICE, _current_company, (p2 & VLW_MASK), p1); } - Vehicle *v = Vehicle::GetIfValid(p1); - if (v == NULL || v->type != VEH_SHIP) return CMD_ERROR; + Ship *v = Ship::GetIfValid(p1); + if (v == NULL) return CMD_ERROR; return v->SendToDepot(flags, (DepotCommand)(p2 & DEPOT_COMMAND_MASK)); } @@ -908,9 +908,9 @@ CommandCost CmdRefitShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 byte new_subtype = GB(p2, 8, 8); uint16 capacity = CALLBACK_FAILED; - Vehicle *v = Vehicle::GetIfValid(p1); + Ship *v = Ship::GetIfValid(p1); - if (v == NULL || v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR; + if (v == NULL || !CheckOwnership(v->owner)) return CMD_ERROR; if (!v->IsStoppedInDepot()) return_cmd_error(STR_ERROR_SHIP_MUST_BE_STOPPED_IN_DEPOT); if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_CAN_T_REFIT_DESTROYED_VEHICLE); |