Codechange: Use cached town, station, industry names for list window sorting
[openttd-github.git] / src / company_func.h
blobcec61100449d8e159e9d703ef984aa021f4e580b
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 */
8 /** @file company_func.h Functions related to companies. */
10 #ifndef COMPANY_FUNC_H
11 #define COMPANY_FUNC_H
13 #include "command_type.h"
14 #include "company_type.h"
15 #include "gfx_type.h"
16 #include "vehicle_type.h"
18 bool MayCompanyTakeOver(CompanyID cbig, CompanyID small);
19 void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner);
20 void GetNameOfOwner(Owner owner, TileIndex tile);
21 void SetLocalCompany(CompanyID new_company);
22 void ShowBuyCompanyDialog(CompanyID company);
23 void CompanyAdminUpdate(const Company *company);
24 void CompanyAdminBankrupt(CompanyID company_id);
25 void UpdateLandscapingLimits();
27 bool CheckCompanyHasMoney(CommandCost &cost);
28 void SubtractMoneyFromCompany(CommandCost cost);
29 void SubtractMoneyFromCompanyFract(CompanyID company, CommandCost cost);
30 CommandCost CheckOwnership(Owner owner, TileIndex tile = 0);
31 CommandCost CheckTileOwnership(TileIndex tile);
33 extern CompanyID _local_company;
34 extern CompanyID _current_company;
36 extern Colours _company_colours[MAX_COMPANIES];
37 extern CompanyManagerFace _company_manager_face;
39 /**
40 * Is the current company the local company?
41 * @return \c true of the current company is the local company, \c false otherwise.
43 static inline bool IsLocalCompany()
45 return _local_company == _current_company;
48 /**
49 * Is the user representing \a company?
50 * @param company Company where interaction is needed with.
51 * @return Gives \c true if the user can answer questions interactively as representative of \a company, else \c false
53 static inline bool IsInteractiveCompany(CompanyID company)
55 return company == _local_company;
58 int CompanyServiceInterval(const Company *c, VehicleType type);
60 #endif /* COMPANY_FUNC_H */