(svn r3394) - NewGRF fix: ignore non-climate dependent cargo types. The spec is rather vague on this, but we don't support newcargos anyway.
--- a/newgrf.c Mon Jan 09 21:14:56 2006 +0000
+++ b/newgrf.c Thu Jan 12 07:57:40 2006 +0000
@@ -308,7 +308,11 @@
FOR_EACH_OBJECT {
uint8 ctype = grf_load_byte(&buf);
- rvi[i].cargo_type = ctype;
+ if (ctype < NUM_CARGO) {
+ rvi[i].cargo_type = ctype;
+ } else {
+ grfmsg(GMS_NOTICE, "RailVehicleChangeInfo: Invalid cargo type %d, ignoring.", ctype);
+ }
}
} break;
case 0x16: { /* Weight */
@@ -492,7 +496,11 @@
FOR_EACH_OBJECT {
uint8 cargo = grf_load_byte(&buf);
- rvi[i].cargo_type = cargo;
+ if (cargo < NUM_CARGO) {
+ rvi[i].cargo_type = cargo;
+ } else {
+ grfmsg(GMS_NOTICE, "RoadVehicleChangeInfo: Invalid cargo type %d, ignoring.", cargo);
+ }
}
} break;
case 0x11: { /* Cost factor */
@@ -610,7 +618,11 @@
// assume otherwise.
cargo = local_cargo_id_ctype[cargo];
#endif
- svi[i].cargo_type = cargo;
+ if (cargo < NUM_CARGO) {
+ svi[i].cargo_type = cargo;
+ } else {
+ grfmsg(GMS_NOTICE, "ShipVehicleChangeInfo: Invalid cargo type %d, ignoring.", cargo);
+ }
}
} break;
case 0x0D: { /* Cargo capacity */