OpenTTD Source: src/industry_gui.cpp File Reference

OpenTTD Source 15.3

Data Structures | Typedefs | Enumerations | Functions | Variables
industry_gui.cpp File Reference

GUIs related to industries. More...

`#include "stdafx.h"`
`#include <ranges>`
`#include "error.h"`
`#include "gui.h"`
`#include "settings_gui.h"`
`#include "sound_func.h"`
`#include "window_func.h"`
`#include "textbuf_gui.h"`
`#include "command_func.h"`
`#include "viewport_func.h"`
`#include "industry.h"`
`#include "town.h"`
`#include "cheat_type.h"`
`#include "newgrf_badge.h"`
`#include "newgrf_badge_gui.h"`
`#include "newgrf_industries.h"`
`#include "newgrf_text.h"`
`#include "newgrf_debug.h"`
`#include "network/network.h"`
`#include "strings_func.h"`
`#include "company_func.h"`
`#include "tilehighlight_func.h"`
`#include "string_func.h"`
`#include "sortlist_type.h"`
`#include "dropdown_func.h"`
`#include "company_base.h"`
`#include "core/geometry_func.hpp"`
`#include "core/random_func.hpp"`
`#include "core/backup_type.hpp"`
`#include "genworld.h"`
`#include "smallmap_gui.h"`
`#include "dropdown_type.h"`
`#include "clear_map.h"`
`#include "zoom_func.h"`
`#include "industry_cmd.h"`
`#include "graph_gui.h"`
`#include "querystring_gui.h"`
`#include "stringfilter_type.h"`
`#include "timer/timer.h"`
`#include "timer/timer_window.h"`
`#include "hotkeys.h"`
`#include "core/string_consumer.hpp"`
`#include "widgets/industry_widget.h"`
`#include "table/strings.h"`
`#include <bitset>`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | CargoSuffix
| Transfer storage of cargo suffix information. More...
class | BuildIndustryWindow
| Build (fund or prospect) a new industry,. More...
class | IndustryViewWindow
class | IndustryDirectoryWindow
| The list of industries. More...
struct | CargoesField
| Data about a single field in the IndustryCargoesWindow panel. More...
struct | CargoesRow
| A single row of CargoesField. More...
struct | IndustryCargoesWindow
| Window displaying the cargo connections around an industry (or cargo). More...

## Typedefs
typedef GUIList< const Industry *, const CargoType &, const std::pair< CargoType, CargoType > & > | GUIIndustryList

## Enumerations
enum | CargoSuffixType : uint8_t { CST_FUND , CST_VIEW , CST_DIR }
| Cargo suffix type (for which window is it requested) More...
enum | CargoSuffixDisplay : uint8_t { CSD_CARGO , CSD_CARGO_AMOUNT , CSD_CARGO_TEXT , CSD_CARGO_AMOUNT_TEXT }
| Ways of displaying the cargo. More...
enum | CargoSuffixInOut : uint8_t { CARGOSUFFIX_OUT = 0 , CARGOSUFFIX_IN = 1 }
enum | CargoesFieldType : uint8_t { CFT_EMPTY , CFT_SMALL_EMPTY , CFT_INDUSTRY , CFT_CARGO , CFT_CARGO_LABEL , CFT_HEADER }
| Available types of field. More...

