summaryrefslogtreecommitdiff
path: root/engine.c
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-09-15 06:51:23 +0000
committerdominik <dominik@openttd.org>2004-09-15 06:51:23 +0000
commit39f1c6dda3b28d46196fead38de119f7023ef460 (patch)
tree001509a37c91fb0fc2264b10d63f80b91f939b49 /engine.c
parent9dcf10eb6c3bc0e06f003c79269d1c4c99b5ab22 (diff)
downloadopenttd-39f1c6dda3b28d46196fead38de119f7023ef460.tar.xz
(svn r262) Fix: [ 1028234 ] Monorail and MagLev infrastructure not available in 1920s any more
Diffstat (limited to 'engine.c')
-rw-r--r--engine.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/engine.c b/engine.c
index d53fc98ef..c40c86786 100644
--- a/engine.c
+++ b/engine.c
@@ -377,6 +377,17 @@ int32 CmdWantEnginePreview(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
+// Determine if an engine type is a wagon (and not a loco)
+bool isWagon(byte index)
+{
+ if (index < NUM_TRAIN_ENGINES) {
+ const RailVehicleInfo *rvi = &_rail_vehicle_info[index];
+ if(rvi->flags & RVI_WAGON)
+ return true;
+ }
+ return false;
+}
+
void NewVehicleAvailable(Engine *e)
{
Vehicle *v;
@@ -410,11 +421,8 @@ void NewVehicleAvailable(Engine *e)
e->player_avail = (byte)-1;
// Do not introduce new rail wagons
- if ((byte)index < NUM_TRAIN_ENGINES) {
- const RailVehicleInfo *rvi = &_rail_vehicle_info[index];
- if(rvi->flags & RVI_WAGON)
- return;
- }
+ if(isWagon(index))
+ return;
// make maglev / monorail available
FOR_ALL_PLAYERS(p) {
@@ -451,7 +459,10 @@ void EnginesMonthlyLoop()
} else if (!(e->flags & (ENGINE_AVAILABLE|ENGINE_INTRODUCING)) && _date >= e->intro_date) {
// Introduction date has passed.. show introducing dialog to one player.
e->flags |= ENGINE_INTRODUCING;
- e->preview_player = 1; // Give to the player with the highest rating.
+
+ // Do not introduce new rail wagons
+ if(!isWagon(e - _engines))
+ e->preview_player = 1; // Give to the player with the highest rating.
}
}
}