summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-12-23 22:12:52 +0000
committerfrosch <frosch@openttd.org>2012-12-23 22:12:52 +0000
commit59951051a0c1bff4c3c10a86bcead01007d6ad04 (patch)
treee153be31461e52e389638b985a67a8868d9ca6b7 /src
parent0ca14df5664f79f9a5d420645f44867d2679bad3 (diff)
downloadopenttd-59951051a0c1bff4c3c10a86bcead01007d6ad04.tar.xz
(svn r24848) -Fix [FS#5386]: Consider regearing-like cargos as no-cargo in cargo filters.
Diffstat (limited to 'src')
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/cargotype.cpp10
-rw-r--r--src/cargotype.h1
3 files changed, 11 insertions, 2 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 36fda8e8b..8971e4fa8 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -516,7 +516,7 @@ static const StringID _sort_listing[][12] = {{
static bool CDECL CargoFilter(const EngineID *eid, const CargoID cid)
{
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));
}
diff --git a/src/cargotype.cpp b/src/cargotype.cpp
index 04e29ac1f..6d601e255 100644
--- a/src/cargotype.cpp
+++ b/src/cargotype.cpp
@@ -23,12 +23,17 @@
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.
*/
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.
* @param l Landscape
*/
@@ -176,10 +181,13 @@ void InitializeSortedCargoSpecs()
/* Sort cargo specifications by cargo class and name. */
QSortT(_sorted_cargo_specs, _sorted_cargo_specs_size, &CargoSpecClassSorter);
+ _standard_cargo_mask = 0;
+
_sorted_standard_cargo_specs_size = 0;
FOR_ALL_SORTED_CARGOSPECS(cargo) {
if (cargo->classes & CC_SPECIAL) break;
_sorted_standard_cargo_specs_size++;
+ SetBit(_standard_cargo_mask, cargo->Index());
}
}
diff --git a/src/cargotype.h b/src/cargotype.h
index 74fa5a998..43e7cd6a7 100644
--- a/src/cargotype.h
+++ b/src/cargotype.h
@@ -130,6 +130,7 @@ private:
};
extern uint32 _cargo_mask;
+extern uint32 _standard_cargo_mask;
void SetupCargoForClimate(LandscapeID l);
CargoID GetCargoIDByLabel(CargoLabel cl);