## Functions
void | GenerateIndustries ()
| This function will create random industries during game creation.
static void | ShowIndustryCargoesWindow (IndustryType id)
| Open the industry and cargoes window.
static void | GetCargoSuffix (uint cargo, CargoSuffixType cst, const Industry *ind, IndustryType ind_type, const IndustrySpec *indspec, CargoSuffix &suffix)
| Gets the string to display after the cargo name (using callback 37)
template<typename TC , typename TS >
static void | GetAllCargoSuffixes (CargoSuffixInOut use_input, CargoSuffixType cst, const Industry *ind, IndustryType ind_type, const IndustrySpec *indspec, const TC &cargoes, TS &suffixes)
| Gets all strings to display after the cargoes of industries (using callback 37)
void | GetCargoSuffix (CargoSuffixInOut use_input, CargoSuffixType cst, const Industry *ind, IndustryType ind_type, const IndustrySpec *indspec, CargoType cargo, uint8_t slot, CargoSuffix &suffix)
| Gets the strings to display after the cargo of industries (using callback 37)
static bool | IndustryTypeNameSorter (const IndustryType &a, const IndustryType &b)
| Sort industry types by their name.
void | SortIndustryTypes ()
| Initialize the list of sorted industry types.
void | ShowBuildIndustryWindow ()
static void | UpdateIndustryProduction (Industry *i)
static bool | IsProductionAlterable (const Industry *i)
void | ShowIndustryViewWindow (IndustryID industry)
static bool | CargoFilter (const Industry *const *industry, const std::pair< CargoType, CargoType > &cargoes)
| Cargo filter functions.
void | ShowIndustryDirectory ()
void | ShowIndustryCargoesWindow ()
| Open the industry and cargoes window with an industry.

## Variables
bool | _ignore_industry_restrictions
std::bitset< NUM_INDUSTRYTYPES > | _displayed_industries
| Communication from the industry chain window to the smallmap window about what industries to display.
std::array< IndustryType, NUM_INDUSTRYTYPES > | _sorted_industry_types
| Industry types sorted by name.
static constexpr std::initializer_list< NWidgetPart > | _nested_build_industry_widgets
static WindowDesc | _build_industry_desc (WDP_AUTO, "build_industry", 170, 212, WC_BUILD_INDUSTRY, WC_NONE, WindowDefaultFlag::Construction, _nested_build_industry_widgets)
| Window definition of the dynamic place industries gui.
static constexpr std::initializer_list< NWidgetPart > | _nested_industry_view_widgets
| Widget definition of the view industry gui.
static WindowDesc | _industry_view_desc (WDP_AUTO, "view_industry", 260, 120, WC_INDUSTRY_VIEW, WC_NONE, {}, _nested_industry_view_widgets)
| Window definition of the view industry gui.
static constexpr std::initializer_list< NWidgetPart > | _nested_industry_directory_widgets
| Widget definition of the industry directory gui.
static GUIIndustryList::FilterFunction *const | _industry_filter_funcs [] = { &CargoFilter }
static WindowDesc | _industry_directory_desc (WDP_AUTO, "list_industries", 428, 190, WC_INDUSTRY_DIRECTORY, WC_NONE, {}, _nested_industry_directory_widgets, &IndustryDirectoryWindow::hotkeys)
| Window definition of the industry directory gui.
static constexpr std::initializer_list< NWidgetPart > | _nested_industry_cargoes_widgets
| Widgets of the industry cargoes window.
static WindowDesc | _industry_cargoes_desc (WDP_AUTO, "industry_cargoes", 300, 210, WC_INDUSTRY_CARGOES, WC_NONE, {}, _nested_industry_cargoes_widgets)
| Window description for the industry cargoes window.
static const uint | MAX_CARGOES = 16
| Maximum number of cargoes carried in a CFT_CARGO field in CargoesField.

## Detailed Description

GUIs related to industries.

Definition in file industry_gui.cpp.

## Typedef Documentation

## ◆ GUIIndustryList

typedef GUIList<const Industry *, const CargoType &, const std::pair<CargoType, CargoType> &> GUIIndustryList

Definition at line 1267 of file industry_gui.cpp.

## Enumeration Type Documentation

## ◆ CargoesFieldType

enum CargoesFieldType : uint8_t

Available types of field.

Enumerator
CFT_EMPTY | Empty field.
CFT_SMALL_EMPTY | Empty small field (for the header).
CFT_INDUSTRY | Display industry.
CFT_CARGO | Display cargo connections.
CFT_CARGO_LABEL | Display cargo labels.
CFT_HEADER | Header text.

Definition at line 1958 of file industry_gui.cpp.

## ◆ CargoSuffixDisplay

