Mercurial > hg > openttd
diff src/engine.cpp @ 13388:96253b319c10 draft
(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.
author | frosch <frosch@openttd.org> |
---|---|
date | Wed, 28 Oct 2009 18:31:16 +0000 (2009-10-28) |
parents | f52dcc31398e |
children | 216dfd60fb2f |
line wrap: on
line diff
--- a/src/engine.cpp +++ b/src/engine.cpp @@ -162,6 +162,7 @@ * 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 @@ 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(); }