From 44829a401cb54097c06079d3c56431011b9b9543 Mon Sep 17 00:00:00 2001 From: tron Date: Wed, 14 Jun 2006 11:05:30 +0000 Subject: (svn r5262) Add symbolic names for the aircraft subtypes. not perfect, but better than raw numbers --- aircraft_cmd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'aircraft_cmd.c') diff --git a/aircraft_cmd.c b/aircraft_cmd.c index 28b7eecdc..53502a983 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -133,7 +133,8 @@ SpriteID GetRotorImage(const Vehicle *v) void DrawAircraftEngine(int x, int y, EngineID engine, uint32 image_ormod) { - int spritenum = AircraftVehInfo(engine)->image_index; + const AircraftVehicleInfo* avi = AircraftVehInfo(engine); + int spritenum = avi->image_index; int sprite = (6 + _aircraft_sprite[spritenum]); if (is_custom_sprite(spritenum)) { @@ -144,7 +145,7 @@ void DrawAircraftEngine(int x, int y, EngineID engine, uint32 image_ormod) DrawSprite(sprite | image_ormod, x, y); - if ((AircraftVehInfo(engine)->subtype & 1) == 0) { + if (!(avi->subtype & AIR_CTOL)) { SpriteID rotor_sprite = GetCustomRotorIcon(engine); if (rotor_sprite == 0) rotor_sprite = SPR_ROTOR_STOPPED; DrawSprite(rotor_sprite, x, y - 5); @@ -211,7 +212,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) avi = AircraftVehInfo(p1); // allocate 2 or 3 vehicle structs, depending on type - if (!AllocateVehicles(vl, (avi->subtype & 1) == 0 ? 3 : 2) || + if (!AllocateVehicles(vl, avi->subtype & AIR_CTOL ? 2 : 3) || IsOrderPoolFull()) { return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); } @@ -281,7 +282,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) v->acceleration = avi->acceleration; v->engine_type = p1; - v->subtype = (avi->subtype & 1) == 0 ? 0 : 2; + v->subtype = (avi->subtype & AIR_CTOL ? 2 : 0); v->value = value; u->subtype = 4; @@ -1271,7 +1272,7 @@ static void MaybeCrashAirplane(Vehicle *v) //FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports prob = 0x10000 / 1500; - if (st->airport_type == AT_SMALL && (AircraftVehInfo(v->engine_type)->subtype & 2) && !_cheats.no_jetcrash.value) { + if (st->airport_type == AT_SMALL && AircraftVehInfo(v->engine_type)->subtype & AIR_FAST && !_cheats.no_jetcrash.value) { prob = 0x10000 / 20; } -- cgit v1.2.3-54-g00ecf