summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-02-28 10:40:34 +0000
committermaedhros <maedhros@openttd.org>2007-02-28 10:40:34 +0000
commit8108cbbe3c5e9fe49750f195ad242dd6b222adba (patch)
tree053d58028aa634210404f65bb4fc5f19a8947e27
parent490811535584e73888fe8177b385b29d08d46daa (diff)
downloadopenttd-8108cbbe3c5e9fe49750f195ad242dd6b222adba.tar.xz
(svn r8943) -Fix (r5338): [NewGRF] Fix support for vehicle variable 48, which just returns Engine[id].flags
-rw-r--r--src/newgrf_engine.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 16bbb87da..dd38fbafc 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -457,21 +457,6 @@ static void VehicleSetTriggers(const ResolverObject *object, int triggers)
}
-static uint32 GetVehicleTypeInfo(EngineID engine_type)
-{
- /* Bit 0 Vehicle type is available on the market
- * Bit 1 Vehicle type is in the testing phase
- * Bit 2 Exclusive testing offer for a human player active */
- const Engine *e = GetEngine(engine_type);
- uint32 var = 0;
-
- if (e->player_avail == 0xFF) SETBIT(var, 0);
- if (e->age < e->duration_phase_1) SETBIT(var, 1);
- if (e->player_avail > 0 && e->player_avail != 0xFF) SETBIT(var, 2);
- return var;
-}
-
-
static uint32 GetGRFParameter(EngineID engine_type, byte parameter)
{
const GRFFile *file = GetEngineGRF(engine_type);
@@ -490,7 +475,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
switch (variable) {
case 0x43: return _current_player; /* Owner information */
case 0x46: return 0; /* Motion counter */
- case 0x48: return GetVehicleTypeInfo(object->u.vehicle.self_type); /* Vehicle Type Info */
+ case 0x48: return GetEngine(object->u.vehicle.self_type)->flags; /* Vehicle Type Info */
case 0xC4: return clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR; /* Build year */
case 0xDA: return INVALID_VEHICLE; /* Next vehicle */
case 0x7F: return GetGRFParameter(object->u.vehicle.self_type, parameter); /* Read GRF parameter */
@@ -601,7 +586,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
return (cs->classes << 16) | (cs->weight << 8) | GetEngineGRF(v->engine_type)->cargo_map[v->cargo_type];
}
- case 0x48: return GetVehicleTypeInfo(v->engine_type); /* Vehicle Type Info */
+ case 0x48: return GetEngine(v->engine_type)->flags; /* Vehicle Type Info */
/* Variables which use the parameter */
case 0x60: /* Count consist's engine ID occurance */