#include "stdafx.h"
#include "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 "economy_func.h"
#include "vehicle_func.h"
#include "newgrf.h"
#include "company_manager_face.h"
#include "strings_func.h"
#include "date_func.h"
#include "widgets/dropdown_type.h"
#include "tilehighlight_func.h"
#include "sprite.h"
#include "company_base.h"
#include "core/geometry_func.hpp"
#include "table/strings.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 |
struct | SelectCompanyLiveryWindow |
Company livery colour scheme window. More... | |
class | SelectCompanyManagerFaceWindow |
Management class for customizing the face of the company manager. More... | |
struct | CompanyWindow |
Window with general information about a company. More... | |
struct | BuyCompanyWindow |
Enumerations | |
enum | { FIRST_GUI_CALL = INT_MAX, EXP_LINESPACE = 2, EXP_BLOCKSPACE = 10 } |
Company GUI constants. More... | |
enum | CompanyFinancesWindowWidgets { CFW_CAPTION, CFW_TOGGLE_SIZE, CFW_SEL_PANEL, CFW_EXPS_CATEGORY, CFW_EXPS_PRICE1, CFW_EXPS_PRICE2, CFW_EXPS_PRICE3, CFW_TOTAL_PANEL, CFW_SEL_MAXLOAN, CFW_BALANCE_VALUE, CFW_LOAN_VALUE, CFW_LOAN_LINE, CFW_TOTAL_VALUE, CFW_MAXLOAN_GAP, CFW_MAXLOAN_VALUE, CFW_SEL_BUTTONS, CFW_INCREASE_LOAN, CFW_REPAY_LOAN } |
Widgets of the company finances windows. More... | |
enum | SelectCompanyLiveryWindowWidgets { SCLW_WIDGET_CAPTION, SCLW_WIDGET_CLASS_GENERAL, SCLW_WIDGET_CLASS_RAIL, SCLW_WIDGET_CLASS_ROAD, SCLW_WIDGET_CLASS_SHIP, SCLW_WIDGET_CLASS_AIRCRAFT, SCLW_WIDGET_SPACER_DROPDOWN, SCLW_WIDGET_PRI_COL_DROPDOWN, SCLW_WIDGET_SEC_COL_DROPDOWN, SCLW_WIDGET_MATRIX } |
Widgets of the select company livery window. More... | |
enum | SelectCompanyManagerFaceWidgets { SCMFW_WIDGET_CAPTION, SCMFW_WIDGET_TOGGLE_LARGE_SMALL, SCMFW_WIDGET_SELECT_FACE, SCMFW_WIDGET_CANCEL, SCMFW_WIDGET_ACCEPT, SCMFW_WIDGET_MALE, SCMFW_WIDGET_FEMALE, SCMFW_WIDGET_MALE2, SCMFW_WIDGET_FEMALE2, SCMFW_WIDGET_SEL_LOADSAVE, SCMFW_WIDGET_SEL_MALEFEMALE, SCMFW_WIDGET_SEL_PARTS, SCMFW_WIDGET_RANDOM_NEW_FACE, SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON, SCMFM_WIDGET_FACE, SCMFW_WIDGET_LOAD, SCMFW_WIDGET_FACECODE, SCMFW_WIDGET_SAVE, SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT, SCMFW_WIDGET_TIE_EARRING_TEXT, SCMFW_WIDGET_LIPS_MOUSTACHE_TEXT, SCMFW_WIDGET_HAS_GLASSES_TEXT, SCMFW_WIDGET_HAIR_TEXT, SCMFW_WIDGET_EYEBROWS_TEXT, SCMFW_WIDGET_EYECOLOUR_TEXT, SCMFW_WIDGET_GLASSES_TEXT, SCMFW_WIDGET_NOSE_TEXT, SCMFW_WIDGET_CHIN_TEXT, SCMFW_WIDGET_JACKET_TEXT, SCMFW_WIDGET_COLLAR_TEXT, SCMFW_WIDGET_ETHNICITY_EUR, SCMFW_WIDGET_ETHNICITY_AFR, SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, SCMFW_WIDGET_HAS_GLASSES, SCMFW_WIDGET_EYECOLOUR_L, SCMFW_WIDGET_EYECOLOUR, SCMFW_WIDGET_EYECOLOUR_R, SCMFW_WIDGET_CHIN_L, SCMFW_WIDGET_CHIN, SCMFW_WIDGET_CHIN_R, SCMFW_WIDGET_EYEBROWS_L, SCMFW_WIDGET_EYEBROWS, SCMFW_WIDGET_EYEBROWS_R, SCMFW_WIDGET_LIPS_MOUSTACHE_L, SCMFW_WIDGET_LIPS_MOUSTACHE, SCMFW_WIDGET_LIPS_MOUSTACHE_R, SCMFW_WIDGET_NOSE_L, SCMFW_WIDGET_NOSE, SCMFW_WIDGET_NOSE_R, SCMFW_WIDGET_HAIR_L, SCMFW_WIDGET_HAIR, SCMFW_WIDGET_HAIR_R, SCMFW_WIDGET_JACKET_L, SCMFW_WIDGET_JACKET, SCMFW_WIDGET_JACKET_R, SCMFW_WIDGET_COLLAR_L, SCMFW_WIDGET_COLLAR, SCMFW_WIDGET_COLLAR_R, SCMFW_WIDGET_TIE_EARRING_L, SCMFW_WIDGET_TIE_EARRING, SCMFW_WIDGET_TIE_EARRING_R, SCMFW_WIDGET_GLASSES_L, SCMFW_WIDGET_GLASSES, SCMFW_WIDGET_GLASSES_R } |
Names of the widgets. More... | |
enum | CompanyWindowWidgets { CW_WIDGET_CAPTION, CW_WIDGET_FACE, CW_WIDGET_FACE_TITLE, CW_WIDGET_DESC_INAUGURATION, CW_WIDGET_DESC_COLOUR_SCHEME, CW_WIDGET_DESC_COLOUR_SCHEME_EXAMPLE, CW_WIDGET_DESC_VEHICLE, CW_WIDGET_DESC_VEHICLE_COUNTS, CW_WIDGET_DESC_COMPANY_VALUE, CW_WIDGET_DESC_OWNERS, CW_WIDGET_SELECT_BUTTONS, CW_WIDGET_NEW_FACE, CW_WIDGET_COLOUR_SCHEME, CW_WIDGET_PRESIDENT_NAME, CW_WIDGET_COMPANY_NAME, CW_WIDGET_BUY_SHARE, CW_WIDGET_SELL_SHARE, CW_WIDGET_SELECT_VIEW_BUILD_HQ, CW_WIDGET_VIEW_HQ, CW_WIDGET_BUILD_HQ, CW_WIDGET_SELECT_RELOCATE, CW_WIDGET_RELOCATE_HQ, CW_WIDGET_HAS_PASSWORD, CW_WIDGET_SELECT_MULTIPLAYER, CW_WIDGET_COMPANY_PASSWORD, CW_WIDGET_COMPANY_JOIN } |
Names of the widgets of the CompanyWindow. More... | |
enum | BuyCompanyWidgets { BCW_CAPTION, BCW_FACE, BCW_QUESTION, BCW_NO, BCW_YES } |
widget numbers of the BuyCompanyWindow. More... | |
Functions | |
static void | DoSelectCompanyManagerFace (Window *parent) |
Open the simple/advanced company manager face selection window. | |
static void | DrawCategories (const Rect &r) |
Draw the expenses categories. | |
static void | DrawPrice (Money amount, int left, int right, int top) |
Draw an amount of money. | |
static void | DrawYearColumn (const Rect &r, int year, const Money(*tbl)[EXPENSES_END]) |
Draw a column with prices. | |
void | ShowCompanyFinances (CompanyID company) |
Open the finances window of a company. | |
void | DrawCompanyManagerFace (CompanyManagerFace cmf, int colour, int x, int y) |
Draws the face of a company manager's face. | |
int | GetAmountOwnedBy (const Company *c, Owner owner) |
void | ShowCompany (CompanyID company) |
void | ShowBuyCompanyDialog (CompanyID company) |
Variables | |
static ExpensesType | _expenses_list_1 [] |
Standard unsorted list of expenses. | |
static ExpensesType | _expenses_list_2 [] |
Grouped list of expenses. | |
static const ExpensesList | _expenses_list_types [] |
static const NWidgetPart | _nested_company_finances_widgets [] |
static const WindowDesc | _company_finances_desc (WDP_AUTO, 0, 0, WC_FINANCES, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_company_finances_widgets, lengthof(_nested_company_finances_widgets)) |
static const StringID | _colour_dropdown [] |
static const LiveryClass | _livery_class [LS_END] |
static const NWidgetPart | _nested_select_company_livery_widgets [] |
static const WindowDesc | _select_company_livery_desc (WDP_AUTO, 0, 0, WC_COMPANY_COLOUR, WC_NONE, 0, _nested_select_company_livery_widgets, lengthof(_nested_select_company_livery_widgets)) |
static const NWidgetPart | _nested_select_company_manager_face_widgets [] |
Nested widget description for the company manager face selection dialog. | |
static const WindowDesc | _select_company_manager_face_desc (WDP_AUTO, 0, 0, WC_COMPANY_MANAGER_FACE, WC_NONE, WDF_UNCLICK_BUTTONS|WDF_CONSTRUCTION, _nested_select_company_manager_face_widgets, lengthof(_nested_select_company_manager_face_widgets)) |
Company manager face selection window description. | |
static const NWidgetPart | _nested_company_widgets [] |
static const StringID | _company_view_vehicle_count_strings [] |
Strings for the company vehicle counts. | |
static const WindowDesc | _company_desc (WDP_AUTO, 0, 0, WC_COMPANY, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_company_widgets, lengthof(_nested_company_widgets)) |
static const NWidgetPart | _nested_buy_company_widgets [] |
static const WindowDesc | _buy_company_desc (WDP_AUTO, 0, 0, WC_BUY_COMPANY, WC_NONE, WDF_CONSTRUCTION, _nested_buy_company_widgets, lengthof(_nested_buy_company_widgets)) |
Company related GUIs.
Definition in file company_gui.cpp.
anonymous enum |
Company GUI constants.
Definition at line 37 of file company_gui.cpp.
enum BuyCompanyWidgets |
widget numbers of the BuyCompanyWindow.
Definition at line 2047 of file company_gui.cpp.
Widgets of the company finances windows.
Definition at line 125 of file company_gui.cpp.
enum CompanyWindowWidgets |
Names of the widgets of the CompanyWindow.
Keep them in the same order as in the widget array
Definition at line 1566 of file company_gui.cpp.
Widgets of the select company livery window.
Definition at line 554 of file company_gui.cpp.
Names of the widgets.
Keep them in the same order as in the widget array. Do not change the order of the widgets from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R, this order is needed for the WE_CLICK event of DrawFaceStringLabel().
Definition at line 884 of file company_gui.cpp.
static void DoSelectCompanyManagerFace | ( | Window * | parent | ) | [static] |
Open the simple/advanced company manager face selection window.
parent | the parent company window | |
adv | simple or advanced face selection window | |
top | previous top position of the window | |
left | previous left position of the window |
Definition at line 1556 of file company_gui.cpp.
References _select_company_manager_face_desc, BringWindowToFrontById(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and Window::window_number.
Referenced by CompanyWindow::OnClick().
static void DrawCategories | ( | const Rect & | r | ) | [static] |
Draw the expenses categories.
r | Available space for drawing. |
Definition at line 150 of file company_gui.cpp.
References _settings_client, DrawString(), ExpensesList::et, EXP_BLOCKSPACE, EXP_LINESPACE, GUISettings::expenses_layout, FONT_HEIGHT_NORMAL, ClientSettings::gui, INVALID_EXPENSES, ExpensesList::length, SA_CENTER, and SA_RIGHT.
Referenced by CompanyFinancesWindow::DrawWidget().
void DrawCompanyManagerFace | ( | CompanyManagerFace | cmf, | |
int | colour, | |||
int | x, | |||
int | y | |||
) |
Draws the face of a company manager's face.
cmf | the company manager's face | |
colour | the (background) colour of the gradient | |
x | x-position to draw the face | |
y | y-position to draw the face |
Definition at line 842 of file company_gui.cpp.
References _cmf_info, DrawSprite(), GE_WM, GENDER_FEMALE, GetCompanyManagerFaceBits(), GetCompanyManagerFaceSprite(), and HasBit().
Referenced by NewsWindow::DrawWidget(), ErrmsgWindow::DrawWidget(), BuyCompanyWindow::DrawWidget(), CompanyWindow::DrawWidget(), and SelectCompanyManagerFaceWindow::DrawWidget().
static void DrawPrice | ( | Money | amount, | |
int | left, | |||
int | right, | |||
int | top | |||
) | [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. |
Definition at line 179 of file company_gui.cpp.
References DrawString(), SA_RIGHT, and SetDParam().
Referenced by DrawYearColumn().
Draw a column with prices.
r | Available space for drawing. | |
year | Year being drawn. | |
tbl | Pointer to table of amounts for year. |
Definition at line 196 of file company_gui.cpp.
References _settings_client, DrawPrice(), DrawString(), ExpensesList::et, EXP_BLOCKSPACE, EXP_LINESPACE, GUISettings::expenses_layout, FONT_HEIGHT_NORMAL, GfxFillRect(), ClientSettings::gui, INVALID_EXPENSES, ExpensesList::length, SA_RIGHT, and SetDParam().
Referenced by CompanyFinancesWindow::DrawWidget().
void ShowCompanyFinances | ( | CompanyID | company | ) |
Open the finances window of a company.
company | Company to show finances of. |
Definition at line 486 of file company_gui.cpp.
References BringWindowToFrontById(), and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID().
Referenced by StatusBarWindow::OnClick(), and MainToolbarWindow::OnKeyPress().
const StringID _colour_dropdown[] [static] |
{ STR_COLOUR_DARK_BLUE, STR_COLOUR_PALE_GREEN, STR_COLOUR_PINK, STR_COLOUR_YELLOW, STR_COLOUR_RED, STR_COLOUR_LIGHT_BLUE, STR_COLOUR_GREEN, STR_COLOUR_DARK_GREEN, STR_COLOUR_BLUE, STR_COLOUR_CREAM, STR_COLOUR_MAUVE, STR_COLOUR_PURPLE, STR_COLOUR_ORANGE, STR_COLOUR_BROWN, STR_COLOUR_GREY, STR_COLOUR_WHITE, }
Definition at line 495 of file company_gui.cpp.
const StringID _company_view_vehicle_count_strings[] [static] |
{ STR_COMPANY_VIEW_TRAINS, STR_COMPANY_VIEW_ROAD_VEHICLES, STR_COMPANY_VIEW_SHIPS, STR_COMPANY_VIEW_AIRCRAFT }
Strings for the company vehicle counts.
Definition at line 1690 of file company_gui.cpp.
ExpensesType _expenses_list_1[] [static] |
{ EXPENSES_CONSTRUCTION, EXPENSES_NEW_VEHICLES, EXPENSES_TRAIN_RUN, EXPENSES_ROADVEH_RUN, EXPENSES_AIRCRAFT_RUN, EXPENSES_SHIP_RUN, EXPENSES_PROPERTY, EXPENSES_TRAIN_INC, EXPENSES_ROADVEH_INC, EXPENSES_AIRCRAFT_INC, EXPENSES_SHIP_INC, EXPENSES_LOAN_INT, EXPENSES_OTHER, }
Standard unsorted list of expenses.
Definition at line 47 of file company_gui.cpp.
ExpensesType _expenses_list_2[] [static] |
{ EXPENSES_TRAIN_INC, EXPENSES_ROADVEH_INC, EXPENSES_AIRCRAFT_INC, EXPENSES_SHIP_INC, INVALID_EXPENSES, EXPENSES_TRAIN_RUN, EXPENSES_ROADVEH_RUN, EXPENSES_AIRCRAFT_RUN, EXPENSES_SHIP_RUN, EXPENSES_PROPERTY, EXPENSES_LOAN_INT, INVALID_EXPENSES, EXPENSES_CONSTRUCTION, EXPENSES_NEW_VEHICLES, EXPENSES_OTHER, INVALID_EXPENSES, }
Grouped list of expenses.
Definition at line 64 of file company_gui.cpp.
const ExpensesList _expenses_list_types[] [static] |
{ ExpensesList(_expenses_list_1, lengthof(_expenses_list_1), 0), ExpensesList(_expenses_list_2, lengthof(_expenses_list_2), 3), }
Definition at line 119 of file company_gui.cpp.
const LiveryClass _livery_class[LS_END] [static] |
{ LC_OTHER, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_ROAD, LC_ROAD, LC_SHIP, LC_SHIP, LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT, LC_ROAD, LC_ROAD, }
Definition at line 515 of file company_gui.cpp.
const NWidgetPart _nested_buy_company_widgets[] [static] |
{ NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, BCW_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE), NWidget(NWID_VERTICAL), SetPIP(8, 8, 8), NWidget(NWID_HORIZONTAL), SetPIP(8, 10, 8), NWidget(WWT_EMPTY, INVALID_COLOUR, BCW_FACE), SetFill(0, 1), NWidget(WWT_EMPTY, INVALID_COLOUR, BCW_QUESTION), SetMinimalSize(240, 0), SetFill(1, 1), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(100, 10, 100), NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_NO), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0), NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_YES), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0), EndContainer(), EndContainer(), EndContainer(), }
Definition at line 2123 of file company_gui.cpp.
const NWidgetPart _nested_select_company_livery_widgets[] [static] |
{ NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, SCLW_WIDGET_CAPTION), SetDataTip(STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_GENERAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TOOLTIP), NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_RAIL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TOOLTIP), NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_ROAD), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRUCKLIST, STR_LIVERY_ROAD_VEHICLE_TOOLTIP), NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_SHIP), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TOOLTIP), NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_AIRCRAFT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TOOLTIP), NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(90, 22), SetFill(1, 1), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_PANEL, COLOUR_GREY, SCLW_WIDGET_SPACER_DROPDOWN), SetMinimalSize(150, 12), SetFill(1, 1), EndContainer(), NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_PRI_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1), SetDataTip(STR_BLACK_STRING, STR_LIVERY_PRIMARY_TOOLTIP), NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_SEC_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1), SetDataTip(STR_BLACK_STRING, STR_LIVERY_SECONDARY_TOOLTIP), EndContainer(), NWidget(WWT_MATRIX, COLOUR_GREY, SCLW_WIDGET_MATRIX), SetMinimalSize(275, 15), SetFill(1, 0), SetDataTip((1 << MAT_ROW_START) | (1 << MAT_COL_START), STR_LIVERY_PANEL_TOOLTIP), }
Definition at line 806 of file company_gui.cpp.