mirror of https://github.com/OpenTTD/OpenTTD
(svn r9092) -Codechange: (NewGRF) (re r8885) Also set cargo type as invalid if the chosen type is not available in the current climate.
parent
0a8e1aa8d6
commit
e83e9b9e44
|
@ -365,7 +365,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
||||||
FOR_EACH_OBJECT {
|
FOR_EACH_OBJECT {
|
||||||
uint8 ctype = grf_load_byte(&buf);
|
uint8 ctype = grf_load_byte(&buf);
|
||||||
|
|
||||||
if (ctype < NUM_CARGO) {
|
if (ctype < NUM_CARGO && HASBIT(_cargo_mask, ctype)) {
|
||||||
rvi[i].cargo_type = ctype;
|
rvi[i].cargo_type = ctype;
|
||||||
} else {
|
} else {
|
||||||
rvi[i].cargo_type = CT_INVALID;
|
rvi[i].cargo_type = CT_INVALID;
|
||||||
|
@ -557,7 +557,7 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
||||||
FOR_EACH_OBJECT {
|
FOR_EACH_OBJECT {
|
||||||
uint8 cargo = grf_load_byte(&buf);
|
uint8 cargo = grf_load_byte(&buf);
|
||||||
|
|
||||||
if (cargo < NUM_CARGO) {
|
if (cargo < NUM_CARGO && HASBIT(_cargo_mask, cargo)) {
|
||||||
rvi[i].cargo_type = cargo;
|
rvi[i].cargo_type = cargo;
|
||||||
} else {
|
} else {
|
||||||
rvi[i].cargo_type = CT_INVALID;
|
rvi[i].cargo_type = CT_INVALID;
|
||||||
|
@ -671,7 +671,7 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
||||||
FOR_EACH_OBJECT {
|
FOR_EACH_OBJECT {
|
||||||
uint8 cargo = grf_load_byte(&buf);
|
uint8 cargo = grf_load_byte(&buf);
|
||||||
|
|
||||||
if (cargo < NUM_CARGO) {
|
if (cargo < NUM_CARGO && HASBIT(_cargo_mask, cargo)) {
|
||||||
svi[i].cargo_type = cargo;
|
svi[i].cargo_type = cargo;
|
||||||
} else {
|
} else {
|
||||||
svi[i].cargo_type = CT_INVALID;
|
svi[i].cargo_type = CT_INVALID;
|
||||||
|
|
Loading…
Reference in New Issue