Handling of companies. More...
#include "stdafx.h"
#include "engine_base.h"
#include "company_base.h"
#include "company_func.h"
#include "company_gui.h"
#include "town.h"
#include "news_func.h"
#include "cmd_helper.h"
#include "command_func.h"
#include "network/network.h"
#include "network/network_func.h"
#include "network/network_base.h"
#include "network/network_admin.h"
#include "ai/ai.hpp"
#include "company_manager_face.h"
#include "window_func.h"
#include "strings_func.h"
#include "date_func.h"
#include "sound_func.h"
#include "rail.h"
#include "core/pool_func.hpp"
#include "settings_func.h"
#include "vehicle_base.h"
#include "vehicle_func.h"
#include "sprite.h"
#include "smallmap_gui.h"
#include "table/strings.h"
Go to the source code of this file.
Functions | |
void | SetLocalCompany (CompanyID new_company) |
Sets the local company and updates the settings that are set on a per-company basis to reflect the core's state in the GUI. | |
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. | |
static bool | IsValidCompanyManagerFace (CompanyManagerFace cmf) |
Checks whether a company manager's face is a valid encoding. | |
void | InvalidateCompanyWindows (const Company *company) |
Refresh all windows owned by a company. | |
bool | CheckCompanyHasMoney (CommandCost &cost) |
Verify whether the company can pay the bill. | |
static void | SubtractMoneyFromAnyCompany (Company *c, CommandCost cost) |
Deduct costs of a command from the money of a company. | |
void | SubtractMoneyFromCompany (CommandCost cost) |
Subtract money from the _current_company, if the company is valid. | |
void | SubtractMoneyFromCompanyFract (CompanyID company, CommandCost cst) |
Subtract money from a company, including the money fraction. | |
void | UpdateLandscapingLimits () |
Update the landscaping limits per company. | |
void | GetNameOfOwner (Owner owner, TileIndex tile) |
Set the right DParams to get the name of an owner. | |
CommandCost | CheckOwnership (Owner owner, TileIndex tile) |
Check whether the current owner owns something. | |
CommandCost | CheckTileOwnership (TileIndex tile) |
Check whether the current owner owns the stuff on the given tile. | |
static void | GenerateCompanyName (Company *c) |
Generate the name of a company from the last build coordinate. | |
static Colours | GenerateCompanyColour () |
Generate a company colour. | |
static void | GeneratePresidentName (Company *c) |
Generate a random president name of a company. | |
void | ResetCompanyLivery (Company *c) |
Reset the livery schemes to the company's primary colour. | |
Company * | DoStartupNewCompany (bool is_ai, CompanyID company=INVALID_COMPANY) |
Create a new company and sets all company variables default values. | |
void | StartupCompanies () |
Start the next competitor now. | |
static void | MaybeStartNewCompany () |
Start a new competitor company if possible. | |
void | InitializeCompanies () |
Initialize the pool of companies. | |
bool | MayCompanyTakeOver (CompanyID cbig, CompanyID csmall) |
May company cbig buy company csmall? | |
static void | HandleBankruptcyTakeover (Company *c) |
Handle the bankruptcy take over of a company. | |
void | OnTick_Companies () |
void | CompaniesYearlyLoop () |
A year has passed, update the economic data of all companies, and perhaps show the financial overview window of the local company. | |
void | CompanyAdminUpdate (const Company *company) |
Called whenever company related information changes in order to notify admins. | |
void | CompanyAdminBankrupt (CompanyID company_id) |
Called whenever a company goes bankrupt in order to notify admins. | |
CommandCost | CmdCompanyCtrl (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Control the companies: add, delete, etc. | |
CommandCost | CmdSetCompanyManagerFace (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Change the company manager's face. | |
CommandCost | CmdSetCompanyColour (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Change the company's company-colour. | |
static bool | IsUniqueCompanyName (const char *name) |
Is the given name in use as name of a company? | |
CommandCost | CmdRenameCompany (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Change the name of the company. | |
static bool | IsUniquePresidentName (const char *name) |
Is the given name in use as president name of a company? | |
CommandCost | CmdRenamePresident (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Change the name of the president. | |
Variables | |
CompanyByte | _local_company |
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR. | |
CompanyByte | _current_company |
Company currently doing an action. | |
Colours | _company_colours [MAX_COMPANIES] |
NOSAVE: can be determined from company structs. | |
CompanyManagerFace | _company_manager_face |
for company manager face storage in openttd.cfg | |
uint | _next_competitor_start |
the number of ticks before the next AI is started | |
uint | _cur_company_tick_index |
used to generate a name for one company that doesn't have a name yet per tick | |
CompanyPool | _company_pool ("Company") |
Pool of companies. | |
static const byte | _colour_sort [COLOUR_END] = {2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 3, 1, 1, 1} |
static const Colours | _similar_colour [COLOUR_END][2] |
Handling of companies.
Definition in file company_cmd.cpp.
bool CheckCompanyHasMoney | ( | CommandCost & | cost | ) |
Verify whether the company can pay the bill.
cost | [inout] Money to pay, is changed to an error if the company does not have enough money. |
true
if the company has enough money, else it returns false
. Definition at line 188 of file company_cmd.cpp.
References CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), CommandCost::MakeError(), CompanyProperties::money, and SetDParam().
Referenced by CmdCloneVehicle(), DoCommand(), and DoCommandPInternal().
CommandCost CheckOwnership | ( | Owner | owner, | |
TileIndex | tile | |||
) |
Check whether the current owner owns something.
If that isn't the case an appropriate error will be given.
owner | the owner of the thing to check. | |
tile | optional tile to get the right town. |
Definition at line 303 of file company_cmd.cpp.
References GetNameOfOwner(), OWNER_END, OWNER_TOWN, and return_cmd_error.
Referenced by CanRemoveRoadWithStop(), CheckAllowRemoveRoad(), CheckAllowRemoveTunnelBridge(), CheckFlatLandRoadStop(), CmdAutofillTimetable(), CmdAutoreplaceVehicle(), CmdBuildRoad(), CmdChangeServiceInt(), CmdChangeTimetable(), CmdCloneOrder(), CmdCloneVehicle(), CmdDeleteOrder(), CmdForceTrainProceed(), CmdInsertOrder(), CmdModifyOrder(), CmdMoveOrder(), CmdMoveRailVehicle(), CmdOrderRefit(), CmdRefitVehicle(), CmdRenameStation(), CmdRenameVehicle(), CmdRenameWaypoint(), CmdReverseTrainDirection(), CmdSellVehicle(), CmdSetTimetableStart(), CmdSetVehicleOnTime(), CmdSkipToOrder(), CmdStartStopVehicle(), CmdTurnRoadVeh(), IsValidTileForWaypoint(), RemoveAirport(), RemoveDock(), RemoveFromRailBaseStation(), RemoveRailStation(), RemoveRoadStop(), and Vehicle::SendToDepot().
CommandCost CheckTileOwnership | ( | TileIndex | tile | ) |
Check whether the current owner owns the stuff on the given tile.
If that isn't the case an appropriate error will be given.
tile | the tile to check. |
Definition at line 321 of file company_cmd.cpp.
References GetNameOfOwner(), GetTileOwner(), IsLocalCompany(), OWNER_END, and return_cmd_error.
Referenced by CheckAllowRemoveTunnelBridge(), CmdBuildSingleRail(), CmdBuildSingleSignal(), CmdConvertRail(), CmdRemoveSingleRail(), CmdRemoveSingleSignal(), CmdRenameDepot(), and RemoveLock().
CommandCost CmdCompanyCtrl | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Control the companies: add, delete, etc.
tile | unused | |
flags | operation to perform | |
p1 | various functionality
| |
p2 | ClientID | |
text | unused |
Definition at line 795 of file company_cmd.cpp.
References _network_server, _networking, _settings_client, AI::BroadcastNewEvent(), NetworkClientInfo::client_id, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, CMD_ERROR, CMD_RENAME_PRESIDENT, CompanyNewsInformation::company_name, COMPANY_SPECTATOR, CompanyAdminBankrupt(), DC_EXEC, NetworkSettings::default_company_pass, DeleteCompanyWindows(), DeleteWindowById(), DESTTYPE_BROADCAST, DoStartupNewCompany(), GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_COMPANY, INVALID_OWNER, InvalidateWindowClassesData(), InvalidateWindowData(), CompanyProperties::is_ai, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), MarkWholeScreenDirty(), MAX_COMPANIES, NetworkCompanyState::months_empty, ClientSettings::network, NetworkAdminCompanyInfo(), NetworkChangeCompanyPassword(), NetworkFindClientInfoFromClientID(), NetworkSendCommand(), NS_COMPANY_BANKRUPT, NetworkCompanyState::password, SetDParam(), SetDParamStr(), SetLocalCompany(), AI::Stop(), StrEmpty(), and SyncCompanySettings().
CommandCost CmdRenameCompany | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Change the name of the company.
tile | unused | |
flags | operation to perform | |
p1 | unused | |
p2 | unused | |
text | the new name or an empty string when resetting to the default |
Definition at line 1067 of file company_cmd.cpp.
References CMD_ERROR, CompanyAdminUpdate(), DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), IsUniqueCompanyName(), MarkWholeScreenDirty(), MAX_LENGTH_COMPANY_NAME_CHARS, CompanyProperties::name, return_cmd_error, StrEmpty(), and Utf8StringLength().
CommandCost CmdRenamePresident | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Change the name of the president.
tile | unused | |
flags | operation to perform | |
p1 | unused | |
p2 | unused | |
text | the new name or an empty string when resetting to the default |
Definition at line 1112 of file company_cmd.cpp.
References CMD_ERROR, CMD_RENAME_COMPANY, CompanyAdminUpdate(), DC_EXEC, DoCommand(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), IsUniquePresidentName(), lengthof, MarkWholeScreenDirty(), MAX_LENGTH_PRESIDENT_NAME_CHARS, CompanyProperties::name, CompanyProperties::name_1, CompanyProperties::president_name, return_cmd_error, StrEmpty(), and Utf8StringLength().
CommandCost CmdSetCompanyColour | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Change the company's company-colour.
tile | unused | |
flags | operation to perform | |
p1 | bitstuffed: p1 bits 0-7 scheme to set p1 bits 8-9 set in use state or first/second colour | |
p2 | new colour for vehicles, property, etc. | |
text | unused |
Definition at line 955 of file company_cmd.cpp.
References _company_colours, CMD_ERROR, CompanyProperties::colour, Livery::colour1, Livery::colour2, CompanyAdminUpdate(), DC_EXEC, GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Livery::in_use, Vehicle::InvalidateNewGRFCache(), InvalidateWindowData(), MarkWholeScreenDirty(), Vehicle::owner, and UpdateObjectColours().
CommandCost CmdSetCompanyManagerFace | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Change the company manager's face.
tile | unused | |
flags | operation to perform | |
p1 | unused | |
p2 | face bitmasked | |
text | unused |
Definition at line 931 of file company_cmd.cpp.
References CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), IsValidCompanyManagerFace(), and MarkWholeScreenDirty().
void CompanyAdminBankrupt | ( | CompanyID | company_id | ) |
Called whenever a company goes bankrupt in order to notify admins.
company_id | The company that went bankrupt. |
Definition at line 774 of file company_cmd.cpp.
References _network_server, ADMIN_CRR_BANKRUPT, and NetworkAdminCompanyRemove().
Referenced by CmdCompanyCtrl(), and CompanyCheckBankrupt().
void CompanyAdminUpdate | ( | const Company * | company | ) |
Called whenever company related information changes in order to notify admins.
company | The company data changed of. |
Definition at line 763 of file company_cmd.cpp.
References _network_server, and NetworkAdminCompanyUpdate().
Referenced by CmdBuyShareInCompany(), CmdRenameCompany(), CmdRenamePresident(), CmdSellShareInCompany(), and CmdSetCompanyColour().
Create a new company and sets all company variables default values.
is_ai | is an AI company? | |
company | CompanyID to use for the new company |
Definition at line 520 of file company_cmd.cpp.
References _company_colours, _cur_year, _network_server, _networking, CompanyProperties::avail_railtypes, Company::avail_roadtypes, BuildOwnerLegend(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::CanAllocateItem(), CompanyProperties::colour, CompanyProperties::current_loan, CompanyProperties::face, GenerateCompanyColour(), GeneratePresidentName(), GetCompanyRailtypes(), GetCompanyRoadtypes(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_engine_pool >::GetPoolSize(), CompanyProperties::inaugurated_year, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_COMPANY, INVALID_OWNER, InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), CompanyProperties::money, Company::num_engines, RandomCompanyManagerFaceBits(), ResetCompanyLivery(), SetDefaultCompanySettings(), SetWindowDirty(), CompanyProperties::share_owners, and AI::StartNew().
Referenced by CmdCompanyCtrl().
void DrawCompanyIcon | ( | CompanyID | c, | |
int | x, | |||
int | y | |||
) |
Draw the icon of a company.
c | Company that needs its icon drawn. | |
x | Horizontal coordinate of the icon. | |
y | Vertical coordinate of the icon. |
Definition at line 135 of file company_cmd.cpp.
References DrawSprite().
Referenced by TownAuthorityWindow::DrawRatings(), SignListWindow::DrawWidget(), NetworkClientListWindow::DrawWidget(), PerformanceRatingDetailWindow::DrawWidget(), CompanyLeagueWindow::DrawWidget(), GraphLegendWindow::DrawWidget(), CheatWindow::DrawWidget(), and AIDebugWindow::OnPaint().
static Colours GenerateCompanyColour | ( | ) | [static] |
Generate a company colour.
Definition at line 420 of file company_cmd.cpp.
References CompanyProperties::colour, GB(), and Swap().
Referenced by DoStartupNewCompany().
static void GenerateCompanyName | ( | Company * | c | ) | [static] |
Generate the name of a company from the last build coordinate.
c | Company to give a name. |
Definition at line 338 of file company_cmd.cpp.
References AddNewsItem(), AI::BroadcastNewEvent(), ClosestTownFromTile(), CompanyNewsInformation::company_name, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, CompanyProperties::is_ai, IsInsideMM(), CompanyProperties::last_build_coordinate, lastof, MarkWholeScreenDirty(), MAX_CHAR_LENGTH, MAX_LENGTH_COMPANY_NAME_CHARS, CompanyProperties::name_1, CompanyProperties::name_2, NR_NONE, NR_TILE, NS_COMPANY_NEW, CompanyProperties::president_name_1, CompanyProperties::president_name_2, SetDParam(), SetDParamStr(), and Utf8StringLength().
static void GeneratePresidentName | ( | Company * | c | ) | [static] |
Generate a random president name of a company.
c | Company that needs a new president name. |
Definition at line 476 of file company_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, lastof, MAX_CHAR_LENGTH, MAX_LENGTH_PRESIDENT_NAME_CHARS, CompanyProperties::president_name_1, CompanyProperties::president_name_2, SetDParam(), and Utf8StringLength().
Referenced by DoStartupNewCompany().
TextColour GetDrawStringCompanyColour | ( | CompanyID | company | ) |
Get the colour for DrawString-subroutines which matches the colour of the company.
company | Company to get the colour of. |
Definition at line 123 of file company_cmd.cpp.
References _colour_gradient, _company_colours, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and TC_IS_PALETTE_COLOUR.
Set the right DParams to get the name of an owner.
owner | the owner to get the name of. | |
tile | optional tile to get the right town. |
Definition at line 274 of file company_cmd.cpp.
References ClosestTownFromTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), OWNER_TOWN, and SetDParam().
Referenced by CheckOwnership(), and CheckTileOwnership().
static void HandleBankruptcyTakeover | ( | Company * | c | ) | [static] |
Handle the bankruptcy take over of a company.
Companies going bankrupt will ask the other companies in order of their performance rating, so better performing companies get the 'do you want to merge with Y' question earlier. The question will then stay till either the company has gone bankrupt or got merged with a company.
c | the company that is going bankrupt. |
Definition at line 631 of file company_cmd.cpp.
References CompanyProperties::bankrupt_asked, CompanyProperties::bankrupt_timeout, ClampToI32(), DAY_TICKS, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, CompanyProperties::is_ai, IsInteractiveCompany(), MAX_COMPANIES, MAX_UVALUE, MayCompanyTakeOver(), AI::NewEvent(), CompanyProperties::old_economy, CompanyEconomyEntry::performance_history, and SetBit().
void InitializeCompanies | ( | ) |
Initialize the pool of companies.
Definition at line 597 of file company_cmd.cpp.
References _company_pool, _cur_company_tick_index, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::CleanPool().
void InvalidateCompanyWindows | ( | const Company * | company | ) |
Refresh all windows owned by a company.
company | Company that changed, and needs its windows refreshed. |
Definition at line 175 of file company_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, and SetWindowDirty().
Referenced by CmdDecreaseLoan(), CmdIncreaseLoan(), and SubtractMoneyFromAnyCompany().
static bool IsUniqueCompanyName | ( | const char * | name | ) | [static] |
Is the given name in use as name of a company?
name | Name to search. |
true
if the name us unique (that is, not in use), else false
. Definition at line 1047 of file company_cmd.cpp.
References CompanyProperties::name.
Referenced by CmdRenameCompany().
static bool IsUniquePresidentName | ( | const char * | name | ) | [static] |
Is the given name in use as president name of a company?
name | Name to search. |
true
if the name us unique (that is, not in use), else false
. Definition at line 1092 of file company_cmd.cpp.
References CompanyProperties::president_name.
Referenced by CmdRenamePresident().
static bool IsValidCompanyManagerFace | ( | CompanyManagerFace | cmf | ) | [static] |
Checks whether a company manager's face is a valid encoding.
Unused bits are not enforced to be 0.
cmf | the fact to check |
Definition at line 146 of file company_cmd.cpp.
References AreCompanyManagerFaceBitsValid(), GE_WM, GENDER_FEMALE, GetCompanyManagerFaceBits(), and HasBit().
Referenced by CmdSetCompanyManagerFace().
static void MaybeStartNewCompany | ( | ) | [static] |
Start a new competitor company if possible.
Definition at line 574 of file company_cmd.cpp.
References _networking, _settings_client, _settings_game, CMD_COMPANY_CTRL, GameSettings::difficulty, DoCommandP(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::GetNumItems(), INVALID_COMPANY, CompanyProperties::is_ai, NetworkSettings::max_companies, DifficultySettings::max_no_competitors, and ClientSettings::network.
May company cbig buy company csmall?
true
if it is allowed. Definition at line 609 of file company_cmd.cpp.
References _settings_game, CountCompanyVehicles(), VehicleSettings::max_aircraft, VehicleSettings::max_roadveh, VehicleSettings::max_ships, VehicleSettings::max_trains, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, and GameSettings::vehicle.
Referenced by CmdBuyCompany(), CmdBuyShareInCompany(), and HandleBankruptcyTakeover().
void ResetCompanyLivery | ( | Company * | c | ) |
Reset the livery schemes to the company's primary colour.
This is used on loading games without livery information and on new company start up.
c | Company to reset. |
Definition at line 504 of file company_cmd.cpp.
References CompanyProperties::colour, Livery::colour1, Livery::colour2, and Livery::in_use.
Referenced by DoStartupNewCompany().
void SetLocalCompany | ( | CompanyID | new_company | ) |
Sets the local company and updates the settings that are set on a per-company basis to reflect the core's state in the GUI.
new_company | the new company |
Definition at line 97 of file company_cmd.cpp.
References COMPANY_SPECTATOR, DeleteConstructionWindows(), DESTTYPE_TEAM, InvalidateWindowData(), IsLocalCompany(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), MarkWholeScreenDirty(), and OWNER_NONE.
Referenced by ClickChangeCompanyCheat(), CmdCompanyCtrl(), GenerateWorld(), NetworkServerDoMove(), and StartScenario().
void StartupCompanies | ( | ) |
Start the next competitor now.
Definition at line 567 of file company_cmd.cpp.
References _next_competitor_start.
Referenced by _GenerateWorld(), and StartScenario().
static void SubtractMoneyFromAnyCompany | ( | Company * | c, | |
CommandCost | cost | |||
) | [static] |
Deduct costs of a command from the money of a company.
c | Company to pay the bill. | |
cost | Money to pay. |
Definition at line 206 of file company_cmd.cpp.
References CompanyProperties::cur_economy, EXPENSES_AIRCRAFT_INC, EXPENSES_AIRCRAFT_RUN, EXPENSES_LOAN_INT, EXPENSES_PROPERTY, EXPENSES_ROADVEH_INC, EXPENSES_ROADVEH_RUN, EXPENSES_SHIP_INC, EXPENSES_SHIP_RUN, EXPENSES_TRAIN_INC, EXPENSES_TRAIN_RUN, CommandCost::GetCost(), CommandCost::GetExpensesType(), HasBit(), INVALID_EXPENSES, InvalidateCompanyWindows(), CompanyProperties::money, and CompanyProperties::yearly_expenses.
Referenced by SubtractMoneyFromCompany(), and SubtractMoneyFromCompanyFract().
void SubtractMoneyFromCompany | ( | CommandCost | cost | ) |
Subtract money from the _current_company, if the company is valid.
cost | Money to pay. |
Definition at line 235 of file company_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), and SubtractMoneyFromAnyCompany().
Referenced by CmdGiveMoney(), CompaniesGenStatistics(), CompaniesPayInterest(), DoCommand(), and DoCommandPInternal().
void SubtractMoneyFromCompanyFract | ( | CompanyID | company, | |
CommandCost | cst | |||
) |
Subtract money from a company, including the money fraction.
company | Company paying the bill. | |
cst | Cost of a command. |
Definition at line 246 of file company_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), CommandCost::GetCost(), CommandCost::GetExpensesType(), CompanyProperties::money_fraction, and SubtractMoneyFromAnyCompany().
Referenced by Train::OnNewDay(), Ship::OnNewDay(), RoadVehicle::OnNewDay(), and Aircraft::OnNewDay().
void UpdateLandscapingLimits | ( | ) |
Update the landscaping limits per company.
Definition at line 259 of file company_cmd.cpp.
References _settings_game, ConstructionSettings::clear_frame_burst, CompanyProperties::clear_limit, ConstructionSettings::clear_per_64k_frames, GameSettings::construction, min(), ConstructionSettings::terraform_frame_burst, CompanyProperties::terraform_limit, and ConstructionSettings::terraform_per_64k_frames.
Referenced by StateGameLoop().
const Colours _similar_colour[COLOUR_END][2] [static] |
{ { COLOUR_BLUE, COLOUR_LIGHT_BLUE }, { COLOUR_GREEN, COLOUR_DARK_GREEN }, { INVALID_COLOUR, INVALID_COLOUR }, { COLOUR_ORANGE, INVALID_COLOUR }, { INVALID_COLOUR, INVALID_COLOUR }, { COLOUR_DARK_BLUE, COLOUR_BLUE }, { COLOUR_PALE_GREEN, COLOUR_DARK_GREEN }, { COLOUR_PALE_GREEN, COLOUR_GREEN }, { COLOUR_DARK_BLUE, COLOUR_LIGHT_BLUE }, { COLOUR_BROWN, COLOUR_ORANGE }, { COLOUR_PURPLE, INVALID_COLOUR }, { COLOUR_MAUVE, INVALID_COLOUR }, { COLOUR_YELLOW, COLOUR_CREAM }, { COLOUR_CREAM, INVALID_COLOUR }, { COLOUR_WHITE, INVALID_COLOUR }, { COLOUR_GREY, INVALID_COLOUR }, }
Definition at line 397 of file company_cmd.cpp.