38 #include "table/strings.h" 61 this->name_1 = name_1;
142 DrawSprite(SPR_COMPANY_ICON, COMPANY_SPRITE_COLOUR(c), x, y);
161 for (CompanyManagerFaceVariable cmfv = CMFV_CHEEKS; cmfv < CMFV_END; cmfv++) {
163 case CMFV_MOUSTACHE:
if (!has_moustache)
continue;
break;
165 case CMFV_NOSE:
if (has_moustache)
continue;
break;
166 case CMFV_TIE_EARRING:
if (!has_tie_earring)
continue;
break;
167 case CMFV_GLASSES:
if (!has_glasses)
continue;
break;
199 cost.
MakeError(STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY);
213 if (cost.
GetCost() == 0)
return;
349 if (c->
name_1 != STR_SV_UNNAMED)
return;
356 if (t->
name ==
nullptr &&
IsInsideMM(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST + 1)) {
357 str = t->townnametype - SPECSTR_TOWNNAME_START + SPECSTR_COMPANY_NAME_START;
358 strp = t->townnameparts;
363 if (cc->name_1 == str && cc->name_2 == strp)
goto bad_town_name;
366 GetString(buffer, str,
lastof(buffer));
378 SetDParam(0, STR_NEWS_COMPANY_LAUNCH_TITLE);
379 SetDParam(1, STR_NEWS_COMPANY_LAUNCH_DESCRIPTION);
389 str = SPECSTR_ANDCO_NAME;
393 str = SPECSTR_ANDCO_NAME;
400 static const byte
_colour_sort[COLOUR_END] = {2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 3, 1, 1, 1};
403 { COLOUR_BLUE, COLOUR_LIGHT_BLUE },
404 { COLOUR_GREEN, COLOUR_DARK_GREEN },
405 { INVALID_COLOUR, INVALID_COLOUR },
406 { COLOUR_ORANGE, INVALID_COLOUR },
407 { INVALID_COLOUR, INVALID_COLOUR },
408 { COLOUR_DARK_BLUE, COLOUR_BLUE },
409 { COLOUR_PALE_GREEN, COLOUR_DARK_GREEN },
410 { COLOUR_PALE_GREEN, COLOUR_GREEN },
411 { COLOUR_DARK_BLUE, COLOUR_LIGHT_BLUE },
412 { COLOUR_BROWN, COLOUR_ORANGE },
413 { COLOUR_PURPLE, INVALID_COLOUR },
414 { COLOUR_MAUVE, INVALID_COLOUR },
415 { COLOUR_YELLOW, COLOUR_CREAM },
416 { COLOUR_CREAM, INVALID_COLOUR },
417 { COLOUR_WHITE, INVALID_COLOUR },
418 { COLOUR_GREY, INVALID_COLOUR },
427 Colours colours[COLOUR_END];
430 for (uint i = 0; i < COLOUR_END; i++) colours[i] = (Colours)i;
433 for (uint i = 0; i < 100; i++) {
435 Swap(colours[
GB(r, 0, 4)], colours[
GB(r, 4, 4)]);
439 for (uint i = 0; i < COLOUR_END; i++) {
440 for (uint j = 1; j < COLOUR_END; j++) {
442 Swap(colours[j - 1], colours[j]);
449 Colours pcolour = (Colours)c->colour;
451 for (uint i = 0; i < COLOUR_END; i++) {
452 if (colours[i] == pcolour) {
453 colours[i] = INVALID_COLOUR;
458 for (uint j = 0; j < 2; j++) {
460 if (similar == INVALID_COLOUR)
break;
462 for (uint i = 1; i < COLOUR_END; i++) {
463 if (colours[i - 1] == similar)
Swap(colours[i - 1], colours[i]);
469 for (uint i = 0; i < COLOUR_END; i++) {
470 if (colours[i] != INVALID_COLOUR)
return colours[i];
491 GetString(buffer, STR_PRESIDENT_NAME,
lastof(buffer));
499 GetString(buffer2, STR_PRESIDENT_NAME,
lastof(buffer2));
500 if (strcmp(buffer2, buffer) == 0)
goto restart;
514 for (
LiveryScheme scheme = LS_BEGIN; scheme < LS_END; scheme++) {
515 c->livery[scheme].
in_use = 0;
521 if (g->owner == c->
index) {
522 g->livery.in_use = 0;
523 g->livery.colour1 = c->
colour;
524 g->livery.colour2 = c->
colour;
545 c =
new Company(STR_SV_UNNAMED, is_ai);
548 c =
new (company)
Company(STR_SV_UNNAMED, is_ai);
668 int32 best_performance = -1;
672 if (c2->bankrupt_asked == 0 &&
682 if (best_performance == -1) {
700 if (_game_mode == GM_EDITOR)
return;
735 memmove(&c->yearly_expenses[1], &c->yearly_expenses[0],
sizeof(c->yearly_expenses) -
sizeof(c->yearly_expenses[0]));
736 memset(&c->yearly_expenses[0], 0,
sizeof(c->yearly_expenses[0]));
759 GetString(this->company_name, STR_COMPANY_NAME,
lastof(this->company_name));
761 if (other ==
nullptr) {
762 *this->other_company_name =
'\0';
765 GetString(this->other_company_name, STR_COMPANY_NAME,
lastof(this->other_company_name));
823 #ifndef DEBUG_DUMP_COMMANDS 888 SetDParam(0, STR_NEWS_COMPANY_BANKRUPT_TITLE);
889 SetDParam(1, STR_NEWS_COMPANY_BANKRUPT_DESCRIPTION);
891 AddCompanyNewsItem(STR_MESSAGE_NEWS_FORMAT, cni);
952 Colours
colour = Extract<Colours, 0, 8>(p2);
954 bool second =
HasBit(p1, 8);
956 if (scheme >= LS_END || (colour >= COLOUR_END && colour != INVALID_COLOUR))
return CMD_ERROR;
959 if (scheme == LS_DEFAULT && colour == INVALID_COLOUR)
return CMD_ERROR;
964 if (scheme == LS_DEFAULT && !second) {
972 if (scheme != LS_DEFAULT)
SB(c->livery[scheme].
in_use, 0, 1, colour != INVALID_COLOUR);
973 if (colour == INVALID_COLOUR) colour = (Colours)c->livery[LS_DEFAULT].
colour1;
974 c->livery[scheme].
colour1 = colour;
978 if (scheme == LS_DEFAULT) {
979 for (
int i = 1; i < LS_END; i++) {
987 if (scheme != LS_DEFAULT)
SB(c->livery[scheme].
in_use, 1, 1, colour != INVALID_COLOUR);
988 if (colour == INVALID_COLOUR) colour = (Colours)c->livery[LS_DEFAULT].
colour2;
989 c->livery[scheme].
colour2 = colour;
991 if (scheme == LS_DEFAULT) {
992 for (
int i = 1; i < LS_END; i++) {
998 if (c->livery[scheme].
in_use != 0) {
1000 c->livery[LS_DEFAULT].
in_use = 1;
1004 c->livery[LS_DEFAULT].
in_use = 0;
1005 for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
1006 if (c->livery[scheme].
in_use != 0) {
1007 c->livery[LS_DEFAULT].
in_use = 1;
1013 ResetVehicleColourMap();
1046 if (c->name !=
nullptr && strcmp(c->name, name) == 0)
return false;
1089 if (c->president_name !=
nullptr && strcmp(c->president_name, name) == 0)
return false;
1122 if (c->
name_1 == STR_SV_UNNAMED && c->
name ==
nullptr) {
1147 default: NOT_REACHED();
1163 if (RoadTypeIsRoad(rt)) total += this->road[rt];
1176 if (RoadTypeIsTram(rt)) total += this->road[rt];
static void PostDestructor(size_t index)
Invalidating some stuff after removing item from the pool.
void InvalidateCompanyWindows(const Company *company)
Refresh all windows owned by a company.
Functions related to OTTD's strings.
void UpdateLandscapingLimits()
Update the landscaping limits per company.
Owner
Enum for all companies/owners.
VehicleSettings vehicle
options for vehicles
uint32 tree_per_64k_frames
how many trees may, over a long period, be planted per 65536 frames?
static void Swap(T &a, T &b)
Type safe swap operation.
void NetworkAdminCompanyUpdate(const Company *company)
Notify the admin network of company updates.
static bool IsLocalCompany()
Is the current company the local company?
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
static void NewEvent(class ScriptEvent *event)
Queue a new event for a Game Script.
used in multiplayer to create a new companies etc.
Definition of stuff that is very close to a company, like the company struct itself.
static void StartNew(CompanyID company, bool rerandomise_ai=true)
Start a new AI company.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
bool _networking
are we in networking mode?
Default settings for vehicles.
Container for all information known about a client.
char * name
Name of the company if the user changed it.
LiveryScheme
List of different livery schemes.
AdminCompanyRemoveReason
Reasons for removing a company - communicated to admins.
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
TextColour GetDrawStringCompanyColour(CompanyID company)
Get the colour for DrawString-subroutines which matches the colour of the company.
void InitializeCompanies()
Initialize the pool of companies.
void BuildOwnerLegend()
Completes the array for the owned property legend.
Client list; Window numbers:
static Titem * Get(size_t index)
Returns Titem with given index.
int32 performance_history
Company score (scale 0-1000)
Functions related to dates.
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
byte money_fraction
Fraction of money of the company, too small to represent in money.
CompanyManagerFace _company_manager_face
for company manager face storage in openttd.cfg
CommandCost CmdSetCompanyManagerFace(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the company manager's face.
void ClearEnginesHiddenFlagOfCompany(CompanyID cid)
Clear the 'hidden' flag for all engines of a new company.
Year inaugurated_year
Year of starting the company.
static bool IsUniqueCompanyName(const char *name)
Is the given name in use as name of a company?
void DeleteConstructionWindows()
Delete all windows that are used for construction of vehicle etc.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
This bit set means a female, otherwise male.
ExpensesType GetExpensesType() const
The expense type of the cost.
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
ClientID client_id
Client identifier (same as ClientState->client_id)
uint64 inflation_prices
Cumulated inflation of prices since game start; 16 bit fractional part.
A town owns the tile, or a town is expanding.
bool CheckCompanyHasMoney(CommandCost &cost)
Verify whether the company can pay the bill.
RoadTypes GetCompanyRoadTypes(CompanyID company, bool introduces)
Get the road types the given company can build.
Popup for the client list; Window numbers:
VehicleType
Available vehicle types.
Sign list; Window numbers:
void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
Change the ownership of all the items of a company.
CompanyMask bankrupt_asked
which companies were asked about buying it?
uint _cur_company_tick_index
used to generate a name for one company that doesn't have a name yet per tick
Functions related to vehicles.
void DrawCompanyIcon(CompanyID c, int x, int y)
Draw the icon of a company.
CompanyPool _company_pool("Company")
Pool of companies.
UnitID max_aircraft
max planes in game per company
uint32 GetTramTotal() const
Get total sum of all owned tram bits.
void NetworkUpdateClientInfo(ClientID client_id)
Send updated client info of a particular client.
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
DifficultySettings difficulty
settings related to the difficulty
static void BroadcastNewEvent(ScriptEvent *event, CompanyID skip_company=MAX_COMPANIES)
Broadcast a new event to all active AIs.
Tindex index
Index of this pool item.
char * president_name
Name of the president if the user changed it.
static const int DAY_TICKS
1 day is 74 ticks; _date_fract used to be uint16 and incremented by 885.
Company value graph; Window numbers:
bool new_year
Play sound on new year, summarising the performance during the last year.
Helper functions to extract data from command parameters.
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS
The maximum length of a president name in characters including '\0'.
#define lastof(x)
Get the last element of an fixed size array.
static int GetStartNextTime()
Get the number of days before the next AI should start.
uint16 tree_frame_burst
how many trees may, over a short period, be planted?
Money GetCost() const
The costs as made up to this moment.
Base core network types and some helper functions to access them.
uint32 name_2
Parameter of name_1.
static bool IsValidCompanyManagerFace(CompanyManagerFace cmf)
Checks whether a company manager's face is a valid encoding.
A male of Caucasian origin (white)
Common return value for all commands.
ClientID
'Unique' identifier to be given to clients
RoadType
The different roadtypes we support.
static T max(const T a, const T b)
Returns the maximum of two values.
Year _cur_year
Current year, starting at 0.
CompanySettings settings
settings specific for each company
void DeleteCompanyWindows(CompanyID company)
Delete all windows of a company.
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
void MakeError(StringID message)
Makes this CommandCost behave like an error command.
uint16 servint_ships
service interval for ships
Income graph; Window numbers:
Money expenses
The amount of expenses.
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold...
void SetDParamStr(uint n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
uint32 clear_per_64k_frames
how many tiles may, over a long period, be cleared per 65536 frames?
CommandCost CmdRenameCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the name of the company.
Some methods of Pool are placed here in order to reduce compilation time and binary size...
NetworkSettings network
settings related to the network
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
uint32 CompanyManagerFace
Company manager face bits, info see in company_manager_face.h.
The tile has no ownership.
void SetDefaultCompanySettings(CompanyID cid)
Set the company settings for a new company to their default values.
CompanyID client_playas
As which company is this client playing (CompanyID)
void SubtractMoneyFromCompanyFract(CompanyID company, CommandCost cst)
Subtract money from a company, including the money fraction.
byte num_valid_stat_ent
Number of valid statistical entries in old_economy.
bool MayCompanyTakeOver(CompanyID cbig, CompanyID csmall)
May company cbig buy company csmall?
void GetNameOfOwner(Owner owner, TileIndex tile)
Set the right DParams to get the name of an owner.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
Error message; Window numbers:
The client is spectating.
CompanySettings company
default values for per-company settings
SoundSettings sound
sound effect settings
UnitID max_roadveh
max trucks in game per company
VehicleDefaultSettings vehicle
default settings for vehicles
static const byte _colour_sort[COLOUR_END]
Sorting weights for the company colours.
Small map; Window numbers:
static Owner GetTileOwner(TileIndex tile)
Returns the owner of a tile.
void SyncCompanySettings()
Sync all company settings in a multiplayer game.
static void HandleBankruptcyTakeover(Company *c)
Handle the bankruptcy take over of a company.
DoCommandFlag
List of flags for a command.
Money current_loan
Amount of money borrowed from the bank.
CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the company's company-colour.
static void SubtractMoneyFromAnyCompany(Company *c, CommandCost cost)
Deduct costs of a command from the money of a company.
Functions related to setting/changing the settings.
Linkgraph legend; Window numbers:
ClientID _network_own_client_id
Our client identifier.
ClientSettings _settings_client
The current settings for this game.
Interest payments over the loan.
Definition of base types and functions in a cross-platform compatible way.
uint32 GetRoadTotal() const
Get total sum of all owned road bits.
static const uint MAX_LENGTH_COMPANY_NAME_CHARS
The maximum length of a company name in characters including '\0'.
Reference tile. Scroll to tile when clicking on the news.
A number of safeguards to prevent using unsafe methods.
void SetLocalCompany(CompanyID new_company)
Sets the local company and updates the settings that are set on a per-company basis to reflect the co...
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
static Colours GenerateCompanyColour()
Generate a company colour.
static void RandomCompanyManagerFaceBits(CompanyManagerFace &cmf, GenderEthnicity ge, bool adv, bool interactive=true)
Make a random new face.
void CompanyAdminRemove(CompanyID company_id, CompanyRemoveReason reason)
Called whenever a company is removed in order to notify admins.
Operating profit graph; Window numbers:
Company league window; Window numbers:
Finances of a company; Window numbers:
char * stredup(const char *s, const char *last)
Create a duplicate of the given string.
GUI Functions related to companies.
uint32 terraform_per_64k_frames
how many tile heights may, over a long period, be terraformed per 65536 frames?
GroupStatistics group_all[VEH_COMPANY_END]
NOSAVE: Statistics for the ALL_GROUP group.
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
void CompaniesYearlyLoop()
A year has passed, update the economic data of all companies, and perhaps show the financial overview...
bool is_ai
If true, the company is (also) controlled by the computer (a NoAI program).
Money money
Money owned by the company.
Basic functions/variables used all over the place.
uint16 num_vehicle
Number of vehicles.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
uint16 clear_frame_burst
how many tiles may, over a short period, be cleared?
bool show_finances
show finances at end of year
static T min(const T a, const T b)
Returns the minimum of two values.
#define MAX_UVALUE(type)
The largest value that can be entered in a variable.
Functions related to sound.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void CompanyAdminUpdate(const Company *company)
Called whenever company related information changes in order to notify admins.
byte colour2
Second colour, for vehicles with 2CC support.
static bool MaybeStartNewCompany()
Start a new competitor company if possible.
static void Stop(CompanyID company)
Stop a company to be controlled by an AI.
CompanyManagerFace face
Face description of the president.
uint _next_competitor_start
the number of ticks before the next AI is started
int16 bankrupt_timeout
If bigger than 0, amount of time to wait for an answer on an offer to buy this company.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
void NetworkAdminCompanyRemove(CompanyID company_id, AdminCompanyRemoveReason bcrr)
Notify the admin network of a company to be removed (including the reason why).
Base class for all pools.
uint8 max_companies
maximum amount of companies
static void NewEvent(CompanyID company, ScriptEvent *event)
Queue a new event for an AI.
static const Colours _similar_colour[COLOUR_END][2]
Similar colours, so we can try to prevent same coloured companies.
Company news item. (Newspaper with face)
uint32 president_name_2
Parameter of president_name_1.
Performance detail window; Window numbers:
Network status window; Window numbers:
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
Owner share_owners[4]
Owners of the 4 shares of the company. INVALID_OWNER if nobody has bought them yet.
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
static bool IsInteractiveCompany(CompanyID company)
Is the user representing company?
execute the given command
UnitID max_ships
max ships in game per company
static bool CleaningPool()
Returns current state of pool cleaning - yes or no.
static int32 ClampToI32(const int64 a)
Reduce a signed 64-bit int to a signed 32-bit one.
Functions related to companies.
void ShowBuyCompanyDialog(CompanyID company)
Show the query to buy another company.
Company(uint16 name_1=0, bool is_ai=false)
Constructor.
Functionality related to the company manager's face.
CompanyCtrlAction
The action to do with CMD_COMPANY_CTRL.
GUISettings gui
settings related to the GUI
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
void StartupCompanies()
Start the next competitor now.
Base class for all vehicles.
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
size_t Utf8StringLength(const char *s)
Get the length of an UTF-8 encoded string in number of characters and thus not the number of bytes th...
CommandCost CmdRenamePresident(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Change the name of the president.
uint32 TileIndex
The index/ID of a Tile.
static size_t GetNumItems()
Returns number of valid items in the pool.
uint16 servint_trains
service interval for trains
static void GenerateCompanyName(Company *c)
Generate the name of a company from the last build coordinate.
StringID name_1
Name of the company if the user did not change it.
Company info (new companies, bankruptcy messages)
void NetworkServerNewCompany(const Company *company, NetworkClientInfo *ci)
Perform all the server specific administration of a new company.
byte colour
Company colour.
StringID president_name_1
Name of the president if the user did not change it.
static bool AreCompanyManagerFaceBitsValid(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge)
Checks whether the company manager's face bits have a valid range.
uint16 terraform_frame_burst
how many tile heights may, over a short period, be terraformed?
RoadTypes avail_roadtypes
Road types available to this company.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
TileIndex last_build_coordinate
Coordinate of the last build thing by this company.
CompanyEconomyEntry old_economy[MAX_HISTORY_QUARTERS]
Economic data of the company of the last MAX_HISTORY_QUARTERS quarters.
void SubtractMoneyFromCompany(CommandCost cost)
Subtract money from the _current_company, if the company is valid.
Maximum number of companies.
uint16 servint_aircraft
service interval for aircraft
char default_company_pass[NETWORK_PASSWORD_LENGTH]
default password for new companies in encrypted form
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() ...
Statusbar (at the bottom of your screen); Window numbers:
Base functions for all Games.
Functions related to commands.
Network functions used by other parts of OpenTTD.
byte in_use
Bit 0 set if this livery should override the default livery first colour, Bit 1 for the second colour...
char * name
Custom town name. If nullptr, the town was not renamed and uses the generated name.
bool _network_server
network-server is active
Main toolbar (the long bar at the top); Window numbers:
CompanyID _current_company
Company currently doing an action.
void ShowCompanyFinances(CompanyID company)
Open the finances window of a company.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Colours _company_colours[MAX_COMPANIES]
NOSAVE: can be determined from company structs.
CompanyRemoveReason
The reason why the company was removed.
byte max_no_competitors
the number of competitors (AIs)
UnitID max_trains
max trains in game per company
ConstructionSettings construction
construction of things in-game
Colour value is already a real palette colour index, not an index of a StringColour.
Delivered cargo graph; Window numbers:
AI settings; Window numbers:
Money yearly_expenses[3][EXPENSES_END]
Expenses of the company for the last three years, in every ExpensesType category. ...
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
GenderEthnicity
The gender/race combinations that we have faces for.
static bool CanStartNew()
Is it possible to start a new AI company?
RailTypes avail_railtypes
Rail types available to this company.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Base functions for all AIs.
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1=NR_NONE, uint32 ref1=UINT32_MAX, NewsReferenceType reftype2=NR_NONE, uint32 ref2=UINT32_MAX, void *free_data=nullptr)
Add a new newsitem to be shown.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
byte colour1
First colour, for all vehicles.
uint16 servint_roadveh
service interval for road vehicles
Money income
The amount of income.
Income from road vehicles.
RailTypes GetCompanyRailtypes(CompanyID company, bool introduces)
Get the rail types the given company can build.
static void GeneratePresidentName(Company *c)
Generate a random president name of a company.
Window functions not directly related to making/drawing windows.
static NetworkClientInfo * GetByClientID(ClientID client_id)
Return the CI given it's client-identifier.
static bool IsUniquePresidentName(const char *name)
Is the given name in use as president name of a company?
void UpdateObjectColours(const Company *c)
Updates the colour of the object whenever a company changes.
const char * NetworkChangeCompanyPassword(CompanyID company_id, const char *password)
Change the company password of a given company.
Legend for graphs; Window numbers:
CompanyEconomyEntry cur_economy
Economic data of the company of this quarter.
Running costs road vehicles.
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
Functions related to news.
Company * DoStartupNewCompany(bool is_ai, CompanyID company=INVALID_COMPANY)
Create a new company and sets all company variables default values.
void ResetCompanyLivery(Company *c)
Reset the livery schemes to the company's primary colour.
static uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge)
Gets the company manager's face bits for the given company manager's face variable.
Send message/notice to everyone playing the same company (Team)
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Game options window; Window numbers:
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
void OnTick_Companies()
Called every tick for updating some company info.
Performance history graph; Window numbers:
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
Server part of the admin network protocol.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Control the companies: add, delete, etc.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.