mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
Fix: [NewGRF] industry variables 69 to 71 did not check, whether the queried cargo is valid.
This commit is contained in:
parent
0078554d6a
commit
5b08960560
@ -311,6 +311,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
|
|||||||
case 0x70:
|
case 0x70:
|
||||||
case 0x71: {
|
case 0x71: {
|
||||||
CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile);
|
CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile);
|
||||||
|
if (cargo == CT_INVALID) return 0;
|
||||||
int index = this->industry->GetCargoProducedIndex(cargo);
|
int index = this->industry->GetCargoProducedIndex(cargo);
|
||||||
if (index < 0) return 0; // invalid cargo
|
if (index < 0) return 0; // invalid cargo
|
||||||
switch (variable) {
|
switch (variable) {
|
||||||
@ -329,6 +330,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
|
|||||||
case 0x6E:
|
case 0x6E:
|
||||||
case 0x6F: {
|
case 0x6F: {
|
||||||
CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile);
|
CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile);
|
||||||
|
if (cargo == CT_INVALID) return 0;
|
||||||
int index = this->industry->GetCargoAcceptedIndex(cargo);
|
int index = this->industry->GetCargoAcceptedIndex(cargo);
|
||||||
if (index < 0) return 0; // invalid cargo
|
if (index < 0) return 0; // invalid cargo
|
||||||
if (variable == 0x6E) return this->industry->last_cargo_accepted_at[index];
|
if (variable == 0x6E) return this->industry->last_cargo_accepted_at[index];
|
||||||
|
Loading…
Reference in New Issue
Block a user