(svn r262) Fix: [ 1028234 ] Monorail and MagLev infrastructure not available in 1920s any more
authordominik
Wed, 15 Sep 2004 06:51:23 +0000
changeset 257 8d83db6716ea
parent 256 f7c6267731fb
child 258 478345458cae
(svn r262) Fix: [ 1028234 ] Monorail and MagLev infrastructure not available in 1920s any more
engine.c
--- a/engine.c	Tue Sep 14 22:51:37 2004 +0000
+++ b/engine.c	Wed Sep 15 06:51:23 2004 +0000
@@ -377,6 +377,17 @@
 	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 @@
 	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 @@
 			} 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.
 			}
 		}
 	}