summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-03-10 10:08:38 +0000
committerpeter1138 <peter1138@openttd.org>2007-03-10 10:08:38 +0000
commit1461e39bb9f0640758244a4a30e7cc0eaee6db94 (patch)
tree6d6295efda9ee5f29a582e788bf81d542a7bd4f2 /src/newgrf.cpp
parentf662e0f99672e50f6915cfd82c9f2a70e42f3d9c (diff)
downloadopenttd-1461e39bb9f0640758244a4a30e7cc0eaee6db94.tar.xz
(svn r9094) -Codechange: Don't set up refit masks for engine types not in the current climate, and exclude engine types if their cargo type is invalid and they have no refittable type.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 969915174..7b0e7ba4f 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -3752,6 +3752,9 @@ static const CargoLabel *_default_refitmasks[] = {
static void CalculateRefitMasks()
{
for (EngineID engine = 0; engine < TOTAL_NUM_ENGINES; engine++) {
+ /* Skip engine if not available in this climate */
+ if (!HASBIT(_engine_info[engine].climates, _opt.landscape)) continue;
+
uint32 mask = 0;
uint32 not_mask = 0;
uint32 xor_mask = _engine_info[engine].refit_mask;
@@ -3792,16 +3795,19 @@ static void CalculateRefitMasks()
case VEH_TRAIN: {
RailVehicleInfo *rvi = &_rail_vehicle_info[engine];
if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine);
+ if (rvi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0;
break;
}
case VEH_ROAD: {
RoadVehicleInfo *rvi = &_road_vehicle_info[engine - ROAD_ENGINES_INDEX];
if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine);
+ if (rvi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0;
break;
}
case VEH_SHIP: {
ShipVehicleInfo *svi = &_ship_vehicle_info[engine - SHIP_ENGINES_INDEX];
if (svi->cargo_type == CT_INVALID) svi->cargo_type = FindFirstRefittableCargo(engine);
+ if (svi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0;
break;
}
}