(svn r9918) -Fix: the available roadtypes/railtypes were not updated on GRF updates.
authorrubidium
Fri, 25 May 2007 08:47:40 +0000
changeset 7182 644a1d06f2be
parent 7181 f966d75af3a6
child 7183 23b20a982228
(svn r9918) -Fix: the available roadtypes/railtypes were not updated on GRF updates.
src/engine.cpp
src/newgrf.cpp
--- a/src/engine.cpp	Fri May 25 08:13:01 2007 +0000
+++ b/src/engine.cpp	Fri May 25 08:47:40 2007 +0000
@@ -332,6 +332,12 @@
 			if (p->is_active) SETBIT(p->avail_railtypes, railtype);
 		}
 	}
+	if ((index - NUM_TRAIN_ENGINES) < NUM_ROAD_ENGINES) {
+		/* maybe make another road type available */
+		FOR_ALL_PLAYERS(p) {
+			if (p->is_active) SETBIT(p->avail_roadtypes, HASBIT(EngInfo(index)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
+		}
+	}
 	AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL), 0, 0);
 }
 
--- a/src/newgrf.cpp	Fri May 25 08:13:01 2007 +0000
+++ b/src/newgrf.cpp	Fri May 25 08:47:40 2007 +0000
@@ -4808,6 +4808,13 @@
 
 static void AfterLoadGRFs()
 {
+	/* Update the bitmasks for the vehicle lists */
+	Player *p;
+	FOR_ALL_PLAYERS(p) {
+		p->avail_railtypes = GetPlayerRailtypes(p->index);
+		p->avail_roadtypes = GetPlayerRoadtypes(p->index);
+	}
+
 	/* Pre-calculate all refit masks after loading GRF files. */
 	CalculateRefitMasks();