summaryrefslogtreecommitdiff
path: root/aircraft_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-12 12:19:25 +0000
committertron <tron@openttd.org>2006-03-12 12:19:25 +0000
commitb394f72fa9305094ddf672564a0f4a0c8f16e89b (patch)
treea2aa298975f3b0ba6fb0889afdfb76c415951aa7 /aircraft_cmd.c
parent214b5eb42f8296965837a29e086fd4c6a7406c37 (diff)
downloadopenttd-b394f72fa9305094ddf672564a0f4a0c8f16e89b.tar.xz
(svn r3829) Reduce the use of _error_message by directly returning error codes instead of using this global variable
Diffstat (limited to 'aircraft_cmd.c')
-rw-r--r--aircraft_cmd.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index da812a4bf..42000164b 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -315,12 +315,7 @@ bool IsAircraftHangarTile(TileIndex tile)
bool CheckStoppedInHangar(const Vehicle* v)
{
- if (!(v->vehstatus & VS_STOPPED) || !IsAircraftHangarTile(v->tile)) {
- _error_message = STR_A01B_AIRCRAFT_MUST_BE_STOPPED;
- return false;
- }
-
- return true;
+ return v->vehstatus & VS_STOPPED && IsAircraftHangarTile(v->tile);
}
@@ -346,8 +341,8 @@ int32 CmdSellAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner) || !CheckStoppedInHangar(v))
- return CMD_ERROR;
+ if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (!CheckStoppedInHangar(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);