|
OpenTTD Source 20261112-master-gbcbec5e63f
|
Field representing cargo connections. More...
Public Member Functions | |
| ConnectionChainField (CargoTypes cargo_types) | |
| Construct a new cargo connection chain field. | |
| int | Width () const override |
| Get the width of this 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. | |
| int | ConnectCargo (CargoType cargo, bool producer) |
| Connect a cargo to the cargo column. | |
| CargoSlotMask | GetConnections (bool accepting, bool supplying) const |
| Get the cargo connections. | |
| 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 | Height () const |
| Get the height of this field. | |
Data Fields | |
| std::array< CargoType, ChainField::MAX_CARGOES > | vertical_cargoes |
| Cargoes running from top to bottom (cargo type or INVALID_CARGO). | |
| CargoSlotMask | supp_cargoes = 0 |
Bitmask of cargoes in vertical_cargoes entering from the left. | |
| CargoSlotMask | cust_cargoes = 0 |
Bitmask of cargoes in vertical_cargoes leaving to the right. | |
| CargoSlotMask | skip_cargoes = 0 |
| Stop at the top of the vertical cargoes. | |
| CargoSlotMask | top_end = 0 |
| Stop at the top of the vertical cargoes. | |
| CargoSlotMask | bottom_end = 0 |
| Stop at the bottom of the vertical cargoes. | |
| uint8_t | num_cargoes |
| Number of cargoes. | |
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. | |
Field representing cargo connections.
Definition at line 2080 of file industry_gui.cpp.
|
inline |
Construct a new cargo connection chain field.
| cargo_types | The cargo types. |
Definition at line 2094 of file industry_gui.cpp.
References BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Count(), and INVALID_CARGO.
|
inlineoverridevirtual |
Decide which industry/house or cargo was clicked at.
| r | Rect of this cargo field. |
| pt | Click position in the cargo field. |
Reimplemented from ChainField.
Definition at line 2166 of file industry_gui.cpp.
References _current_text_dir, ChainField::ALL_CARGO_SLOTS, ChainField::cargo_line, ChainField::cargo_space, Rect::CentreToHeight(), Rect::CentreToWidth(), Rect::Contains(), ChainField::GetConnectionHeight(), HasBit(), Point, TD_RTL, Rect::Translate(), ChainField::vert_inter_industry_space, Rect::WithHeight(), Rect::WithWidth(), and Rect::WithX().
|
inline |
Connect a cargo to the cargo column.
| cargo | Cargo to connect. |
| producer | Cargo is produced (if false, cargo is assumed to be accepted). |
-1 if not connected at all. Definition at line 2223 of file industry_gui.cpp.
References HasBit(), IsValidCargoType(), and SetBit().
Referenced by ChainRow::MakeCargoLabel().
|
inlineoverridevirtual |
Draw the field.
| r | Rect to draw within. |
Implements ChainField.
Definition at line 2112 of file industry_gui.cpp.
References _current_text_dir, ChainField::ALL_CARGO_SLOTS, ChainField::cargo_line, ChainField::CARGO_LINE_COLOUR, ChainField::cargo_space, Rect::CentreToHeight(), Rect::CentreToWidth(), CargoSpec::Get(), ChainField::GetConnectionHeight(), GfxFillRect(), HasBit(), CargoSpec::legend_colour, WidgetDimensions::scaled, Rect::Shrink(), TD_RTL, Rect::Translate(), ChainField::vert_inter_industry_space, Rect::WithHeight(), Rect::WithWidth(), and Rect::WithX().
|
inline |
Get the cargo connections.
| accepting | Include accepting connections. |
| supplying | Include supplying connections. |
Definition at line 2250 of file industry_gui.cpp.
|
inlineoverridevirtual |
Get the width of this field.
Reimplemented from ChainField.
Definition at line 2107 of file industry_gui.cpp.
References ChainField::connection_field_width.
| CargoSlotMask ConnectionChainField::bottom_end = 0 |
Stop at the bottom of the vertical cargoes.
Definition at line 2087 of file industry_gui.cpp.
Referenced by IndustryCargoesWindow::ShortenConnectionsColumn().
| CargoSlotMask ConnectionChainField::cust_cargoes = 0 |
Bitmask of cargoes in vertical_cargoes leaving to the right.
Definition at line 2084 of file industry_gui.cpp.
| uint8_t ConnectionChainField::num_cargoes |
Number of cargoes.
Definition at line 2088 of file industry_gui.cpp.
Referenced by ChainRow::MakeCargoLabel().
| CargoSlotMask ConnectionChainField::skip_cargoes = 0 |
Stop at the top of the vertical cargoes.
Definition at line 2085 of file industry_gui.cpp.
Referenced by IndustryCargoesWindow::ShortenConnectionsColumn().
| CargoSlotMask ConnectionChainField::supp_cargoes = 0 |
Bitmask of cargoes in vertical_cargoes entering from the left.
Definition at line 2083 of file industry_gui.cpp.
| CargoSlotMask ConnectionChainField::top_end = 0 |
Stop at the top of the vertical cargoes.
Definition at line 2086 of file industry_gui.cpp.
Referenced by IndustryCargoesWindow::ShortenConnectionsColumn().
| std::array<CargoType, ChainField::MAX_CARGOES> ConnectionChainField::vertical_cargoes |
Cargoes running from top to bottom (cargo type or INVALID_CARGO).
Definition at line 2082 of file industry_gui.cpp.
Referenced by ChainRow::MakeCargoLabel().