Changeset - r24634:dc757f98ef7c
[Not reviewed]
master
0 1 0
frosch - 3 years ago 2021-01-10 14:12:06
frosch@openttd.org
Fix: [NewGRF] industry variables 69 to 71 did not check, whether the queried cargo is valid.
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf_industries.cpp
Show inline comments
 
@@ -311,6 +311,7 @@ static uint32 GetCountAndDistanceOfClose
 
		case 0x70:
 
		case 0x71: {
 
			CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile);
 
			if (cargo == CT_INVALID) return 0;
 
			int index = this->industry->GetCargoProducedIndex(cargo);
 
			if (index < 0) return 0; // invalid cargo
 
			switch (variable) {
 
@@ -329,6 +330,7 @@ static uint32 GetCountAndDistanceOfClose
 
		case 0x6E:
 
		case 0x6F: {
 
			CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile);
 
			if (cargo == CT_INVALID) return 0;
 
			int index = this->industry->GetCargoAcceptedIndex(cargo);
 
			if (index < 0) return 0; // invalid cargo
 
			if (variable == 0x6E) return this->industry->last_cargo_accepted_at[index];
0 comments (0 inline, 0 general)