enum CargoSuffixDisplay : uint8_t

Ways of displaying the cargo.

Enumerator
CSD_CARGO | Display the cargo without sub-type (cb37 result 401).
CSD_CARGO_AMOUNT | Display the cargo and amount (if useful), but no sub-type (cb37 result 400 or fail).
CSD_CARGO_TEXT | Display then cargo and supplied string (cb37 result 800-BFF).
CSD_CARGO_AMOUNT_TEXT | Display then cargo, amount, and string (cb37 result 000-3FF).

Definition at line 72 of file industry_gui.cpp.

## ◆ CargoSuffixInOut

enum CargoSuffixInOut : uint8_t

Definition at line 152 of file industry_gui.cpp.

## ◆ CargoSuffixType

enum CargoSuffixType : uint8_t

Cargo suffix type (for which window is it requested)

Enumerator
CST_FUND | Fund-industry window.
CST_VIEW | View-industry window.
CST_DIR | Industry-directory window.

Definition at line 65 of file industry_gui.cpp.

## Function Documentation

## ◆ CargoFilter()

static bool CargoFilter | ( | const Industry *const * | industry,
|  | const std::pair< CargoType, CargoType > & | cargoes
| ) |  |
| static

Cargo filter functions.

Check whether an industry accepts and produces a certain cargo pair.

Parameters

  industry | The industry whose cargoes will being checked.
  cargoes | The accepted and produced cargo pair to look for.

Returns
  bool Whether the given cargoes accepted and produced by the industry.

Definition at line 1276 of file industry_gui.cpp.

References CargoFilterCriteria::CF_ANY, and CargoFilterCriteria::CF_NONE.

## ◆ GenerateIndustries()

void GenerateIndustries | ( |  | ) |
| extern

This function will create random industries during game creation.

It will scale the amount of industries by mapsize and difficulty level.

Definition at line 2488 of file industry_cmd.cpp.

## ◆ GetAllCargoSuffixes()

template<typename TC , typename TS >

static void GetAllCargoSuffixes | ( | CargoSuffixInOut | use_input,
|  | CargoSuffixType | cst,
|  | const Industry * | ind,
|  | IndustryType | ind_type,
|  | const IndustrySpec * | indspec,
|  | const TC & | cargoes,
|  | TS & | suffixes
| ) |  |
| inlinestatic

Gets all strings to display after the cargoes of industries (using callback 37)

Parameters

  use_input | get suffixes for output cargoes or input cargoes?
  cst | the cargo suffix type (for which window is it requested).

See also
  CargoSuffixType

Parameters

  ind | the industry (nullptr if in fund window)
  ind_type | the industry type
  indspec | the industry spec
  cargoes | array with cargotypes. for INVALID_CARGO no suffix will be determined
  suffixes | is filled with the suffixes

Definition at line 168 of file industry_gui.cpp.

References IndustrySpec::behaviour, GRFFile::cargo_map, CargoTypesUnlimited, CSD_CARGO, GetCargoSuffix(), IndustrySpec::grf_prop, GRFFilePropsBase::grffile, IsValidCargoType(), lengthof, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

Referenced by BuildIndustryWindow::DrawWidget(), and BuildIndustryWindow::UpdateWidgetSize().

## ◆ GetCargoSuffix() [1/2]

void GetCargoSuffix | ( | CargoSuffixInOut | use_input,
|  | CargoSuffixType | cst,
|  | const Industry * | ind,
|  | IndustryType | ind_type,
|  | const IndustrySpec * | indspec,
|  | CargoType | cargo,
|  | uint8_t | slot,
|  | CargoSuffix & | suffix
| ) |  |

Gets the strings to display after the cargo of industries (using callback 37)

Parameters

  use_input | get suffixes for output cargo or input cargo?
  cst | the cargo suffix type (for which window is it requested).

See also
  CargoSuffixType

Parameters

  ind | the industry (nullptr if in fund window)
  ind_type | the industry type
  indspec | the industry spec
  cargo | cargotype. for INVALID_CARGO no suffix will be determined
  slot | accepts/produced slot number, used for old-style 3-in/2-out industries.
  suffix | is filled with the suffix

