summaryrefslogtreecommitdiff
path: root/src/articulated_vehicles.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-02-19 18:34:24 +0000
committerfrosch <frosch@openttd.org>2012-02-19 18:34:24 +0000
commit5167f2be29957bd96d06b0103f448b25a20691be (patch)
tree166a589e6c9b679be253b9703735cf536df1ae67 /src/articulated_vehicles.cpp
parent3d6f8cd7d4ee6268c497e0f8217dce5e62e12177 (diff)
downloadopenttd-5167f2be29957bd96d06b0103f448b25a20691be.tar.xz
(svn r23965) -Fix [FS#5070]: Refittability should never depend on the current capacity of a vehicle.
Diffstat (limited to 'src/articulated_vehicles.cpp')
-rw-r--r--src/articulated_vehicles.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp
index 7a7d05a94..d153a169f 100644
--- a/src/articulated_vehicles.cpp
+++ b/src/articulated_vehicles.cpp
@@ -109,13 +109,13 @@ static inline uint16 GetVehicleDefaultCapacity(EngineID engine, CargoID *cargo_t
*/
static inline uint32 GetAvailableVehicleCargoTypes(EngineID engine, bool include_initial_cargo_type)
{
- uint32 cargoes = 0;
- CargoID initial_cargo_type;
+ const Engine *e = Engine::Get(engine);
+ if (!e->CanCarryCargo()) return 0;
+
+ uint32 cargoes = e->info.refit_mask;
- if (GetVehicleDefaultCapacity(engine, &initial_cargo_type) > 0) {
- const EngineInfo *ei = EngInfo(engine);
- cargoes = ei->refit_mask;
- if (include_initial_cargo_type && initial_cargo_type < NUM_CARGO) SetBit(cargoes, initial_cargo_type);
+ if (include_initial_cargo_type) {
+ SetBit(cargoes, e->GetDefaultCargoType());
}
return cargoes;
@@ -240,7 +240,7 @@ bool IsArticulatedVehicleCarryingDifferentCargoes(const Vehicle *v, CargoID *car
CargoID first_cargo = CT_INVALID;
do {
- if (v->cargo_cap > 0 && v->cargo_type != CT_INVALID) {
+ if (v->cargo_type != CT_INVALID && v->GetEngine()->CanCarryCargo()) {
if (first_cargo == CT_INVALID) first_cargo = v->cargo_type;
if (first_cargo != v->cargo_type) {
if (cargo_type != NULL) *cargo_type = CT_INVALID;