(svn r11253) -Fix (r9411): industries can still use cargo they define, even if these cargo are disabled by a grf loaded later
authorglx
Sat, 13 Oct 2007 02:49:05 +0000
changeset 8214 854acef589c8
parent 8213 fc7a2b3164dd
child 8215 a229b1703c9d
(svn r11253) -Fix (r9411): industries can still use cargo they define, even if these cargo are disabled by a grf loaded later
src/newgrf.cpp
--- a/src/newgrf.cpp	Sat Oct 13 02:23:11 2007 +0000
+++ b/src/newgrf.cpp	Sat Oct 13 02:49:05 2007 +0000
@@ -1541,8 +1541,8 @@
 		switch (prop) {
 			case 0x08: /* Bit number of cargo */
 				cs->bitnum = grf_load_byte(&buf);
-				cs->grfid = _cur_grffile->grfid;
 				if (cs->IsValid()) {
+					cs->grfid = _cur_grffile->grfid;
 					SETBIT(_cargo_mask, cid + i);
 				} else {
 					CLRBIT(_cargo_mask, cid + i);
@@ -5271,7 +5271,7 @@
 	for (CargoID c = 0; c < NUM_CARGO; c++) {
 		CargoSpec *cs = &_cargo[c];
 		/* Don't map if the cargo is unavailable or not from NewGRF */
-		if (!cs->IsValid() || cs->grfid == 0) continue;
+		if (cs->grfid == 0) continue;
 
 		cs->name         = MapGRFStringID(cs->grfid, cs->name);
 		cs->name_single  = MapGRFStringID(cs->grfid, cs->name_single);