Definition at line 219 of file industry_gui.cpp.

References IndustrySpec::behaviour, GRFFile::cargo_map, CargoTypesUnlimited, CSD_CARGO, CargoSuffix::display, GetCargoSuffix(), IndustrySpec::grf_prop, GRFFilePropsBase::grffile, INDUSTRY_ORIGINAL_NUM_INPUTS, INDUSTRY_ORIGINAL_NUM_OUTPUTS, IsValidCargoType(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and CargoSuffix::text.

## ◆ GetCargoSuffix() [2/2]

static void GetCargoSuffix | ( | uint | cargo,
|  | CargoSuffixType | cst,
|  | const Industry * | ind,
|  | IndustryType | ind_type,
|  | const IndustrySpec * | indspec,
|  | CargoSuffix & | suffix
| ) |  |
| static

Gets the string to display after the cargo name (using callback 37)

Parameters

  cargo | the cargo for which the suffix is requested, meaning depends on presence of flag 18 in prop 1A
  cst | the cargo suffix type (for which window is it requested).

See also
  CargoSuffixType

Parameters

  ind | the industry (nullptr if in fund window)
  ind_type | the industry type
  indspec | the industry spec
  suffix | is filled with the string to display

Definition at line 97 of file industry_gui.cpp.

References CALLBACK_FAILED, IndustrySpec::callback_mask, CargoSuffix, CBID_INDUSTRY_CARGO_SUFFIX, CSD_CARGO, CSD_CARGO_AMOUNT, CSD_CARGO_AMOUNT_TEXT, CSD_CARGO_TEXT, CST_FUND, CargoSuffix::display, ErrorUnknownCallbackResult(), GB(), GetGRFStringWithTextStack(), GetIndustryCallback(), IndustrySpec::grf_prop, GRFFilePropsBase::grffile, GRFFilePropsBase::grfid, GRFSTR_MISC_GRF_TEXT, INVALID_TILE, Industry::location, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), CargoSuffix::text, and OrthogonalTileArea::tile.

Referenced by IndustryViewWindow::DrawInfo(), GetAllCargoSuffixes(), GetCargoSuffix(), and IndustryDirectoryWindow::GetIndustryString().

## ◆ IndustryTypeNameSorter()

static bool IndustryTypeNameSorter | ( | const IndustryType & | a,
|  | const IndustryType & | b
| ) |  |
| static

Sort industry types by their name.

Definition at line 238 of file industry_gui.cpp.

References GetIndustrySpec(), GetString(), and StrNaturalCompare().

Referenced by SortIndustryTypes().

## ◆ IsProductionAlterable()

static bool IsProductionAlterable | ( | const Industry * | i | ) |
| inlinestatic

Definition at line 774 of file industry_gui.cpp.

## ◆ ShowBuildIndustryWindow()

void ShowBuildIndustryWindow | ( |  | ) |

Definition at line 765 of file industry_gui.cpp.

## ◆ ShowIndustryCargoesWindow() [1/2]

void ShowIndustryCargoesWindow | ( |  | ) |

Open the industry and cargoes window with an industry.

Definition at line 3194 of file industry_gui.cpp.

References NUM_INDUSTRYTYPES, and ShowIndustryCargoesWindow().

Referenced by MenuClickIndustry(), BuildIndustryWindow::OnClick(), IndustryViewWindow::OnClick(), and ShowIndustryCargoesWindow().

## ◆ ShowIndustryCargoesWindow() [2/2]

static void ShowIndustryCargoesWindow | ( | IndustryType | id | ) |
| static

Open the industry and cargoes window.

Parameters

  id | Industry type to display, `NUM_INDUSTRYTYPES` selects a default industry type.

Definition at line 3172 of file industry_gui.cpp.

References _sorted_industry_types, BringWindowToFrontById(), IndustrySpec::enabled, GetIndustrySpec(), Window::InvalidateData(), NUM_INDUSTRYTYPES, and WC_INDUSTRY_CARGOES.

