summaryrefslogtreecommitdiff
path: root/aircraft_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-05 12:43:41 +0000
committertron <tron@openttd.org>2006-06-05 12:43:41 +0000
commit00aa407edd3e6c85b7bc667cfd7a1a70d65c4f28 (patch)
tree71115f6bacc228220f52537dbab8c6154497e86a /aircraft_cmd.c
parent3c4a5d619258a45b66e149b9c9a5718f78ee0dcd (diff)
downloadopenttd-00aa407edd3e6c85b7bc667cfd7a1a70d65c4f28.tar.xz
(svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
-Fix: Be more strict what it means for an aircraft to be in a hangar: It's not just being stopped on a hangar tile
Diffstat (limited to 'aircraft_cmd.c')
-rw-r--r--aircraft_cmd.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 94411d3b2..7263f51d3 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -2,6 +2,7 @@
#include "stdafx.h"
#include "openttd.h"
+#include "aircraft.h"
#include "debug.h"
#include "functions.h"
#include "station_map.h"
@@ -338,12 +339,6 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
-bool CheckStoppedInHangar(const Vehicle* v)
-{
- return v->vehstatus & VS_STOPPED && IsHangarTile(v->tile);
-}
-
-
static void DoDeleteAircraft(Vehicle *v)
{
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
@@ -367,7 +362,7 @@ int32 CmdSellAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
- if (!CheckStoppedInHangar(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
+ if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -402,7 +397,7 @@ int32 CmdStartStopAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return_cmd_error(STR_A017_AIRCRAFT_IS_IN_FLIGHT);
if (flags & DC_EXEC) {
- if (v->vehstatus & VS_STOPPED && IsHangarTile(v->tile)) {
+ if (IsAircraftInHangarStopped(v)) {
DeleteVehicleNews(p1, STR_A014_AIRCRAFT_IS_WAITING_IN);
}
@@ -499,7 +494,7 @@ int32 CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
- if (!CheckStoppedInHangar(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
+ if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
avi = AircraftVehInfo(v->engine_type);