OpenTTD Source 20241224-master-gf74b0cf984
company_gui.h File Reference

GUI Functions related to companies. More...

#include "company_type.h"
#include "group.h"
#include "gfx_type.h"

Go to the source code of this file.

Functions

TextColour GetDrawStringCompanyColour (CompanyID company)
 Get the colour for DrawString-subroutines which matches the colour of the company.
 
void DrawCompanyIcon (CompanyID c, int x, int y)
 Draw the icon of a company.
 
void ShowCompanyLiveryWindow (CompanyID company, GroupID group)
 
void ShowCompanyStations (CompanyID company)
 Opens window with list of company's stations.
 
void ShowCompanyFinances (CompanyID company)
 Open the finances window of a company.
 
void ShowCompany (CompanyID company)
 Show the window with the overview of the company.
 
void InvalidateCompanyWindows (const Company *c)
 Refresh all windows owned by a company.
 
void CloseCompanyWindows (CompanyID company)
 Close all windows of a company.
 
void DirtyCompanyInfrastructureWindows (CompanyID company)
 Redraw all windows with company infrastructure counts.
 

Detailed Description

GUI Functions related to companies.

Definition in file company_gui.h.

Function Documentation

◆ CloseCompanyWindows()

void CloseCompanyWindows ( CompanyID  id)

Close all windows of a company.

We identify windows of a company by looking at the caption colour. If it is equal to the company ID then we say the window belongs to the company and should be closed

Parameters
idcompany identifier

Definition at line 1168 of file window.cpp.

References CloseWindowById(), and WC_BUY_COMPANY.

Referenced by Company::~Company().

◆ DirtyCompanyInfrastructureWindows()

◆ DrawCompanyIcon()

void DrawCompanyIcon ( CompanyID  c,
int  x,
int  y 
)

Draw the icon of a company.

Parameters
cCompany that needs its icon drawn.
xHorizontal coordinate of the icon.
yVertical coordinate of the icon.

Definition at line 161 of file company_cmd.cpp.

◆ GetDrawStringCompanyColour()

TextColour GetDrawStringCompanyColour ( CompanyID  company)

Get the colour for DrawString-subroutines which matches the colour of the company.

Parameters
companyCompany to get the colour of.
Returns
Colour of company.

Definition at line 149 of file company_cmd.cpp.

References _company_colours, GetColourGradient(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and TC_IS_PALETTE_COLOUR.

Referenced by CmdGiveMoney(), NetworkServerSendChat(), and ClientNetworkGameSocketHandler::Receive_SERVER_CHAT().

◆ InvalidateCompanyWindows()

void InvalidateCompanyWindows ( const Company company)

◆ ShowCompany()

void ShowCompany ( CompanyID  company)

Show the window with the overview of the company.

Parameters
companyThe company to show the window for.

Definition at line 2595 of file company_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID().

Referenced by GoalListWindow::HandleClick(), MenuClickCompany(), and MainToolbarWindow::OnHotkey().

◆ ShowCompanyFinances()

void ShowCompanyFinances ( CompanyID  company)

Open the finances window of a company.

Parameters
companyCompany to show finances of.
Precondition
is company a valid company.

Definition at line 568 of file company_gui.cpp.

References BringWindowToFrontById(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and WC_FINANCES.

Referenced by MenuClickFinances(), StatusBarWindow::OnClick(), and MainToolbarWindow::OnHotkey().

◆ ShowCompanyLiveryWindow()

void ShowCompanyLiveryWindow ( CompanyID  company,
GroupID  group 
)

Definition at line 1110 of file company_gui.cpp.

◆ ShowCompanyStations()

void ShowCompanyStations ( CompanyID  company)

Opens window with list of company's stations.

Parameters
companywhose stations' list show

Definition at line 814 of file station_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID().

Referenced by MenuClickStations(), and MainToolbarWindow::OnHotkey().