## ◆ ShowIndustryDirectory()

void ShowIndustryDirectory | ( |  | ) |

Definition at line 1919 of file industry_gui.cpp.

## ◆ ShowIndustryViewWindow()

void ShowIndustryViewWindow | ( | IndustryID | industry | ) |

Definition at line 1230 of file industry_gui.cpp.

## ◆ SortIndustryTypes()

void SortIndustryTypes | ( |  | ) |

Initialize the list of sorted industry types.

Definition at line 249 of file industry_gui.cpp.

References _sorted_industry_types, IndustryTypeNameSorter(), and NUM_INDUSTRYTYPES.

Referenced by AfterLoadGRFs(), and ReadLanguagePack().

## ◆ UpdateIndustryProduction()

static void UpdateIndustryProduction | ( | Industry * | i | ) |
| static

Definition at line 1185 of file industry_gui.cpp.

## Variable Documentation

## ◆ _displayed_industries

std::bitset<NUM_INDUSTRYTYPES> _displayed_industries

Communication from the industry chain window to the smallmap window about what industries to display.

Definition at line 62 of file industry_gui.cpp.

Referenced by IndustryCargoesWindow::ComputeCargoDisplay(), IndustryCargoesWindow::ComputeIndustryDisplay(), and SmallMapWindow::OnInvalidateData().

## ◆ _ignore_industry_restrictions

bool _ignore_industry_restrictions

Definition at line 61 of file industry_gui.cpp.

## ◆ _industry_filter_funcs

GUIIndustryList::FilterFunction* const _industry_filter_funcs[] = { &CargoFilter }
| static

Definition at line 1316 of file industry_gui.cpp.

## ◆ _nested_build_industry_widgets

constexpr std::initializer_list<NWidgetPart> _nested_build_industry_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetStringTip(STR_FUND_INDUSTRY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
EndContainer(),
NWidget(NWID_SELECTION, COLOUR_DARK_GREEN, WID_DPI_SCENARIO_EDITOR_PANE),
NWidget(NWID_VERTICAL),
NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, WID_DPI_CREATE_RANDOM_INDUSTRIES_WIDGET), SetMinimalSize(0, 12), SetFill(1, 0), SetResize(1, 0),
SetStringTip(STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES, STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES_TOOLTIP),
NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, WID_DPI_REMOVE_ALL_INDUSTRIES_WIDGET), SetMinimalSize(0, 12), SetFill(1, 0), SetResize(1, 0),
SetStringTip(STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES, STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES_TOOLTIP),
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, WID_DPI_MATRIX_WIDGET), SetMatrixDataTip(1, 0, STR_FUND_INDUSTRY_SELECTION_TOOLTIP), SetFill(1, 0), SetResize(1, 1), SetScrollbar(WID_DPI_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, WID_DPI_SCROLLBAR),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_DPI_INFOPANEL), SetResize(1, 0),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, WID_DPI_DISPLAY_WIDGET), SetFill(1, 0), SetResize(1, 0),
SetStringTip(STR_INDUSTRY_DISPLAY_CHAIN, STR_INDUSTRY_DISPLAY_CHAIN_TOOLTIP),
NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, WID_DPI_FUND_WIDGET), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_RESIZEBOX, COLOUR_DARK_GREEN),
EndContainer(),
}
SetMatrixDataTip
constexpr NWidgetPart SetMatrixDataTip(uint32_t cols, uint32_t rows, StringID tip={})
Widget part function for setting the data and tooltip of WWT_MATRIX widgets.
Definition widget_type.h:1311
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition widget_type.h:1222
SetScrollbar
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
Definition widget_type.h:1402
SetStringTip
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
Definition widget_type.h:1243
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1159
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1232
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1427
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1148
WID_DPI_MATRIX_WIDGET
@ WID_DPI_MATRIX_WIDGET
Matrix of the industries.
Definition industry_widget.h:18
WID_DPI_REMOVE_ALL_INDUSTRIES_WIDGET
@ WID_DPI_REMOVE_ALL_INDUSTRIES_WIDGET
Remove all industries button.
Definition industry_widget.h:16
WID_DPI_INFOPANEL
@ WID_DPI_INFOPANEL
Info panel about the industry.
Definition industry_widget.h:20
WID_DPI_SCENARIO_EDITOR_PANE
@ WID_DPI_SCENARIO_EDITOR_PANE
Pane containing SE-only widgets.
Definition industry_widget.h:15
WID_DPI_SCROLLBAR
@ WID_DPI_SCROLLBAR
Scrollbar of the matrix.
Definition industry_widget.h:19
WID_DPI_CREATE_RANDOM_INDUSTRIES_WIDGET
@ WID_DPI_CREATE_RANDOM_INDUSTRIES_WIDGET
Create random industries button.
Definition industry_widget.h:17
WID_DPI_FUND_WIDGET
@ WID_DPI_FUND_WIDGET
Fund button.
Definition industry_widget.h:22
WID_DPI_DISPLAY_WIDGET
@ WID_DPI_DISPLAY_WIDGET
Display chain button.
Definition industry_widget.h:21
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:66
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition widget_type.h:44
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition widget_type.h:57
WWT_MATRIX
@ WWT_MATRIX
Grid of rows and columns.
Definition widget_type.h:50
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition widget_type.h:55
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:52
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition widget_type.h:76
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:68
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:60
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition widget_type.h:59
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition widget_type.h:56
NWID_SELECTION
@ NWID_SELECTION
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition widget_type.h:71

