|
OpenTTD
|
Specification of a cargo type. More...
#include <cargotype.h>
Public Member Functions | |
| CargoID | Index () const |
| Determines index of this cargospec. | |
| bool | IsValid () const |
| Tests for validity of this cargospec. | |
| SpriteID | GetCargoIcon () const |
| Get sprite for showing cargo of this type. | |
Static Public Member Functions | |
| static size_t | GetArraySize () |
| Total number of cargospecs, both valid and invalid. | |
| static CargoSpec * | Get (size_t index) |
| Retrieve cargo details for the given cargo ID. | |
Data Fields | |
| uint8 | bitnum |
| Cargo bit number, is INVALID_CARGO for a non-used spec. | |
| CargoLabel | label |
| Unique label of the cargo type. | |
| uint8 | legend_colour |
| uint8 | rating_colour |
| uint8 | weight |
| Weight of a single unit of this cargo type in 1/16 ton (62.5 kg). | |
| uint16 | multiplier |
| Capacity multiplier for vehicles. (8 fractional bits) | |
| uint16 | initial_payment |
| uint8 | transit_days [2] |
| bool | is_freight |
| Cargo type is considered to be freight (affects train freight multiplier). | |
| TownEffect | town_effect |
| The effect that delivering this cargo type has on towns. Also affects destination of subsidies. | |
| uint16 | multipliertowngrowth |
| Size of the effect. | |
| uint8 | callback_mask |
| Bitmask of cargo callbacks that have to be called. | |
| StringID | name |
| Name of this type of cargo. | |
| StringID | name_single |
| Name of a single entity of this type of cargo. | |
| StringID | units_volume |
| Name of a single unit of cargo of this type. | |
| StringID | quantifier |
| Text for multiple units of cargo of this type. | |
| StringID | abbrev |
| Two letter abbreviation for this cargo type. | |
| SpriteID | sprite |
Icon to display this cargo type, may be 0xFFF (which means to resolve an action123 chain). | |
| uint16 | classes |
| Classes of this cargo type. | |
| struct GRFFile * | grffile |
| NewGRF where #group belongs to. | |
| struct SpriteGroup * | group |
| Money | current_payment |
Static Private Attributes | |
| static CargoSpec | array [NUM_CARGO] |
| Array holding all CargoSpecs. | |
Friends | |
| void | SetupCargoForClimate (LandscapeID l) |
| Set up the default cargo types for the given landscape type. | |
Specification of a cargo type.
Definition at line 56 of file cargotype.h.
|
inlinestatic |
Retrieve cargo details for the given cargo ID.
| index | ID of cargo |
Definition at line 118 of file cargotype.h.
References array, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_spritegroup_pool >::index, and lengthof.
Referenced by LinkGraphOverlay::AddLinks(), AfterLoadGame(), BuildCargoTranslationMap(), CargoChangeInfo(), CmdCreateSubsidy(), CMSAMine(), DeliverGoods(), CargoesField::Draw(), DrawCargoIcons(), IndustryViewWindow::DrawInfo(), DrawOrderString(), DrawVehicleRefitWindow(), BuildIndustryWindow::DrawWidget(), FinaliseCargoArray(), FindSubsidyTownCargoRoute(), FormatString(), FreightWagonMult(), GetEngineLiveryScheme(), GetLoadAmount(), GetRefitCostFactor(), VehicleScopeResolver::GetVariable(), GenericScopeResolver::GetVariable(), IsCargoInClass(), IsTileForestIndustry(), IndustryCargoesWindow::OnHover(), LandInfoWindow::OnInit(), IndustryCargoesWindow::OnInit(), LinkGraphLegendWindow::OnInvalidateData(), LinkGraphOverlay::RebuildCache(), LinkRefresher::RefreshLinks(), ReportNewsProductionChangeIndustry(), IndustryCargoesWindow::SetStringParameters(), SetupCargoForClimate(), SetupSubsidyDecodeParam(), ShowRejectOrAcceptNews(), StationsWndShowStationRating(), TileLoop_Town(), TownHouseChangeInfo(), and BuildIndustryWindow::UpdateWidgetSize().
|
inlinestatic |
Total number of cargospecs, both valid and invalid.
Definition at line 108 of file cargotype.h.
References array, and lengthof.
Referenced by FormatString().
| SpriteID CargoSpec::GetCargoIcon | ( | ) | const |
Get sprite for showing cargo of this type.
Definition at line 122 of file cargotype.cpp.
References GetCustomCargoSprite(), and sprite.
Referenced by DrawCargoIcons().
|
inline |
Determines index of this cargospec.
Definition at line 89 of file cargotype.h.
References array.
Referenced by BuildLinkStatsLegend(), RefitWindow::BuildRefitList(), CalculateRefitMasks(), StationViewWindow::DrawCargoRatings(), CompanyStationsWindow::DrawWidget(), FormatString(), GetCargoIDByBitnum(), GetCargoIDByLabel(), InitializeSortedCargoSpecs(), CompanyStationsWindow::OnClick(), PaymentRatesGraphWindow::OnClick(), IndustryCargoesWindow::OnClick(), PaymentRatesGraphWindow::OnHundredthTick(), BuildVehicleWindow::SetCargoFilterArray(), StationResolverObject::StationResolverObject(), and TruncateCargo().
|
inline |
Tests for validity of this cargospec.
Definition at line 99 of file cargotype.h.
References bitnum, and INVALID_CARGO.
Referenced by BuildCargoTranslationMap(), CargoChangeInfo(), FinaliseCargoArray(), IndustryCargoesWindow::OnInit(), StationsWndShowStationRating(), TownHouseChangeInfo(), and LinkGraphLegendWindow::UpdateWidgetSize().
|
friend |
Set up the default cargo types for the given landscape type.
| l | Landscape |
Definition at line 42 of file cargotype.cpp.
| uint16 CargoSpec::classes |
Classes of this cargo type.
Definition at line 79 of file cargotype.h.
Referenced by CalculateRefitMasks(), CargoChangeInfo(), CMSAMine(), GetRefitCostFactor(), VehicleScopeResolver::GetVariable(), and InitializeSortedCargoSpecs().
1.8.1.2