|
OpenTTD
|
GUIs related to industries. More...
#include "stdafx.h"#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_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 "widgets/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 "widgets/dropdown_type.h"#include "widgets/industry_widget.h"#include "table/strings.h"#include <bitset>#include "safeguards.h"Go to the source code of this file.
Data Structures | |
| 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 * > | GUIIndustryList |
Enumerations | |
| enum | CargoSuffixType { CST_FUND, CST_VIEW, CST_DIR } |
| Cargo suffix type (for which window is it requested) More... | |
| enum | CargoesFieldType { CFT_EMPTY, CFT_SMALL_EMPTY, CFT_INDUSTRY, CFT_CARGO, CFT_CARGO_LABEL, CFT_HEADER } |
| Available types of field. More... | |
Functions | |
| 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, char *suffix, const char *suffix_last) |
| Gets the string to display after the cargo name (using callback 37) | |
| template<typename TC , typename TS > | |
| static void | GetAllCargoSuffixes (uint cb_offset, 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) | |
| static int CDECL | IndustryTypeNameSorter (const IndustryType *a, const IndustryType *b) |
| Sort industry types by their name. | |
| void | SortIndustryTypes () |
| Initialize the list of sorted industry types. | |
| void | CcBuildIndustry (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) |
| Command callback. | |
| void | ShowBuildIndustryWindow () |
| static void | UpdateIndustryProduction (Industry *i) |
| static bool | IsProductionAlterable (const Industry *i) |
| void | ShowIndustryViewWindow (int industry) |
| void | ShowIndustryDirectory () |
| assert_compile (MAX_CARGOES >=cpp_lengthof(IndustrySpec, produced_cargo)) | |
| assert_compile (MAX_CARGOES >=cpp_lengthof(IndustrySpec, accepts_cargo)) | |
| void | ShowIndustryCargoesWindow () |
| Open the industry and cargoes window with an industry. | |
Variables | |
| bool | _ignore_restrictions |
| std::bitset< NUM_INDUSTRYTYPES > | _displayed_industries |
| Communication from the industry chain window to the smallmap window about what industries to display. | |
| IndustryType | _sorted_industry_types [NUM_INDUSTRYTYPES] |
| Industry types sorted by name. | |
| static const NWidgetPart | _nested_build_industry_widgets [] |
| static WindowDesc | _build_industry_desc (WDP_AUTO,"build_industry", 170, 212, WC_BUILD_INDUSTRY, WC_NONE, WDF_CONSTRUCTION, _nested_build_industry_widgets, lengthof(_nested_build_industry_widgets)) |
| Window definition of the dynamic place industries gui. | |
| static const 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, 0, _nested_industry_view_widgets, lengthof(_nested_industry_view_widgets)) |
| Window definition of the view industry gui. | |
| static const NWidgetPart | _nested_industry_directory_widgets [] |
| Widget definition of the industry directory gui. | |
| static WindowDesc | _industry_directory_desc (WDP_AUTO,"list_industries", 428, 190, WC_INDUSTRY_DIRECTORY, WC_NONE, 0, _nested_industry_directory_widgets, lengthof(_nested_industry_directory_widgets)) |
| Window definition of the industry directory gui. | |
| static const 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, 0, _nested_industry_cargoes_widgets, lengthof(_nested_industry_cargoes_widgets)) |
| Window description for the industry cargoes window. | |
| static const uint | MAX_CARGOES = 3 |
| Maximum number of cargoes carried in a CFT_CARGO field in CargoesField. | |
GUIs related to industries.
Definition in file industry_gui.cpp.
| enum CargoesFieldType |
Available types of field.
Definition at line 1458 of file industry_gui.cpp.
| enum CargoSuffixType |
Cargo suffix type (for which window is it requested)
| CST_FUND |
Fund-industry window. |
| CST_VIEW |
View-industry window. |
| CST_DIR |
Industry-directory window. |
Definition at line 53 of file industry_gui.cpp.
| void CcBuildIndustry | ( | const CommandCost & | result, |
| TileIndex | tile, | ||
| uint32 | p1, | ||
| uint32 | p2 | ||
| ) |
Command callback.
In case of failure to build an industry, show an error message.
| result | Result of the command. |
| tile | Tile where the industry is placed. |
| p1 | Additional data of the CMD_BUILD_INDUSTRY command. |
| p2 | Additional data of the CMD_BUILD_INDUSTRY command. |
Definition at line 155 of file industry_gui.cpp.
References IndustrySpec::enabled, GB(), CommandCost::GetErrorMessage(), GetIndustrySpec(), IndustrySpec::name, NUM_INDUSTRYTYPES, SetDParam(), ShowErrorMessage(), CommandCost::Succeeded(), TILE_SIZE, TileX(), TileY(), and WL_INFO.
Referenced by BuildIndustryWindow::OnPlaceObject().
|
inlinestatic |
Gets all strings to display after the cargoes of industries (using callback 37)
| cb_offset | The offset for the cargo used in cb37, 0 for accepted cargoes, 3 for produced cargoes |
| cst | the cargo suffix type (for which window is it requested). |
| ind | the industry (NULL if in fund window) |
| ind_type | the industry type |
| indspec | the industry spec |
| cargoes | array with cargotypes. for CT_INVALID no suffix will be determined |
| suffixes | is filled with the suffixes |
Definition at line 103 of file industry_gui.cpp.
References CT_INVALID, GetCargoSuffix(), lastof, and lengthof.
Referenced by IndustryViewWindow::DrawInfo(), BuildIndustryWindow::DrawWidget(), IndustryDirectoryWindow::GetIndustryString(), and BuildIndustryWindow::UpdateWidgetSize().
|
static |
Gets the string to display after the cargo name (using callback 37)
| cargo | the cargo for which the suffix is requested
|
| cst | the cargo suffix type (for which window is it requested). |
| ind | the industry (NULL if in fund window) |
| ind_type | the industry type |
| indspec | the industry spec |
| suffix | is filled with the string to display |
| suffix_last | lastof(suffix) |
Definition at line 76 of file industry_gui.cpp.
References CALLBACK_FAILED, IndustrySpec::callback_mask, CBID_INDUSTRY_CARGO_SUFFIX, CBM_IND_CARGO_SUFFIX, CST_FUND, ErrorUnknownCallbackResult(), GB(), GetGRFStringID(), GetIndustryCallback(), IndustrySpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, HasBit(), INVALID_TILE, Industry::location, StartTextRefStackUsage(), StopTextRefStackUsage(), and OrthogonalTileArea::tile.
Referenced by GetAllCargoSuffixes().
|
static |
Sort industry types by their name.
Definition at line 118 of file industry_gui.cpp.
References GetIndustrySpec(), lastof, IndustrySpec::name, and strnatcmp().
Referenced by SortIndustryTypes().
|
static |
Open the industry and cargoes window.
| id | Industry type to display, NUM_INDUSTRYTYPES selects a default industry type. |
Definition at line 2692 of file industry_gui.cpp.
References _sorted_industry_types, BringWindowToFrontById(), IndustrySpec::enabled, GetIndustrySpec(), Window::InvalidateData(), NUM_INDUSTRYTYPES, and WC_INDUSTRY_CARGOES.
| void ShowIndustryCargoesWindow | ( | ) |
Open the industry and cargoes window with an industry.
Definition at line 2714 of file industry_gui.cpp.
References NUM_INDUSTRYTYPES, and ShowIndustryCargoesWindow().
Referenced by MenuClickIndustry(), BuildIndustryWindow::OnClick(), IndustryViewWindow::OnClick(), and ShowIndustryCargoesWindow().
|
static |
Window description for the industry cargoes window.
|
static |
Definition at line 169 of file industry_gui.cpp.
|
static |
Widgets of the industry cargoes window.
Definition at line 1421 of file industry_gui.cpp.
|
static |
Widget definition of the industry directory gui.
Definition at line 1049 of file industry_gui.cpp.
|
static |
Widget definition of the view industry gui.
Definition at line 1012 of file industry_gui.cpp.
1.8.1.2