Definition at line 260 of file industry_gui.cpp.

## ◆ _nested_industry_cargoes_widgets

constexpr std::initializer_list<NWidgetPart> _nested_industry_cargoes_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_IC_CAPTION),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_IC_PANEL), SetResize(1, 10), SetScrollbar(WID_IC_SCROLLBAR), EndContainer(),
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_IC_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_IC_NOTIFY),
SetStringTip(STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP, STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_BROWN), SetFill(1, 0), SetResize(0, 0), EndContainer(),
NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_IC_IND_DROPDOWN), SetFill(0, 0), SetResize(0, 0),
SetStringTip(STR_INDUSTRY_CARGOES_SELECT_INDUSTRY, STR_INDUSTRY_CARGOES_SELECT_INDUSTRY_TOOLTIP),
NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_IC_CARGO_DROPDOWN), SetFill(0, 0), SetResize(0, 0),
SetStringTip(STR_INDUSTRY_CARGOES_SELECT_CARGO, STR_INDUSTRY_CARGOES_SELECT_CARGO_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
EndContainer(),
}
WID_IC_SCROLLBAR
@ WID_IC_SCROLLBAR
Scrollbar of the panel.
Definition industry_widget.h:53
WID_IC_NOTIFY
@ WID_IC_NOTIFY
Row of buttons at the bottom.
Definition industry_widget.h:51
WID_IC_IND_DROPDOWN
@ WID_IC_IND_DROPDOWN
Select industry dropdown.
Definition industry_widget.h:55
WID_IC_CAPTION
@ WID_IC_CAPTION
Caption of the window.
Definition industry_widget.h:50
WID_IC_PANEL
@ WID_IC_PANEL
Panel that shows the chain.
Definition industry_widget.h:52
WID_IC_CARGO_DROPDOWN
@ WID_IC_CARGO_DROPDOWN
Select cargo dropdown.
Definition industry_widget.h:54
WWT_DROPDOWN
@ WWT_DROPDOWN
Drop down list.
Definition widget_type.h:61

Widgets of the industry cargoes window.

Definition at line 1925 of file industry_gui.cpp.

## ◆ _nested_industry_directory_widgets

