summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-10-28 18:31:16 +0000
committerfrosch <frosch@openttd.org>2009-10-28 18:31:16 +0000
commit83894809d0bf63f5375cf546f3d353f5299a6442 (patch)
treee5bc6eae133e4d7d043c01575a691812798c353e /src/engine.cpp
parent2a3c797138b988a4c836215a8d98b8f85244c48e (diff)
downloadopenttd-83894809d0bf63f5375cf546f3d353f5299a6442.tar.xz
(svn r17897) -Fix [FS#3255]: CB15 and CB36 (capacity) were not always called when they should.
-Codechange: Move capacity calculation to a single function for all vehicle types, so the behaviour can be kept consistent easier.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index d58124824..5ea56efdb 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -162,6 +162,7 @@ bool Engine::CanCarryCargo() const
* For multiheaded engines this is the capacity of both heads.
* For articulated engines use GetCapacityOfArticulatedParts
*
+ * @note Keep this function consistent with GetVehicleCapacity().
* @return The default capacity
* @see GetDefaultCargoType
*/
@@ -179,7 +180,12 @@ uint Engine::GetDisplayDefaultCapacity() const
return GetEngineProperty(this->index, PROP_SHIP_CARGO_CAPACITY, this->u.ship.capacity);
case VEH_AIRCRAFT:
- return AircraftDefaultCargoCapacity(this->GetDefaultCargoType(), &this->u.air);
+ switch (this->GetDefaultCargoType()) {
+ case CT_PASSENGERS: return this->u.air.passenger_capacity;
+ case CT_MAIL: return this->u.air.passenger_capacity + this->u.air.mail_capacity;
+ case CT_GOODS: return (this->u.air.passenger_capacity + this->u.air.mail_capacity) / 2;
+ default: return (this->u.air.passenger_capacity + this->u.air.mail_capacity) / 4;
+ }
default: NOT_REACHED();
}