summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-03-10 09:23:33 +0000
committerpeter1138 <peter1138@openttd.org>2007-03-10 09:23:33 +0000
commite83e9b9e44e02612caddae0183c7f129823e04f1 (patch)
treec5de5ed636d84f3e23861ff9bdbd6c7695f82828
parent0a8e1aa8d6613bde711413fe62eee8810e095cf9 (diff)
downloadopenttd-e83e9b9e44e02612caddae0183c7f129823e04f1.tar.xz
(svn r9092) -Codechange: (NewGRF) (re r8885) Also set cargo type as invalid if the chosen type is not available in the current climate.
-rw-r--r--src/newgrf.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index ea30c6eec..4d04904c7 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -365,7 +365,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT {
uint8 ctype = grf_load_byte(&buf);
- if (ctype < NUM_CARGO) {
+ if (ctype < NUM_CARGO && HASBIT(_cargo_mask, ctype)) {
rvi[i].cargo_type = ctype;
} else {
rvi[i].cargo_type = CT_INVALID;
@@ -557,7 +557,7 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT {
uint8 cargo = grf_load_byte(&buf);
- if (cargo < NUM_CARGO) {
+ if (cargo < NUM_CARGO && HASBIT(_cargo_mask, cargo)) {
rvi[i].cargo_type = cargo;
} else {
rvi[i].cargo_type = CT_INVALID;
@@ -671,7 +671,7 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
FOR_EACH_OBJECT {
uint8 cargo = grf_load_byte(&buf);
- if (cargo < NUM_CARGO) {
+ if (cargo < NUM_CARGO && HASBIT(_cargo_mask, cargo)) {
svi[i].cargo_type = cargo;
} else {
svi[i].cargo_type = CT_INVALID;