|
OpenTTD Source 20251104-master-g3befbdd52f
|
Company related GUIs. More...
#include "stdafx.h"#include "currency.h"#include "error.h"#include "gui.h"#include "settings_gui.h"#include "window_gui.h"#include "textbuf_gui.h"#include "viewport_func.h"#include "company_func.h"#include "command_func.h"#include "network/network.h"#include "network/network_gui.h"#include "network/network_func.h"#include "newgrf.h"#include "company_manager_face.h"#include "strings_func.h"#include "timer/timer_game_economy.h"#include "dropdown_type.h"#include "tilehighlight_func.h"#include "company_base.h"#include "core/geometry_func.hpp"#include "object_type.h"#include "rail.h"#include "road.h"#include "engine_base.h"#include "window_func.h"#include "road_func.h"#include "water.h"#include "station_func.h"#include "zoom_func.h"#include "sortlist_type.h"#include "company_cmd.h"#include "economy_cmd.h"#include "group_cmd.h"#include "group_gui.h"#include "misc_cmd.h"#include "object_cmd.h"#include "timer/timer.h"#include "timer/timer_window.h"#include "core/string_consumer.hpp"#include "widgets/company_widget.h"#include "table/strings.h"#include "dropdown_common_type.h"#include "safeguards.h"Go to the source code of this file.
Data Structures | |
| struct | ExpensesList |
| Expense list container. More... | |
| struct | CompanyFinancesWindow |
| Window class displaying the company finances. More... | |
| class | DropDownListColourItem< TSprite > |
| Colour selection list item, with icon and string components. More... | |
| struct | SelectCompanyLiveryWindow |
| Company livery colour scheme window. More... | |
| class | SelectCompanyManagerFaceWindow |
| Management class for customizing the face of the company manager. More... | |
| struct | CompanyInfrastructureWindow |
| Window with detailed information about the company's infrastructure. More... | |
| struct | CompanyInfrastructureWindow::InfrastructureItem |
| struct | CompanyWindow |
| Window with general information about a company. More... | |
| struct | BuyCompanyWindow |
Functions | |
| static void | DoSelectCompanyManagerFace (Window *parent) |
| Company GUI constants. | |
| static void | ShowCompanyInfrastructure (CompanyID company) |
| Open the infrastructure window of a company. | |
| static uint | GetTotalCategoriesHeight () |
| Get the total height of the "categories" column. | |
| static uint | GetMaxCategoriesWidth () |
| Get the required width of the "categories" column, equal to the widest element. | |
| static void | DrawCategory (const Rect &r, int start_y, const ExpensesList &list) |
| Draw a category of expenses (revenue, operating expenses, capital expenses). | |
| static void | DrawCategories (const Rect &r) |
| Draw the expenses categories. | |
| static void | DrawPrice (Money amount, int left, int right, int top, TextColour colour) |
| Draw an amount of money. | |
| static Money | DrawYearCategory (const Rect &r, int start_y, const ExpensesList &list, const Expenses &tbl) |
| Draw a category of expenses/revenues in the year column. | |
| static void | DrawYearColumn (const Rect &r, TimerGameEconomy::Year year, const Expenses &tbl) |
| Draw a column with prices. | |
| void | ShowCompanyFinances (CompanyID company) |
| Open the finances window of a company. | |
| void | ShowCompanyLiveryWindow (CompanyID company, GroupID group) |
| void | DrawCompanyManagerFace (const CompanyManagerFace &cmf, Colours colour, const Rect &r) |
| Draws the face of a company manager's face. | |
| void | ShowCompany (CompanyID company) |
| Show the window with the overview of the company. | |
| void | DirtyCompanyInfrastructureWindows (CompanyID company) |
| Redraw all windows with company infrastructure counts. | |
| void | ShowBuyCompanyDialog (CompanyID company, bool hostile_takeover) |
| Show the query to buy another company. | |
Variables | |
| static const std::initializer_list< ExpensesType > | _expenses_list_revenue |
| List of revenues. | |
| static const std::initializer_list< ExpensesType > | _expenses_list_operating_costs |
| List of operating expenses. | |
| static const std::initializer_list< ExpensesType > | _expenses_list_capital_costs |
| List of capital expenses. | |
| static const std::initializer_list< ExpensesList > | _expenses_list_types |
| Types of expense lists. | |
| static constexpr std::initializer_list< NWidgetPart > | _nested_company_finances_widgets |
| static WindowDesc | _company_finances_desc (WDP_AUTO, "company_finances", 0, 0, WC_FINANCES, WC_NONE, {}, _nested_company_finances_widgets) |
| static const LiveryClass | _livery_class [LS_END] |
| static constexpr std::initializer_list< NWidgetPart > | _nested_select_company_livery_widgets |
| static WindowDesc | _select_company_livery_desc (WDP_AUTO, "company_color_scheme", 0, 0, WC_COMPANY_COLOUR, WC_NONE, {}, _nested_select_company_livery_widgets) |
| static constexpr std::initializer_list< NWidgetPart > | _nested_select_company_manager_face_widgets |
| Nested widget description for the company manager face selection dialog. | |
| static WindowDesc | _select_company_manager_face_desc (WDP_AUTO, {}, 0, 0, WC_COMPANY_MANAGER_FACE, WC_NONE, WindowDefaultFlag::Construction, _nested_select_company_manager_face_widgets) |
| Company manager face selection window description. | |
| static constexpr std::initializer_list< NWidgetPart > | _nested_company_infrastructure_widgets |
| static WindowDesc | _company_infrastructure_desc (WDP_AUTO, "company_infrastructure", 0, 0, WC_COMPANY_INFRASTRUCTURE, WC_NONE, {}, _nested_company_infrastructure_widgets) |
| static constexpr std::initializer_list< NWidgetPart > | _nested_company_widgets |
| static const StringID | _company_view_vehicle_count_strings [] |
| Strings for the company vehicle counts. | |
| static WindowDesc | _company_desc (WDP_AUTO, "company", 0, 0, WC_COMPANY, WC_NONE, {}, _nested_company_widgets) |
| static constexpr std::initializer_list< NWidgetPart > | _nested_buy_company_widgets |
| static WindowDesc | _buy_company_desc (WDP_AUTO, {}, 0, 0, WC_BUY_COMPANY, WC_NONE, WindowDefaultFlag::Construction, _nested_buy_company_widgets) |
Company related GUIs.
Definition in file company_gui.cpp.
| void DirtyCompanyInfrastructureWindows | ( | CompanyID | company | ) |
Redraw all windows with company infrastructure counts.
| company | The company to redraw the windows of. |
Definition at line 2318 of file company_gui.cpp.
References SetWindowDirty(), WC_COMPANY, and WC_COMPANY_INFRASTRUCTURE.
Referenced by Station::AfterStationTileSetChange(), BuildObject(), CmdBuildBridge(), CmdBuildCanal(), CmdBuildRailWaypoint(), CmdBuildRoad(), CmdBuildRoadWaypoint(), CmdBuildShipDepot(), CmdBuildSingleRail(), CmdBuildSingleSignal(), CmdBuildTrainDepot(), CmdBuildTunnel(), CmdConvertRail(), CmdLandscapeClear(), CmdRemoveSingleRail(), CmdRemoveSingleSignal(), ConvertRoadTypeOwner(), DoBuildLock(), DoClearBridge(), DoClearTunnel(), RemoveFromRailBaseStation(), RemoveLock(), RemoveRoad(), RemoveRoadStop(), RemoveRoadWaypointStop(), and UpdateCompanyRoadInfrastructure().
|
static |
Company GUI constants.
Open the simple/advanced company manager face selection window.
| parent | the parent company window |
Definition at line 1531 of file company_gui.cpp.
References _select_company_manager_face_desc, BringWindowToFrontById(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID(), WC_COMPANY_MANAGER_FACE, and Window::window_number.
Referenced by CompanyWindow::OnClick().
|
static |
Draw the expenses categories.
| r | Available space for drawing. |
Definition at line 181 of file company_gui.cpp.
References _expenses_list_types, DrawCategory(), DrawString(), FS_NORMAL, GetCharacterHeight(), SA_LEFT, SA_RIGHT, WidgetDimensions::scaled, TimerGameEconomy::UsingWallclockUnits(), WidgetDimensions::vsep_normal, and WidgetDimensions::vsep_wide.
Referenced by CompanyFinancesWindow::DrawWidget().
|
static |
Draw a category of expenses (revenue, operating expenses, capital expenses).
Definition at line 164 of file company_gui.cpp.
References _current_text_dir, DrawString(), FS_NORMAL, GetCharacterHeight(), Rect::Indent(), ExpensesList::items, WidgetDimensions::scaled, and TD_RTL.
Referenced by DrawCategories().
| void DrawCompanyManagerFace | ( | const CompanyManagerFace & | cmf, |
| Colours | colour, | ||
| const Rect & | r | ||
| ) |
Draws the face of a company manager's face.
| cmf | the company manager's face |
| colour | the (background) colour of the gradient |
| r | position to draw the face |
Definition at line 1120 of file company_gui.cpp.
References CentreBounds(), DrawSprite(), GetActiveFaceVars(), GetColourPalette(), GetCompanyManagerFaceVars(), GetSpriteSize(), and CompanyManagerFace::style.
Referenced by SelectCompanyManagerFaceWindow::DrawWidget(), CompanyWindow::DrawWidget(), BuyCompanyWindow::DrawWidget(), ErrmsgWindow::DrawWidget(), and NewsWindow::DrawWidget().
|
static |
Draw an amount of money.
| amount | Amount of money to draw, |
| left | Left coordinate of the space to draw in. |
| right | Right coordinate of the space to draw in. |
| top | Top coordinate of the space to draw in. |
| colour | The TextColour of the string. |
Definition at line 221 of file company_gui.cpp.
References DrawString(), GetString(), SA_FORCE, and SA_RIGHT.
Referenced by DrawYearCategory(), and DrawYearColumn().
|
static |
Draw a category of expenses/revenues in the year column.
Definition at line 237 of file company_gui.cpp.
References WidgetDimensions::bevel, DrawPrice(), FS_NORMAL, GetCharacterHeight(), GfxFillRect(), ExpensesList::items, PC_BLACK, WidgetDimensions::scaled, and WidgetDimensions::vsep_normal.
Referenced by DrawYearColumn().
|
static |
Draw a column with prices.
| r | Available space for drawing. |
| year | Year being drawn. |
| tbl | Reference to table of amounts for year. |
Definition at line 266 of file company_gui.cpp.
References _expenses_list_types, WidgetDimensions::bevel, DrawPrice(), DrawString(), DrawYearCategory(), FS_NORMAL, GetCharacterHeight(), GetString(), GfxFillRect(), PC_BLACK, SA_FORCE, SA_RIGHT, WidgetDimensions::scaled, WidgetDimensions::vsep_normal, and WidgetDimensions::vsep_wide.
Referenced by CompanyFinancesWindow::DrawWidget().
|
static |
Get the required width of the "categories" column, equal to the widest element.
Definition at line 146 of file company_gui.cpp.
References _expenses_list_types, GetStringBoundingBox(), WidgetDimensions::hsep_indent, WidgetDimensions::scaled, and TimerGameEconomy::UsingWallclockUnits().
Referenced by CompanyFinancesWindow::UpdateWidgetSize().
|
static |
Get the total height of the "categories" column.
Definition at line 126 of file company_gui.cpp.
References _expenses_list_types, FS_NORMAL, GetCharacterHeight(), WidgetDimensions::scaled, WidgetDimensions::vsep_normal, and WidgetDimensions::vsep_wide.
Referenced by CompanyFinancesWindow::OnPaint(), and CompanyFinancesWindow::UpdateWidgetSize().
| void ShowBuyCompanyDialog | ( | CompanyID | company, |
| bool | hostile_takeover | ||
| ) |
Show the query to buy another company.
| company | The company to buy. |
| hostile_takeover | Whether this is a hostile takeover. |
Definition at line 2439 of file company_gui.cpp.
References BringWindowToFrontById(), and WC_BUY_COMPANY.
Referenced by HandleBankruptcyTakeover(), and CompanyWindow::OnClick().
| void ShowCompany | ( | CompanyID | company | ) |
Show the window with the overview of the company.
| company | The company to show the window for. |
Definition at line 2307 of file company_gui.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID().
Referenced by GoalListWindow::HandleClick(), MenuClickCompany(), and MainToolbarWindow::OnHotkey().
| void ShowCompanyFinances | ( | CompanyID | company | ) |
Open the finances window of a company.
| company | Company to show finances of. |
Definition at line 569 of file company_gui.cpp.
References BringWindowToFrontById(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID(), and WC_FINANCES.
Referenced by MenuClickFinances(), StatusBarWindow::OnClick(), and MainToolbarWindow::OnHotkey().
|
static |
Open the infrastructure window of a company.
| company | Company to show infrastructure of. |
Definition at line 1837 of file company_gui.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID().
Referenced by CompanyFinancesWindow::OnClick(), and CompanyWindow::OnClick().
Definition at line 1104 of file company_gui.cpp.
|
static |
Strings for the company vehicle counts.
Definition at line 1920 of file company_gui.cpp.
Referenced by CompanyWindow::UpdateWidgetSize().
|
static |
|
static |
List of operating expenses.
Definition at line 73 of file company_gui.cpp.
|
static |
List of revenues.
Definition at line 65 of file company_gui.cpp.
|
static |
Types of expense lists.
Definition at line 116 of file company_gui.cpp.
Referenced by DrawCategories(), DrawYearColumn(), GetMaxCategoriesWidth(), and GetTotalCategoriesHeight().
|
static |
Definition at line 578 of file company_gui.cpp.
|
staticconstexpr |
Definition at line 2408 of file company_gui.cpp.
|
staticconstexpr |
Definition at line 289 of file company_gui.cpp.
|
staticconstexpr |
Definition at line 1539 of file company_gui.cpp.
|
staticconstexpr |
Definition at line 1843 of file company_gui.cpp.
|
staticconstexpr |
Definition at line 1065 of file company_gui.cpp.
|
staticconstexpr |
Nested widget description for the company manager face selection dialog.
Definition at line 1164 of file company_gui.cpp.