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
 
@@ -172,12 +172,13 @@ struct CargoSpec {
 
	static IterateWrapper Iterate(size_t from = 0) { return IterateWrapper(from); }
 

	
 
private:
 
	static CargoSpec array[NUM_CARGO]; ///< Array holding all CargoSpecs
 

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

	
 
extern CargoTypes _cargo_mask;
 
extern CargoTypes _standard_cargo_mask;
 

	
 
void SetupCargoForClimate(LandscapeID l);
src/newgrf.cpp
Show inline comments
 
@@ -9171,19 +9171,19 @@ static void FinaliseEngineArray()
 
			Engine::Get(e->info.variant_id)->display_flags |= EngineDisplayFlags::HasVariants | EngineDisplayFlags::IsFolded;
 
		}
 
	}
 
}
 

	
 
/** 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;
 
		}
 
	}
 
}
 

	
 
/**
 
 * Check if a given housespec is valid and disable it if it's not.
0 comments (0 inline, 0 general)