#include "stdafx.h"
#include "openttd.h"
#include "engine_base.h"
#include "company_func.h"
#include "company_gui.h"
#include "town.h"
#include "news_func.h"
#include "command_func.h"
#include "network/network.h"
#include "network/network_func.h"
#include "network/network_base.h"
#include "ai/ai.hpp"
#include "company_manager_face.h"
#include "group.h"
#include "window_func.h"
#include "tile_map.h"
#include "strings_func.h"
#include "gfx_func.h"
#include "date_func.h"
#include "sound_func.h"
#include "autoreplace_func.h"
#include "autoreplace_gui.h"
#include "string_func.h"
#include "road_func.h"
#include "rail.h"
#include "sprite.h"
#include "oldpool_func.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. | |
| bool | IsHumanCompany (CompanyID company) |
| uint16 | GetDrawStringCompanyColour (CompanyID company) |
| void | DrawCompanyIcon (CompanyID c, int x, int y) |
| bool | IsValidCompanyManagerFace (CompanyManagerFace cmf) |
| Checks whether a company manager's face is a valid encoding. | |
| void | InvalidateCompanyWindows (const Company *company) |
| bool | CheckCompanyHasMoney (CommandCost cost) |
| static void | SubtractMoneyFromAnyCompany (Company *c, CommandCost cost) |
| void | SubtractMoneyFromCompany (CommandCost cost) |
| void | SubtractMoneyFromCompanyFract (CompanyID company, CommandCost cst) |
| void | GetNameOfOwner (Owner owner, TileIndex tile) |
| bool | CheckOwnership (Owner owner) |
| bool | CheckTileOwnership (TileIndex tile) |
| static void | GenerateCompanyName (Company *c) |
| static Colours | GenerateCompanyColour () |
| static void | GeneratePresidentName (Company *c) |
| void | ResetCompanyLivery (Company *c) |
| Reset the livery schemes to the company's primary colour. | |
| Company * | DoStartupNewCompany (bool is_ai) |
| Create a new company and sets all company variables default values. | |
| void | StartupCompanies () |
| static void | MaybeStartNewCompany () |
| void | InitializeCompanies () |
| void | OnTick_Companies () |
| void | CompaniesYearlyLoop () |
| CommandCost | CmdSetAutoReplace (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
| Change engine renewal parameters. | |
| CommandCost | CmdCompanyCtrl (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
| Control the companies: add, delete, etc. | |
Variables | |
| CompanyByte | _local_company |
| CompanyByte | _current_company |
| 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 | |
| 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] |
Definition in file company_cmd.cpp.
| 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 | various functionality, dictated by p1
|
Definition at line 714 of file company_cmd.cpp.
References _network_playas, _settings_client, AddNewsItem(), GUISettings::autorenew, GUISettings::autorenew_money, GUISettings::autorenew_months, CMD_ERROR, CMD_RENAME_PRESIDENT, CMD_SET_AUTOREPLACE, CompanyNewsInformation::company_name, COMPANY_SPECTATOR, DC_EXEC, DeleteCompanyWindows(), DeleteWindowById(), DoStartupNewCompany(), CompanyNewsInformation::FillData(), GB(), ClientSettings::gui, INVALID_OWNER, InvalidateWindowData(), MarkWholeScreenDirty(), ClientSettings::network, NS_COMPANY_BANKRUPT, OWNER_NONE, SetDParamStr(), SetLocalCompany(), and StrEmpty().
| CommandCost CmdSetAutoReplace | ( | TileIndex | tile, | |
| DoCommandFlag | flags, | |||
| uint32 | p1, | |||
| uint32 | p2, | |||
| const char * | text | |||
| ) |
Change engine renewal parameters.
| tile | unused | |
| flags | operation to perform | |
| p1 | bits 0-3 command
| |
| p2 | value to set if p1 = 0, then:
|
Definition at line 571 of file company_cmd.cpp.
References _settings_client, AddEngineReplacementForCompany(), GUISettings::autorenew, GUISettings::autorenew_money, GUISettings::autorenew_months, CheckAutoreplaceValidity(), Clamp(), ClampU(), CMD_ERROR, DC_EXEC, GB(), ClientSettings::gui, HasBit(), InvalidateAutoreplaceWindow(), InvalidateWindow(), IsAllGroupID(), and RemoveEngineReplacementForCompany().
| Company* DoStartupNewCompany | ( | bool | is_ai | ) |
Create a new company and sets all company variables default values.
| is_ai | is a ai company? |
Definition at line 425 of file company_cmd.cpp.
References _company_colours, _cur_year, _settings_client, GUISettings::autorenew, GUISettings::autorenew_money, GUISettings::autorenew_months, GetCompanyRailtypes(), GetCompanyRoadtypes(), ClientSettings::gui, INVALID_OWNER, InvalidateWindow(), MAX_COMPANIES, RandomCompanyManagerFaceBits(), and ResetCompanyLivery().
Referenced by CmdCompanyCtrl().
| bool IsValidCompanyManagerFace | ( | CompanyManagerFace | cmf | ) |
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 119 of file company_cmd.cpp.
References AreCompanyManagerFaceBitsValid(), GE_WM, GENDER_FEMALE, GetCompanyManagerFaceBits(), and HasBit().
Referenced by CmdSetCompanyManagerFace().
| 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 410 of file company_cmd.cpp.
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 71 of file company_cmd.cpp.
References _settings_client, GUISettings::autorenew, GUISettings::autorenew_money, GUISettings::autorenew_months, COMPANY_SPECTATOR, DeleteConstructionWindows(), ClientSettings::gui, InvalidateWindow(), MarkWholeScreenDirty(), and OWNER_NONE.
Referenced by ClickChangeCompanyCheat(), CmdCompanyCtrl(), GenerateWorld(), and StartScenario().
const Colours _similar_colour[COLOUR_END][2] [static] |
Initial value:
{
{ 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 314 of file company_cmd.cpp.
1.5.6