constexpr std::initializer_list<NWidgetPart> _nested_industry_directory_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_ID_CAPTION),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_ID_DROPDOWN_ORDER), SetStringTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_ID_DROPDOWN_CRITERIA), SetToolTip(STR_TOOLTIP_SORT_CRITERIA),
NWidget(WWT_EDITBOX, COLOUR_BROWN, WID_ID_FILTER), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_ID_FILTER_BY_ACC_CARGO), SetMinimalSize(225, 12), SetFill(0, 1), SetToolTip(STR_TOOLTIP_FILTER_CRITERIA),
NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_ID_FILTER_BY_PROD_CARGO), SetMinimalSize(225, 12), SetFill(0, 1), SetToolTip(STR_TOOLTIP_FILTER_CRITERIA),
NWidget(WWT_PANEL, COLOUR_BROWN), SetResize(1, 0), EndContainer(),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_ID_INDUSTRY_LIST), SetToolTip(STR_INDUSTRY_DIRECTORY_LIST_TOOLTIP), SetResize(1, 1), SetScrollbar(WID_ID_VSCROLLBAR),
EndContainer(),
EndContainer(),
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_ID_VSCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_HSCROLLBAR, COLOUR_BROWN, WID_ID_HSCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
EndContainer(),
}
SetToolTip
constexpr NWidgetPart SetToolTip(StringID tip)
Widget part function for setting tooltip and clearing the widget data.
Definition widget_type.h:1321
WID_ID_HSCROLLBAR
@ WID_ID_HSCROLLBAR
Horizontal scrollbar of the list.
Definition industry_widget.h:44
WID_ID_INDUSTRY_LIST
@ WID_ID_INDUSTRY_LIST
Industry list.
Definition industry_widget.h:43
WID_ID_DROPDOWN_ORDER
@ WID_ID_DROPDOWN_ORDER
Dropdown for the order of the sort.
Definition industry_widget.h:38
WID_ID_FILTER_BY_PROD_CARGO
@ WID_ID_FILTER_BY_PROD_CARGO
Produced cargo filter dropdown list.
Definition industry_widget.h:41
WID_ID_DROPDOWN_CRITERIA
@ WID_ID_DROPDOWN_CRITERIA
Dropdown for the criteria of the sort.
Definition industry_widget.h:39
WID_ID_CAPTION
@ WID_ID_CAPTION
Caption of the window.
Definition industry_widget.h:37
WID_ID_FILTER
@ WID_ID_FILTER
Textbox to filter industry name.
Definition industry_widget.h:42
WID_ID_FILTER_BY_ACC_CARGO
@ WID_ID_FILTER_BY_ACC_CARGO
Accepted cargo filter dropdown list.
Definition industry_widget.h:40
WID_ID_VSCROLLBAR
@ WID_ID_VSCROLLBAR
Vertical scrollbar of the list.
Definition industry_widget.h:45
WWT_EDITBOX
@ WWT_EDITBOX
a textbox for typing
Definition widget_type.h:62
NWID_HSCROLLBAR
@ NWID_HSCROLLBAR
Horizontal scrollbar.
Definition widget_type.h:75

Widget definition of the industry directory gui.

Definition at line 1236 of file industry_gui.cpp.

## ◆ _nested_industry_view_widgets

