OpenTTD Source 20241224-master-gf74b0cf984
company_func.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef COMPANY_FUNC_H
11#define COMPANY_FUNC_H
12
13#include "command_type.h"
14#include "company_type.h"
15#include "gfx_type.h"
16#include "vehicle_type.h"
17
19void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner);
21void SetDParamsForOwnedBy(Owner owner, TileIndex tile);
22void SetLocalCompany(CompanyID new_company);
23void ShowBuyCompanyDialog(CompanyID company, bool hostile_takeover);
24void CompanyAdminUpdate(const Company *company);
25void CompanyAdminBankrupt(CompanyID company_id);
28
33void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost &cost);
36
39
40extern Colours _company_colours[MAX_COMPANIES];
42
47inline bool IsLocalCompany()
48{
50}
51
57inline bool IsInteractiveCompany(CompanyID company)
58{
59 return company == _local_company;
60}
61
64
65#endif /* COMPANY_FUNC_H */
Common return value for all commands.
Types related to commands.
Colours _company_colours[MAX_COMPANIES]
NOSAVE: can be determined from company structs.
bool IsInteractiveCompany(CompanyID company)
Is the user representing company?
void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
Change the ownership of all the items of a company.
Definition economy.cpp:334
void ShowBuyCompanyDialog(CompanyID company, bool hostile_takeover)
Show the query to buy another company.
static const int OWNED_BY_OWNER_IN_PARAMETERS_OFFSET
The index in the parameters for the owner information.
void UpdateCompanyLiveries(Company *c)
Update liveries for a company.
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
bool CheckCompanyHasMoney(CommandCost &cost)
Verify whether the company can pay the bill.
CompanyID GetFirstPlayableCompanyID()
Get the index of the first available company.
bool CheckTakeoverVehicleLimit(CompanyID cbig, CompanyID small)
Can company cbig buy company csmall without exceeding vehicle limits?
Money GetAvailableMoneyForCommand()
This functions returns the money which can be used to execute a command.
void CompanyAdminUpdate(const Company *company)
Called whenever company related information changes in order to notify admins.
void SetDParamsForOwnedBy(Owner owner, TileIndex tile)
Set the right DParams for STR_ERROR_OWNED_BY.
void SubtractMoneyFromCompany(const CommandCost &cost)
Subtract money from the _current_company, if the company is valid.
void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost &cost)
Subtract money from a company, including the money fraction.
bool IsLocalCompany()
Is the current company the local company?
CommandCost CheckOwnership(Owner owner, TileIndex tile=0U)
Check whether the current owner owns something.
Money GetAvailableMoney(CompanyID company)
Get the amount of money that a company has available, or INT64_MAX if there is no such valid company.
void UpdateLandscapingLimits()
Update the landscaping limits per company.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
CompanyManagerFace _company_manager_face
for company manager face storage in openttd.cfg
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...
CompanyID _current_company
Company currently doing an action.
Types related to companies.
uint32_t CompanyManagerFace
Company manager face bits, info see in company_manager_face.h.
Owner
Enum for all companies/owners.
@ MAX_COMPANIES
Maximum number of companies.
Types related to the graphics and/or input devices.
Types related to vehicles.
VehicleType
Available vehicle types.