Changeset - r28516:3caca0eb6455
[Not reviewed]
master
0 2 0
Peter Nelson - 11 months ago 2024-01-19 20:07:47
peter1138@openttd.org
Fix 9602de4: FinaliseCargoArray did nothing. (#11839)

`CargoSpec::Iterate()` deliberately skips invalid cargo types, but `FinaliseCargoCarry()` is only interested in them.
2 files changed with 8 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/cargotype.h
Show inline comments
 
@@ -175,6 +175,7 @@ private:
 
	static CargoSpec array[NUM_CARGO]; ///< Array holding all CargoSpecs
 

	
 
	friend void SetupCargoForClimate(LandscapeID l);
 
	friend void FinaliseCargoArray();
 
};
 

	
 
extern CargoTypes _cargo_mask;
src/newgrf.cpp
Show inline comments
 
@@ -9174,13 +9174,13 @@ static void FinaliseEngineArray()
 
}
 

	
 
/** Check for invalid cargoes */
 
static void FinaliseCargoArray()
 
{
 
	for (CargoSpec *cs : CargoSpec::Iterate()) {
 
		if (!cs->IsValid()) {
 
			cs->name = cs->name_single = cs->units_volume = STR_NEWGRF_INVALID_CARGO;
 
			cs->quantifier = STR_NEWGRF_INVALID_CARGO_QUANTITY;
 
			cs->abbrev = STR_NEWGRF_INVALID_CARGO_ABBREV;
 
void FinaliseCargoArray()
 
{
 
	for (CargoSpec &cs : CargoSpec::array) {
 
		if (!cs.IsValid()) {
 
			cs.name = cs.name_single = cs.units_volume = STR_NEWGRF_INVALID_CARGO;
 
			cs.quantifier = STR_NEWGRF_INVALID_CARGO_QUANTITY;
 
			cs.abbrev = STR_NEWGRF_INVALID_CARGO_ABBREV;
 
		}
 
	}
 
}
0 comments (0 inline, 0 general)