1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-13 17:49:10 +00:00

(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.
This commit is contained in:
frosch
2009-10-28 18:31:16 +00:00
parent 2a3c797138
commit 83894809d0
8 changed files with 114 additions and 163 deletions

View File

@@ -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();
}