mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r24848) -Fix [FS#5386]: Consider regearing-like cargos as no-cargo in cargo filters.
This commit is contained in:
parent
0ca14df566
commit
59951051a0
|
@ -516,7 +516,7 @@ static const StringID _sort_listing[][12] = {{
|
||||||
static bool CDECL CargoFilter(const EngineID *eid, const CargoID cid)
|
static bool CDECL CargoFilter(const EngineID *eid, const CargoID cid)
|
||||||
{
|
{
|
||||||
if (cid == CF_ANY) return true;
|
if (cid == CF_ANY) return true;
|
||||||
uint32 refit_mask = GetUnionOfArticulatedRefitMasks(*eid, true);
|
uint32 refit_mask = GetUnionOfArticulatedRefitMasks(*eid, true) & _standard_cargo_mask;
|
||||||
return (cid == CF_NONE ? refit_mask == 0 : HasBit(refit_mask, cid));
|
return (cid == CF_NONE ? refit_mask == 0 : HasBit(refit_mask, cid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,16 @@
|
||||||
CargoSpec CargoSpec::array[NUM_CARGO];
|
CargoSpec CargoSpec::array[NUM_CARGO];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bitmask of cargo types available.
|
* Bitmask of cargo types available. This includes phony cargoes like regearing cargoes.
|
||||||
* Initialized during a call to #SetupCargoForClimate.
|
* Initialized during a call to #SetupCargoForClimate.
|
||||||
*/
|
*/
|
||||||
uint32 _cargo_mask;
|
uint32 _cargo_mask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bitmask of real cargo types available. Phony cargoes like regearing cargoes are excluded.
|
||||||
|
*/
|
||||||
|
uint32 _standard_cargo_mask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the default cargo types for the given landscape type.
|
* Set up the default cargo types for the given landscape type.
|
||||||
* @param l Landscape
|
* @param l Landscape
|
||||||
|
@ -176,10 +181,13 @@ void InitializeSortedCargoSpecs()
|
||||||
/* Sort cargo specifications by cargo class and name. */
|
/* Sort cargo specifications by cargo class and name. */
|
||||||
QSortT(_sorted_cargo_specs, _sorted_cargo_specs_size, &CargoSpecClassSorter);
|
QSortT(_sorted_cargo_specs, _sorted_cargo_specs_size, &CargoSpecClassSorter);
|
||||||
|
|
||||||
|
_standard_cargo_mask = 0;
|
||||||
|
|
||||||
_sorted_standard_cargo_specs_size = 0;
|
_sorted_standard_cargo_specs_size = 0;
|
||||||
FOR_ALL_SORTED_CARGOSPECS(cargo) {
|
FOR_ALL_SORTED_CARGOSPECS(cargo) {
|
||||||
if (cargo->classes & CC_SPECIAL) break;
|
if (cargo->classes & CC_SPECIAL) break;
|
||||||
_sorted_standard_cargo_specs_size++;
|
_sorted_standard_cargo_specs_size++;
|
||||||
|
SetBit(_standard_cargo_mask, cargo->Index());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
extern uint32 _cargo_mask;
|
extern uint32 _cargo_mask;
|
||||||
|
extern uint32 _standard_cargo_mask;
|
||||||
|
|
||||||
void SetupCargoForClimate(LandscapeID l);
|
void SetupCargoForClimate(LandscapeID l);
|
||||||
CargoID GetCargoIDByLabel(CargoLabel cl);
|
CargoID GetCargoIDByLabel(CargoLabel cl);
|
||||||
|
|
Loading…
Reference in New Issue