OpenTTD Source 20261112-master-gbcbec5e63f
IndustryChainField Class Reference

Field representing an industry. More...

Inheritance diagram for IndustryChainField:
AcceptsProducesChainField ChainField

Public Member Functions

 IndustryChainField (IndustryType industry_type)
 Construct a new Industry chain field.
void Draw (Rect r) const override
 Draw the field.
ClickedAtResult ClickedAt (Rect r, Point pt) const override
 Decide which industry/house or cargo was clicked at.
CargoTypes GetProduced () override
 Connected the cargo types produced by this field.
CargoTypes GetAccepted () override
 Connected the cargo types accepted by this field.
Public Member Functions inherited from AcceptsProducesChainField
 AcceptsProducesChainField ()
 Construct a new Accepts/Produces chain field.
Public Member Functions inherited from ChainField
template<typename T>
T * Get ()
 Get this field as a specific type implemention.
template<typename T>
const T * Get () const
 Get this field as a specific type implemention.
virtual int Width () const
 Get the width of this field.
virtual int Height () const
 Get the height of this field.

Data Fields

IndustryType industry_type
 Industry type (NUM_INDUSTRYTYPES means 'houses').
Colours colour
 Colour for this industry.
Data Fields inherited from AcceptsProducesChainField
std::array< CargoType, ChainField::MAX_CARGOES > other_produced
 Cargoes produced but not used in this figure.
std::array< CargoType, ChainField::MAX_CARGOES > other_accepted
 Cargoes accepted but not used in this figure.

Additional Inherited Members

Public Types inherited from ChainField
using CargoSlotMask = uint16_t
 Type representing a mask of cargo slots.
using ClickedAtResult = std::variant<std::monostate, HouseID, IndustryType, CargoType>
 Result type of testing clicked position.
Static Public Member Functions inherited from ChainField
static uint GetConnectionHeight ()
 Get the height of all cargo connections in a row.
Static Public Attributes inherited from ChainField
static constexpr uint MAX_CARGOES = 16
 Maximum number of cargoes carried in a field.
static constexpr CargoSlotMask ALL_CARGO_SLOTS {std::numeric_limits<CargoSlotMask>::max()}
 Value representing all cargo slots.
static constexpr PixelColour CARGO_LINE_COLOUR = PC_BLACK
 Line colour around the cargo.
static FontSize fontsize = FontSize::Normal
 Font size of industry chain strings.
static CargoTypes town_accepts
 Mask of cargo types accepted by towns.
static CargoTypes town_produces
 Mask of cargo types produced by towns.
static int vert_inter_industry_space
 Amount of space between two industries in a column.
static int blob_distance
 Distance of the industry legend colour from the edge of the industry box.
static Dimension legend
 Dimension of the legend blob.
static Dimension cargo_border
 Dimensions of border between cargo lines and industry boxes.
static Dimension cargo_line
 Dimensions of cargo lines.
static Dimension cargo_space
 Dimensions of space between cargo lines.
static Dimension cargo_stub
 Dimensions of cargo stub (unconnected cargo line.).
static int small_height
 Height of the header row.
static int normal_height
 Height of the non-header rows.
static int connection_field_width
 Width of a cargo connection field.
static int industry_width
 Width of an industry field.
static uint max_cargoes
 Largest number of cargoes actually on any industry.

Detailed Description

Field representing an industry.

Definition at line 2353 of file industry_gui.cpp.

Constructor & Destructor Documentation

◆ IndustryChainField()

IndustryChainField::IndustryChainField ( IndustryType industry_type)
inline

Construct a new Industry chain field.

Parameters
industry_typeThe industry type.

Definition at line 2362 of file industry_gui.cpp.

References Brown, DarkGreen, Extractive, GetIndustrySpec(), industry_type, IndustrySpec::life_type, LightBlue, Mauve, Organic, Processing, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

Member Function Documentation

◆ ClickedAt()

ClickedAtResult IndustryChainField::ClickedAt ( Rect r,
Point pt ) const
inlineoverridevirtual

Decide which industry/house or cargo was clicked at.

Parameters
rRect of this cargo field.
ptClick position in the cargo field.
Returns
Industry/house or cargo clicked at.

Reimplemented from AcceptsProducesChainField.

Definition at line 2390 of file industry_gui.cpp.

References AcceptsProducesChainField::ClickedAt(), Rect::Contains(), and Point.

◆ Draw()

◆ GetAccepted()

CargoTypes IndustryChainField::GetAccepted ( )
inlineoverridevirtual

Connected the cargo types accepted by this field.

Returns
The accepted cargo types.

Implements AcceptsProducesChainField.

Definition at line 2402 of file industry_gui.cpp.

References IndustrySpec::accepts_cargo, and GetIndustrySpec().

◆ GetProduced()

CargoTypes IndustryChainField::GetProduced ( )
inlineoverridevirtual

Connected the cargo types produced by this field.

Returns
The produced cargo types.

Implements AcceptsProducesChainField.

Definition at line 2396 of file industry_gui.cpp.

References GetIndustrySpec().

Field Documentation

◆ colour

Colours IndustryChainField::colour

Colour for this industry.

Definition at line 2356 of file industry_gui.cpp.

◆ industry_type

IndustryType IndustryChainField::industry_type

Industry type (NUM_INDUSTRYTYPES means 'houses').

Definition at line 2355 of file industry_gui.cpp.

Referenced by IndustryChainField().


The documentation for this class was generated from the following file: