diff options
author | Darkvater <darkvater@openttd.org> | 2007-01-27 12:45:55 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2007-01-27 12:45:55 +0000 |
commit | 08c21c0c61be2e6e19517559288f3f40b77c0f0f (patch) | |
tree | e5dc4283665daeb149dc95777c8d87e1b1d0faa0 | |
parent | 50ca901b40664453fe90a396577e6438fd45dc27 (diff) | |
download | openttd-08c21c0c61be2e6e19517559288f3f40b77c0f0f.tar.xz |
(svn r8429) -Codechange: Add a name for AircraftVehicleInfo subtype helicopter and remove some magic numbers related to the subtype.
-rw-r--r-- | src/engine.h | 5 | ||||
-rw-r--r-- | src/newgrf.cpp | 6 | ||||
-rw-r--r-- | src/table/engines.h | 2 | ||||
-rw-r--r-- | src/vehicle.cpp | 6 |
4 files changed, 11 insertions, 8 deletions
diff --git a/src/engine.h b/src/engine.h index 3b70256a2..375fe1d10 100644 --- a/src/engine.h +++ b/src/engine.h @@ -45,8 +45,11 @@ typedef struct ShipVehicleInfo { bool refittable; } ShipVehicleInfo; -/* AircraftVehicleInfo subtypes */ +/* AircraftVehicleInfo subtypes, bitmask type. + * If bit 0 is 0 then it is a helicopter, otherwise it is a plane + * in which case bit 1 tells us whether it's a big(fast) plane or not */ enum { + AIR_HELI = 0, AIR_CTOL = 1, // Conventional Take Off and Landing, i.e. planes AIR_FAST = 2 }; diff --git a/src/newgrf.cpp b/src/newgrf.cpp index cc1a2a05d..b8fda928d 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -745,15 +745,15 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte * case 0x09: /* Helicopter */ FOR_EACH_OBJECT { if (grf_load_byte(&buf) == 0) { - avi[i].subtype = 0; + avi[i].subtype = AIR_HELI; } else { - SB(avi[i].subtype, 0, 1, 1); + SB(avi[i].subtype, 0, 1, 1); // AIR_CTOL } } break; case 0x0A: /* Large */ - FOR_EACH_OBJECT SB(avi[i].subtype, 1, 1, (grf_load_byte(&buf) != 0 ? 1 : 0)); + FOR_EACH_OBJECT SB(avi[i].subtype, 1, 1, (grf_load_byte(&buf) != 0 ? 1 : 0)); // AIR_FAST break; case 0x0B: /* Cost factor */ diff --git a/src/table/engines.h b/src/table/engines.h index 9c56435fe..4ca84508a 100644 --- a/src/table/engines.h +++ b/src/table/engines.h @@ -518,7 +518,7 @@ const ShipVehicleInfo orig_ship_vehicle_info[NUM_SHIP_ENGINES] = { * @param i passenger_capacity */ #define AVI(a, b, c, d, e, f, g, h, i) { a, b, c, d, {e}, f, g, h, i } -#define H 0 +#define H AIR_HELI #define P AIR_CTOL #define J AIR_CTOL | AIR_FAST const AircraftVehicleInfo orig_aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES] = { diff --git a/src/vehicle.cpp b/src/vehicle.cpp index b28852d96..5ccc1aebc 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2891,9 +2891,9 @@ static SpriteID GetEngineColourMap(EngineID engine_type, PlayerID player, Engine const AircraftVehicleInfo *avi = AircraftVehInfo(engine_type); if (cargo_type == CT_INVALID) cargo_type = CT_PASSENGERS; switch (avi->subtype) { - case 0: scheme = LS_HELICOPTER; break; - case 1: scheme = LS_SMALL_PLANE; break; - case 3: scheme = LS_LARGE_PLANE; break; + case AIR_HELI: scheme = LS_HELICOPTER; break; + case AIR_CTOL: scheme = LS_SMALL_PLANE; break; + case AIR_CTOL | AIR_FAST: scheme = LS_LARGE_PLANE; break; } break; } |