constexpr std::initializer_list<NWidgetPart> _nested_industry_view_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_CREAM),
NWidget(WWT_CAPTION, COLOUR_CREAM, WID_IV_CAPTION),
NWidget(WWT_PUSHIMGBTN, COLOUR_CREAM, WID_IV_GOTO), SetAspect(WidgetDimensions::ASPECT_LOCATION), SetSpriteTip(SPR_GOTO_LOCATION, STR_INDUSTRY_VIEW_LOCATION_TOOLTIP),
NWidget(WWT_DEBUGBOX, COLOUR_CREAM),
NWidget(WWT_SHADEBOX, COLOUR_CREAM),
NWidget(WWT_DEFSIZEBOX, COLOUR_CREAM),
NWidget(WWT_STICKYBOX, COLOUR_CREAM),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_CREAM),
NWidget(WWT_INSET, COLOUR_CREAM), SetPadding(2, 2, 2, 2),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_IV_VIEWPORT), SetMinimalSize(254, 86), SetFill(1, 0), SetResize(1, 1),
EndContainer(),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_CREAM, WID_IV_INFO), SetMinimalSize(260, 0), SetMinimalTextLines(2, WidgetDimensions::unscaled.framerect.Vertical()), SetResize(1, 0),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_CREAM, WID_IV_DISPLAY), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_INDUSTRY_DISPLAY_CHAIN, STR_INDUSTRY_DISPLAY_CHAIN_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_CREAM, WID_IV_GRAPH), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_INDUSTRY_VIEW_CARGO_GRAPH, STR_INDUSTRY_VIEW_CARGO_GRAPH_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_CREAM),
EndContainer(),
}
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition window_gui.h:93
SetSpriteTip
constexpr NWidgetPart SetSpriteTip(SpriteID sprite, StringID tip={})
Widget part function for setting the sprite and tooltip.
Definition widget_type.h:1254
SetPadding
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
Definition widget_type.h:1335
SetAspect
constexpr NWidgetPart SetAspect(float ratio, AspectFlags flags=AspectFlag::ResizeX)
Widget part function for setting the aspect ratio.
Definition widget_type.h:1413
SetMinimalTextLines
constexpr NWidgetPart SetMinimalTextLines(uint8_t lines, uint8_t spacing, FontSize size=FS_NORMAL)
Widget part function for setting the minimal text lines.
Definition widget_type.h:1190
WID_IV_INFO
@ WID_IV_INFO
Info of the industry.
Definition industry_widget.h:29
WID_IV_CAPTION
@ WID_IV_CAPTION
Caption of the window.
Definition industry_widget.h:27
WID_IV_GRAPH
@ WID_IV_GRAPH
Production history button.
Definition industry_widget.h:32
WID_IV_DISPLAY
@ WID_IV_DISPLAY
Display chain button.
Definition industry_widget.h:31
WID_IV_GOTO
@ WID_IV_GOTO
Goto button.
Definition industry_widget.h:30
WID_IV_VIEWPORT
@ WID_IV_VIEWPORT
Viewport of the industry.
Definition industry_widget.h:28
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition widget_type.h:105
WWT_INSET
@ WWT_INSET
Pressed (inset) panel, most commonly used as combo box text area.
Definition widget_type.h:40
WWT_PUSHIMGBTN
@ WWT_PUSHIMGBTN
Normal push-button (no toggle button) with image caption.
Definition widget_type.h:106
NWID_VIEWPORT
@ NWID_VIEWPORT
Nested widget containing a viewport.
Definition widget_type.h:73
WWT_DEBUGBOX
@ WWT_DEBUGBOX
NewGRF debug box (at top-right of a window, between WWT_CAPTION and WWT_SHADEBOX)
Definition widget_type.h:54

Widget definition of the view industry gui.

Definition at line 1198 of file industry_gui.cpp.

## ◆ _sorted_industry_types

std::array<IndustryType, NUM_INDUSTRYTYPES> _sorted_industry_types

Industry types sorted by name.

Definition at line 235 of file industry_gui.cpp.

Referenced by BuildIndustriesLegend(), IndustryCargoesWindow::ComputeCargoDisplay(), IndustryCargoesWindow::ComputeIndustryDisplay(), IndustryDirectoryWindow::IndustryTypeSorter(), IndustryCargoesWindow::OnClick(), ShowIndustryCargoesWindow(), and SortIndustryTypes().

## ◆ MAX_CARGOES

const uint MAX_CARGOES = 16
| static

Maximum number of cargoes carried in a CFT_CARGO field in CargoesField.

Definition at line 1967 of file industry_gui.cpp.

Referenced by CargoesField::CargoClickedAt(), CargoesField::CargoLabelClickedAt(), CargoesRow::ConnectIndustryAccepted(), CargoesRow::ConnectIndustryProduced(), CargoesField::Draw(), and CargoesRow::MakeCargoLabel().