|
OpenTTD Source 20251104-master-g3befbdd52f
|
Data about a single field in the IndustryCargoesWindow panel. More...
Public Types | |
| using | Cargoes = uint16_t |
Public Member Functions | |
| void | MakeEmpty (CargoesFieldType type) |
| Make one of the empty fields (CFT_EMPTY or CFT_SMALL_EMPTY). | |
| void | MakeIndustry (IndustryType ind_type) |
| Make an industry type field. | |
| int | ConnectCargo (CargoType cargo, bool producer) |
| Connect a cargo from an industry to the CFT_CARGO column. | |
| bool | HasConnection () |
| Does this CFT_CARGO field have a horizontal connection? | |
| void | MakeCargo (const std::span< const CargoType > cargoes) |
| Make a piece of cargo column. | |
| void | MakeCargoLabel (const std::span< const CargoType > cargoes, bool left_align) |
| Make a field displaying cargo type names. | |
| void | MakeHeader (StringID textid) |
| Make a header above an industry column. | |
| int | GetCargoBase (int xpos) const |
| For a CFT_CARGO, compute the left position of the left-most vertical cargo connection. | |
| void | Draw (int xpos, int ypos) const |
| Draw the field. | |
| CargoType | CargoClickedAt (const CargoesField *left, const CargoesField *right, Point pt) const |
| Decide which cargo was clicked at in a CFT_CARGO field. | |
| CargoType | CargoLabelClickedAt (Point pt) const |
| Decide what cargo the user clicked in the cargo label field. | |
Data Fields | ||
| CargoesFieldType | type {} | |
| Type of field. | ||
| union { | ||
| struct { | ||
| IndustryType ind_type | ||
| Industry type (NUM_INDUSTRYTYPES means 'houses'). More... | ||
| std::array< CargoType, MAX_CARGOES > other_produced | ||
| Cargoes produced but not used in this figure. More... | ||
| std::array< CargoType, MAX_CARGOES > other_accepted | ||
| Cargoes accepted but not used in this figure. More... | ||
| } industry | ||
| Industry data (for CFT_INDUSTRY). | ||
| struct { | ||
| std::array< CargoType, MAX_CARGOES > vertical_cargoes | ||
| Cargoes running from top to bottom (cargo type or INVALID_CARGO). More... | ||
| Cargoes supp_cargoes | ||
Cargoes in vertical_cargoes entering from the left. More... | ||
| Cargoes cust_cargoes | ||
Cargoes in vertical_cargoes leaving to the right. More... | ||
| uint8_t num_cargoes | ||
| Number of cargoes. More... | ||
| uint8_t top_end | ||
| Stop at the top of the vertical cargoes. More... | ||
| uint8_t bottom_end | ||
| Stop at the bottom of the vertical cargoes. More... | ||
| } cargo | ||
| Cargo data (for CFT_CARGO). | ||
| struct { | ||
| std::array< CargoType, MAX_CARGOES > cargoes | ||
| Cargoes to display (or INVALID_CARGO). More... | ||
| bool left_align | ||
| Align all cargo texts to the left (else align to the right). More... | ||
| } cargo_label | ||
| Label data (for CFT_CARGO_LABEL). | ||
| StringID header | ||
| Header text (for CFT_HEADER). More... | ||
| } | u | |
Static Public Attributes | |
| 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 const PixelColour | INDUSTRY_LINE_COLOUR = PC_YELLOW |
| Line colour of the industry type box. | |
| static const PixelColour | CARGO_LINE_COLOUR = PC_YELLOW |
| Line colour around the cargo. | |
| static int | small_height |
| Height of the header row. | |
| static int | normal_height |
| Height of the non-header rows. | |
| static int | cargo_field_width |
| Width of a cargo field. | |
| static int | industry_width |
| Width of an industry field. | |
| static uint | max_cargoes |
| Largest number of cargoes actually on any industry. | |
Static Private Member Functions | |
| static void | DrawHorConnection (int left, int right, int top, const CargoSpec *csp) |
| Draw a horizontal cargo connection. | |
Data about a single field in the IndustryCargoesWindow panel.
Definition at line 1979 of file industry_gui.cpp.
| using CargoesField::Cargoes = uint16_t |
Definition at line 1997 of file industry_gui.cpp.
|
inline |
Decide which cargo was clicked at in a CFT_CARGO field.
| left | Left industry neighbour if available (else nullptr should be supplied). |
| right | Right industry neighbour if available (else nullptr should be supplied). |
| pt | Click position in the cargo field. |
Definition at line 2291 of file industry_gui.cpp.
References cargo_border, cargo_label, cargo_line, cargo_space, cargoes, CFT_CARGO, CFT_CARGO_LABEL, CFT_INDUSTRY, FS_NORMAL, GetCargoBase(), GetCharacterHeight(), HasBit(), industry, left_align, MAX_CARGOES, other_accepted, other_produced, type, vert_inter_industry_space, Coord2D< T >::x, and Coord2D< T >::y.
Referenced by IndustryCargoesWindow::OnClick(), and IndustryCargoesWindow::OnTooltip().
Decide what cargo the user clicked in the cargo label field.
| pt | Click position in the cargo label field. |
Definition at line 2349 of file industry_gui.cpp.
References cargo_border, cargo_space, CFT_CARGO_LABEL, FS_NORMAL, GetCharacterHeight(), MAX_CARGOES, type, vert_inter_industry_space, and Coord2D< T >::y.
Referenced by IndustryCargoesWindow::OnClick(), and IndustryCargoesWindow::OnTooltip().
|
inline |
Connect a cargo from an industry to the CFT_CARGO column.
| cargo | Cargo to connect. |
| producer | Cargo is produced (if false, cargo is assumed to be accepted). |
-1 if not accepted at all. Definition at line 2050 of file industry_gui.cpp.
References cargo, CFT_CARGO, HasBit(), IsValidCargoType(), SetBit(), and type.
Referenced by CargoesRow::ConnectIndustryAccepted(), CargoesRow::ConnectIndustryProduced(), and CargoesRow::MakeCargoLabel().
|
inline |
Draw the field.
| xpos | Position of the left edge. |
| ypos | Position of the top edge. |
Definition at line 2148 of file industry_gui.cpp.
References _current_text_dir, blob_distance, cargo_border, cargo_field_width, cargo_line, CARGO_LINE_COLOUR, cargo_space, cargo_stub, CFT_CARGO, CFT_CARGO_LABEL, CFT_EMPTY, CFT_HEADER, CFT_INDUSTRY, CFT_SMALL_EMPTY, DrawHorConnection(), DrawRectOutline(), DrawString(), FILLRECT_OPAQUE, WidgetDimensions::framerect, FS_NORMAL, CargoSpec::Get(), GetCargoBase(), GetCharacterHeight(), GetIndustrySpec(), GfxFillRect(), HasBit(), INDUSTRY_LINE_COLOUR, industry_width, IsValidCargoType(), legend, IndustrySpec::map_colour, MAX_CARGOES, max_cargoes, CargoSpec::name, IndustrySpec::name, normal_height, NUM_INDUSTRYTYPES, PC_BLACK, SA_HOR_CENTER, SA_LEFT, SA_RIGHT, WidgetDimensions::scaled, small_height, TD_RTL, type, and vert_inter_industry_space.
|
inlinestaticprivate |
Draw a horizontal cargo connection.
| left | Left-most coordinate to draw. |
| right | Right-most coordinate to draw. |
| top | Top coordinate of the cargo connection. |
| csp | Cargo to draw. |
Definition at line 2372 of file industry_gui.cpp.
References cargo_line, CARGO_LINE_COLOUR, FILLRECT_OPAQUE, and GfxFillRect().
Referenced by Draw().
|
inline |
For a CFT_CARGO, compute the left position of the left-most vertical cargo connection.
| xpos | Left position of the field. |
Definition at line 2135 of file industry_gui.cpp.
References cargo_field_width, cargo_line, cargo_space, CFT_CARGO, and type.
Referenced by CargoClickedAt(), and Draw().
|
inline |
Does this CFT_CARGO field have a horizontal connection?
true if a horizontal connection exists, false otherwise. Definition at line 2079 of file industry_gui.cpp.
|
inline |
Make a piece of cargo column.
| cargoes | Span of CargoType (may contain INVALID_CARGO). |
Definition at line 2091 of file industry_gui.cpp.
References cargoes, CFT_CARGO, IsValidCargoType(), and type.
Referenced by IndustryCargoesWindow::ComputeCargoDisplay(), and IndustryCargoesWindow::ComputeIndustryDisplay().
|
inline |
Make a field displaying cargo type names.
| cargoes | Span of CargoType (may contain INVALID_CARGO). |
| left_align | ALign texts to the left (else to the right). |
Definition at line 2111 of file industry_gui.cpp.
References cargoes, CFT_CARGO_LABEL, left_align, and type.
Referenced by CargoesRow::MakeCargoLabel().
|
inline |
Make one of the empty fields (CFT_EMPTY or CFT_SMALL_EMPTY).
| type | Type of empty field. |
Definition at line 2026 of file industry_gui.cpp.
References type.
Referenced by IndustryCargoesWindow::ComputeCargoDisplay(), and IndustryCargoesWindow::ComputeIndustryDisplay().
|
inline |
Make a header above an industry column.
| textid | Text to display. |
Definition at line 2124 of file industry_gui.cpp.
References CFT_HEADER, and type.
Referenced by IndustryCargoesWindow::ComputeCargoDisplay(), and IndustryCargoesWindow::ComputeIndustryDisplay().
|
inline |
Make an industry type field.
| ind_type | Industry type (NUM_INDUSTRYTYPES means 'houses'). |
Definition at line 2036 of file industry_gui.cpp.
References CFT_INDUSTRY, ind_type, and type.
|
static |
Distance of the industry legend colour from the edge of the industry box.
Definition at line 1981 of file industry_gui.cpp.
Referenced by Draw(), and IndustryCargoesWindow::OnInit().
| uint8_t CargoesField::bottom_end |
Stop at the bottom of the vertical cargoes.
Definition at line 2013 of file industry_gui.cpp.
|
static |
Dimensions of border between cargo lines and industry boxes.
Definition at line 1984 of file industry_gui.cpp.
Referenced by CargoClickedAt(), CargoLabelClickedAt(), Draw(), and IndustryCargoesWindow::OnInit().
|
static |
Width of a cargo field.
Definition at line 1993 of file industry_gui.cpp.
Referenced by IndustryCargoesWindow::CalculatePositionInWidget(), Draw(), IndustryCargoesWindow::DrawWidget(), GetCargoBase(), IndustryCargoesWindow::OnInit(), and IndustryCargoesWindow::UpdateWidgetSize().
|
static |
Dimensions of cargo lines.
Definition at line 1985 of file industry_gui.cpp.
Referenced by CargoClickedAt(), Draw(), DrawHorConnection(), GetCargoBase(), and IndustryCargoesWindow::OnInit().
|
static |
Line colour around the cargo.
Definition at line 1990 of file industry_gui.cpp.
Referenced by Draw(), and DrawHorConnection().
|
static |
Dimensions of space between cargo lines.
Definition at line 1986 of file industry_gui.cpp.
Referenced by CargoClickedAt(), CargoLabelClickedAt(), Draw(), GetCargoBase(), and IndustryCargoesWindow::OnInit().
|
static |
Dimensions of cargo stub (unconnected cargo line.)
Definition at line 1987 of file industry_gui.cpp.
Referenced by Draw(), and IndustryCargoesWindow::OnInit().
| std::array<CargoType, MAX_CARGOES> CargoesField::cargoes |
Cargoes to display (or INVALID_CARGO).
Definition at line 2016 of file industry_gui.cpp.
Referenced by CargoClickedAt(), MakeCargo(), and MakeCargoLabel().
| Cargoes CargoesField::cust_cargoes |
Cargoes in vertical_cargoes leaving to the right.
Definition at line 2010 of file industry_gui.cpp.
Referenced by CargoesRow::ConnectIndustryAccepted().
| StringID CargoesField::header |
Header text (for CFT_HEADER).
Definition at line 2019 of file industry_gui.cpp.
| IndustryType CargoesField::ind_type |
Industry type (NUM_INDUSTRYTYPES means 'houses').
Definition at line 2003 of file industry_gui.cpp.
Referenced by CargoesRow::ConnectIndustryAccepted(), CargoesRow::ConnectIndustryProduced(), MakeIndustry(), IndustryCargoesWindow::OnClick(), and IndustryCargoesWindow::OnTooltip().
|
static |
Line colour of the industry type box.
Definition at line 1989 of file industry_gui.cpp.
Referenced by Draw().
|
static |
Width of an industry field.
Definition at line 1994 of file industry_gui.cpp.
Referenced by IndustryCargoesWindow::CalculatePositionInWidget(), Draw(), IndustryCargoesWindow::DrawWidget(), IndustryCargoesWindow::OnInit(), and IndustryCargoesWindow::UpdateWidgetSize().
| bool CargoesField::left_align |
Align all cargo texts to the left (else align to the right).
Definition at line 2017 of file industry_gui.cpp.
Referenced by CargoClickedAt(), and MakeCargoLabel().
|
static |
Dimension of the legend blob.
Definition at line 1983 of file industry_gui.cpp.
Referenced by Draw(), and IndustryCargoesWindow::OnInit().
|
static |
Largest number of cargoes actually on any industry.
Definition at line 1995 of file industry_gui.cpp.
Referenced by CargoesRow::ConnectIndustryAccepted(), CargoesRow::ConnectIndustryProduced(), Draw(), and IndustryCargoesWindow::OnInit().
|
static |
Height of the non-header rows.
Definition at line 1992 of file industry_gui.cpp.
Referenced by IndustryCargoesWindow::CalculatePositionInWidget(), Draw(), IndustryCargoesWindow::DrawWidget(), IndustryCargoesWindow::OnInit(), and IndustryCargoesWindow::UpdateWidgetSize().
| uint8_t CargoesField::num_cargoes |
Number of cargoes.
Definition at line 2011 of file industry_gui.cpp.
Referenced by CargoesRow::ConnectIndustryAccepted(), CargoesRow::ConnectIndustryProduced(), and CargoesRow::MakeCargoLabel().
| std::array<CargoType, MAX_CARGOES> CargoesField::other_accepted |
Cargoes accepted but not used in this figure.
Definition at line 2005 of file industry_gui.cpp.
Referenced by CargoClickedAt(), and CargoesRow::ConnectIndustryAccepted().
| std::array<CargoType, MAX_CARGOES> CargoesField::other_produced |
Cargoes produced but not used in this figure.
Definition at line 2004 of file industry_gui.cpp.
Referenced by CargoClickedAt(), and CargoesRow::ConnectIndustryProduced().
|
static |
Height of the header row.
Definition at line 1992 of file industry_gui.cpp.
Referenced by IndustryCargoesWindow::CalculatePositionInWidget(), Draw(), IndustryCargoesWindow::DrawWidget(), IndustryCargoesWindow::OnInit(), IndustryCargoesWindow::OnResize(), and IndustryCargoesWindow::UpdateWidgetSize().
| Cargoes CargoesField::supp_cargoes |
Cargoes in vertical_cargoes entering from the left.
Definition at line 2009 of file industry_gui.cpp.
Referenced by CargoesRow::ConnectIndustryProduced().
| uint8_t CargoesField::top_end |
Stop at the top of the vertical cargoes.
Definition at line 2012 of file industry_gui.cpp.
| CargoesFieldType CargoesField::type {} |
Type of field.
Definition at line 2000 of file industry_gui.cpp.
Referenced by CargoClickedAt(), CargoLabelClickedAt(), ConnectCargo(), CargoesRow::ConnectIndustryAccepted(), CargoesRow::ConnectIndustryProduced(), Draw(), GetCargoBase(), HasConnection(), MakeCargo(), MakeCargoLabel(), CargoesRow::MakeCargoLabel(), MakeEmpty(), MakeHeader(), MakeIndustry(), IndustryCargoesWindow::OnClick(), and IndustryCargoesWindow::OnTooltip().
|
static |
Amount of space between two industries in a column.
Definition at line 1980 of file industry_gui.cpp.
Referenced by CargoClickedAt(), CargoLabelClickedAt(), Draw(), and IndustryCargoesWindow::OnInit().
| std::array<CargoType, MAX_CARGOES> CargoesField::vertical_cargoes |
Cargoes running from top to bottom (cargo type or INVALID_CARGO).
Definition at line 2008 of file industry_gui.cpp.
Referenced by CargoesRow::ConnectIndustryAccepted(), CargoesRow::ConnectIndustryProduced(), and CargoesRow::MakeCargoLabel().