|
OpenTTD Source
14.0-beta3
|
Data about a single field in the IndustryCargoesWindow panel. More...
Public Member Functions | |
| void | MakeEmpty (CargoesFieldType type) |
| Make one of the empty fields (CFT_EMPTY or CFT_SMALL_EMPTY). More... | |
| void | MakeIndustry (IndustryType ind_type) |
| Make an industry type field. More... | |
| int | ConnectCargo (CargoID cargo, bool producer) |
| Connect a cargo from an industry to the CFT_CARGO column. More... | |
| bool | HasConnection () |
| Does this CFT_CARGO field have a horizontal connection? More... | |
| void | MakeCargo (const CargoID *cargoes, uint length, int count=-1, bool top_end=false, bool bottom_end=false) |
| Make a piece of cargo column. More... | |
| void | MakeCargoLabel (const CargoID *cargoes, uint length, bool left_align) |
| Make a field displaying cargo type names. More... | |
| void | MakeHeader (StringID textid) |
| Make a header above an industry column. More... | |
| int | GetCargoBase (int xpos) const |
| For a CFT_CARGO, compute the left position of the left-most vertical cargo connection. More... | |
| void | Draw (int xpos, int ypos) const |
| Draw the field. More... | |
| CargoID | CargoClickedAt (const CargoesField *left, const CargoesField *right, Point pt) const |
| Decide which cargo was clicked at in a CFT_CARGO field. More... | |
| CargoID | CargoLabelClickedAt (Point pt) const |
| Decide what cargo the user clicked in the cargo label field. More... | |
Data Fields | |
| CargoesFieldType | type |
| Type of field. | |
| union { | |
| struct { | |
| IndustryType ind_type | |
| Industry type (NUM_INDUSTRYTYPES means 'houses'). | |
| CargoID other_produced [MAX_CARGOES] | |
| Cargoes produced but not used in this figure. | |
| CargoID other_accepted [MAX_CARGOES] | |
| Cargoes accepted but not used in this figure. | |
| } industry | |
| Industry data (for CFT_INDUSTRY). | |
| struct { | |
| CargoID vertical_cargoes [MAX_CARGOES] | |
| Cargoes running from top to bottom (cargo ID or #INVALID_CARGO). | |
| uint8_t num_cargoes | |
| Number of cargoes. | |
| CargoID supp_cargoes [MAX_CARGOES] | |
| Cargoes entering from the left (index in vertical_cargoes, or #INVALID_CARGO). | |
| uint8_t top_end | |
| Stop at the top of the vertical cargoes. | |
| CargoID cust_cargoes [MAX_CARGOES] | |
| Cargoes leaving to the right (index in vertical_cargoes, or #INVALID_CARGO). | |
| uint8_t bottom_end | |
| Stop at the bottom of the vertical cargoes. | |
| } cargo | |
| Cargo data (for CFT_CARGO). | |
| struct { | |
| CargoID cargoes [MAX_CARGOES] | |
| Cargoes to display (or #INVALID_CARGO). | |
| bool left_align | |
| Align all cargo texts to the left (else align to the right). | |
| } cargo_label | |
| Label data (for CFT_CARGO_LABEL). | |
| StringID header | |
| Header text (for CFT_HEADER). | |
| } | 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 int | INDUSTRY_LINE_COLOUR = PC_YELLOW |
| Line colour of the industry type box. | |
| static const int | 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. More... | |
Data about a single field in the IndustryCargoesWindow panel.
Definition at line 1966 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 2289 of file industry_gui.cpp.
References cargo_border, cargo_line, cargo_space, CFT_CARGO, GetCargoBase(), MAX_CARGOES, and vert_inter_industry_space.
Decide what cargo the user clicked in the cargo label field.
| pt | Click position in the cargo label field. |
Definition at line 2347 of file industry_gui.cpp.
References cargo_border, CFT_CARGO_LABEL, MAX_CARGOES, and vert_inter_industry_space.
|
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 2034 of file industry_gui.cpp.
References cargo, CFT_CARGO, and IsValidCargoID().
|
inline |
Draw the field.
| xpos | Position of the left edge. |
| ypos | Position of the top edge. |
Definition at line 2146 of file industry_gui.cpp.
References CFT_EMPTY, CFT_HEADER, CFT_SMALL_EMPTY, DrawString(), FS_NORMAL, GetCharacterHeight(), industry_width, and small_height.
|
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 2370 of file industry_gui.cpp.
|
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 2133 of file industry_gui.cpp.
References cargo_field_width, cargo_line, cargo_space, and CFT_CARGO.
Referenced by CargoClickedAt().
|
inline |
Does this CFT_CARGO field have a horizontal connection?
true if a horizontal connection exists, false otherwise. Definition at line 2063 of file industry_gui.cpp.
References CFT_CARGO, IsValidCargoID(), and MAX_CARGOES.
|
inline |
Make a piece of cargo column.
| cargoes | Array of CargoID (may contain #INVALID_CARGO). |
| length | Number of cargoes in cargoes. |
| count | Number of cargoes to display (should be at least the number of valid cargoes, or -1 to let the method compute it). |
| top_end | This is the first cargo field of this column. |
| bottom_end | This is the last cargo field of this column. |
Definition at line 2083 of file industry_gui.cpp.
References cargoes, CFT_CARGO, and IsValidCargoID().
Referenced by IndustryCargoesWindow::ComputeCargoDisplay(), and IndustryCargoesWindow::ComputeIndustryDisplay().
|
inline |
Make a field displaying cargo type names.
| cargoes | Array of CargoID (may contain #INVALID_CARGO). |
| length | Number of cargoes in cargoes. |
| left_align | ALign texts to the left (else to the right). |
Definition at line 2109 of file industry_gui.cpp.
References cargoes, CFT_CARGO_LABEL, and MAX_CARGOES.
|
inline |
Make one of the empty fields (CFT_EMPTY or CFT_SMALL_EMPTY).
| type | Type of empty field. |
Definition at line 2010 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 2122 of file industry_gui.cpp.
References CFT_HEADER.
Referenced by IndustryCargoesWindow::ComputeCargoDisplay(), and IndustryCargoesWindow::ComputeIndustryDisplay().
|
inline |
Make an industry type field.
| ind_type | Industry type (NUM_INDUSTRYTYPES means 'houses'). |
Definition at line 2020 of file industry_gui.cpp.
References CFT_INDUSTRY, and ind_type.