diff options
author | rubidium <rubidium@openttd.org> | 2010-09-08 18:55:58 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-09-08 18:55:58 +0000 |
commit | 9badab6454d18378fc81962c8883e9594b968276 (patch) | |
tree | 64f9b2aa92db6fbea21d89ad7ff17d50aed687e1 /src/aircraft_cmd.cpp | |
parent | 835d63a8d7cfaaedca9358e1ba051bf87428e98a (diff) | |
download | openttd-9badab6454d18378fc81962c8883e9594b968276.tar.xz |
(svn r20768) -Codechange: unify send-to-depot commands
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r-- | src/aircraft_cmd.cpp | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 1a7710f53..f08b8cb14 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -357,32 +357,6 @@ bool Aircraft::FindClosestDepot(TileIndex *location, DestinationID *destination, return true; } -/** - * Send an aircraft to the hangar. - * @param tile unused - * @param flags for command type - * @param p1 vehicle ID to send to the hangar - * @param p2 various bitmasked elements - * - p2 bit 0-3 - DEPOT_ flags (see vehicle.h) - * - p2 bit 8-10 - VLW flag (for mass goto depot) - * @param text unused - * @return the cost of this operation or an error - */ -CommandCost CmdSendAircraftToHangar(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) -{ - if (p2 & DEPOT_MASS_SEND) { - /* Mass goto depot requested */ - if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR; - return SendAllVehiclesToDepot(VEH_AIRCRAFT, flags, p2 & DEPOT_SERVICE, _current_company, (p2 & VLW_MASK), p1); - } - - Aircraft *v = Aircraft::GetIfValid(p1); - if (v == NULL) return CMD_ERROR; - - return v->SendToDepot(flags, (DepotCommand)(p2 & DEPOT_COMMAND_MASK)); -} - - static void CheckIfAircraftNeedsService(Aircraft *v) { if (Company::Get(v->owner)->settings.vehicle.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return; @@ -1093,7 +1067,7 @@ void HandleMissingAircraftOrders(Aircraft *v) const Station *st = GetTargetAirportIfValid(v); if (st == NULL) { Backup<CompanyByte> cur_company(_current_company, v->owner, FILE_LINE); - CommandCost ret = DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR); + CommandCost ret = DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_SEND_VEHICLE_TO_DEPOT); cur_company.Restore(); if (ret.Failed()) CrashAirplane(v); @@ -1400,7 +1374,7 @@ static void AircraftEventHandler_HeliTakeOff(Aircraft *v, const AirportFTAClass /* Send the helicopter to a hangar if needed for replacement */ if (v->NeedsAutomaticServicing()) { Backup<CompanyByte> cur_company(_current_company, v->owner, FILE_LINE); - DoCommand(v->tile, v->index, DEPOT_SERVICE | DEPOT_LOCATE_HANGAR, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR); + DoCommand(v->tile, v->index, DEPOT_SERVICE | DEPOT_LOCATE_HANGAR, DC_EXEC, CMD_SEND_VEHICLE_TO_DEPOT); cur_company.Restore(); } } @@ -1450,7 +1424,7 @@ static void AircraftEventHandler_Landing(Aircraft *v, const AirportFTAClass *apc /* check if the aircraft needs to be replaced or renewed and send it to a hangar if needed */ if (v->NeedsAutomaticServicing()) { Backup<CompanyByte> cur_company(_current_company, v->owner, FILE_LINE); - DoCommand(v->tile, v->index, DEPOT_SERVICE, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR); + DoCommand(v->tile, v->index, DEPOT_SERVICE, DC_EXEC, CMD_SEND_VEHICLE_TO_DEPOT); cur_company.Restore(); } } |