Mercurial > hg > openttd
changeset 4338:d09df2d70157 draft
(svn r6039) -Fix: [newGRF] FS#287 Bugfix for error in NewGRF callback 31 code for aircraft (Mart3p)
introduced in rev 5822
author | bjarni <bjarni@openttd.org> |
---|---|
date | Mon, 21 Aug 2006 16:35:47 +0000 |
parents | ed31c273defc |
children | 379a4ecab2bc |
files | aircraft_cmd.c |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -425,7 +425,6 @@ int32 CmdSellAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) { Vehicle *v; - uint16 callback; if (!IsVehicleIndex(p1)) return CMD_ERROR; @@ -436,14 +435,6 @@ SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); - /* Check if this aircraft can be started/stopped. The callback will fail or - * return 0xFF if it can. */ - callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v); - if (callback != CALLBACK_FAILED && callback != 0xFF) { - StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback); - return_cmd_error(error); - } - if (flags & DC_EXEC) { // Invalidate depot InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); @@ -463,6 +454,7 @@ int32 CmdStartStopAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) { Vehicle *v; + uint16 callback; if (!IsVehicleIndex(p1)) return CMD_ERROR; @@ -474,6 +466,14 @@ if (v->u.air.state >= STARTTAKEOFF && v->u.air.state < TERM7) return_cmd_error(STR_A017_AIRCRAFT_IS_IN_FLIGHT); + /* Check if this aircraft can be started/stopped. The callback will fail or + * return 0xFF if it can. */ + callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v); + if (callback != CALLBACK_FAILED && callback != 0xFF) { + StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback); + return_cmd_error(error); + } + if (flags & DC_EXEC) { if (IsAircraftInHangarStopped(v)) { DeleteVehicleNews(p1, STR_A014_AIRCRAFT_IS_WAITING_IN);