mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-16 08:52:40 +01:00
(svn r15765) [0.7] -Backport from trunk:
- Change: [NewGRF] Expose GRF ID of engines in var action property 0x25 (r15739) - Fix: Add Engine::GetDisplayDefaultCapacity() and use it everywhere, so CB 36 is also used everywhere (r15763) - Fix: [Windows] Inlined UTF-8 characters (in the source code) are not handled properly on Eastern versions of Windows so escape them (r15762) - Fix: [Windows] On some system searching a font using its English name fails. So now we search the font using the localised name and use the English name for the final 'validation' only (r15757)
This commit is contained in:
@@ -177,6 +177,36 @@ bool Engine::CanCarryCargo() const
|
||||
return this->GetDefaultCargoType() != CT_INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the default cargo capacity of an engine for display purposes.
|
||||
*
|
||||
* For planes carrying both passenger and mail this is the passenger capacity.
|
||||
* For multiheaded engines this is the capacity of both heads.
|
||||
* For articulated engines use GetCapacityOfArticulatedParts
|
||||
*
|
||||
* @return The default capacity
|
||||
* @see GetDefaultCargoType
|
||||
*/
|
||||
uint Engine::GetDisplayDefaultCapacity() const
|
||||
{
|
||||
if (!this->CanCarryCargo()) return 0;
|
||||
switch (type) {
|
||||
case VEH_TRAIN:
|
||||
return GetEngineProperty(this->index, 0x14, this->u.rail.capacity) + (this->u.rail.railveh_type == RAILVEH_MULTIHEAD ? this->u.rail.capacity : 0);
|
||||
|
||||
case VEH_ROAD:
|
||||
return GetEngineProperty(this->index, 0x0F, this->u.road.capacity);
|
||||
|
||||
case VEH_SHIP:
|
||||
return GetEngineProperty(this->index, 0x0D, this->u.ship.capacity);
|
||||
|
||||
case VEH_AIRCRAFT:
|
||||
return AircraftDefaultCargoCapacity(this->GetDefaultCargoType(), &this->u.air);
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
Money Engine::GetRunningCost() const
|
||||
{
|
||||
switch (this->type) {
|
||||
|
||||
Reference in New Issue
Block a user