(svn r3952) - Fix: On loading a game, GetPlayerRailtypes() didn't account for the fact that vehicles are introduced a year after their introduction date. This will also relieve possible (rare) network desyncs. Backport of r3565 from trunk 0.4.5
authorDarkvater
Sat, 18 Mar 2006 15:17:57 +0000
branch0.4.5
changeset 9922 3d7645168508
parent 9921 4d12b9de9752
child 9923 4bafc584ea69
(svn r3952) - Fix: On loading a game, GetPlayerRailtypes() didn't account for the fact that vehicles are introduced a year after their introduction date. This will also relieve possible (rare) network desyncs. Backport of r3565 from trunk
engine.c
players.c
--- a/engine.c	Sat Mar 18 15:16:12 2006 +0000
+++ b/engine.c	Sat Mar 18 15:17:57 2006 +0000
@@ -1010,7 +1010,7 @@
 				CalcEngineReliability(e);
 			}
 
-			if (!(e->flags & ENGINE_AVAILABLE) && (uint16)(_date - min(_date, 365)) >= e->intro_date) {
+			if (!(e->flags & ENGINE_AVAILABLE) && _date >= (e->intro_date + 365)) {
 				// Introduce it to all players
 				NewVehicleAvailable(e);
 			} else if (!(e->flags & (ENGINE_AVAILABLE|ENGINE_INTRODUCING)) && _date >= e->intro_date) {
--- a/players.c	Sat Mar 18 15:16:12 2006 +0000
+++ b/players.c	Sat Mar 18 15:17:57 2006 +0000
@@ -629,7 +629,7 @@
 		const EngineInfo *ei = &_engine_info[i];
 
 		if (e->type == VEH_Train && HASBIT(ei->climates, _opt.landscape) &&
-				(HASBIT(e->player_avail, p) || e->intro_date <= _date) &&
+				(HASBIT(e->player_avail, p) || _date >= (e->intro_date + 365)) &&
 				!(RailVehInfo(i)->flags & RVI_WAGON)) {
 			assert(e->railtype < RAILTYPE_END);
 			SETBIT(rt, e->railtype);