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 
8 /** @file company_func.h Functions related to companies. */
9 
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 
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();
26 
27 bool CheckCompanyHasMoney(CommandCost &cost);
28 void SubtractMoneyFromCompany(const CommandCost& cost);
29 void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost& cost);
30 CommandCost CheckOwnership(Owner owner, TileIndex tile = 0);
31 CommandCost CheckTileOwnership(TileIndex tile);
32 
33 extern CompanyID _local_company;
34 extern CompanyID _current_company;
35 
36 extern Colours _company_colours[MAX_COMPANIES];
37 extern CompanyManagerFace _company_manager_face;
38 
39 /**
40  * Is the current company the local company?
41  * @return \c true of the current company is the local company, \c false otherwise.
42  */
IsLocalCompany()43 static inline bool IsLocalCompany()
44 {
45 	return _local_company == _current_company;
46 }
47 
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
52  */
IsInteractiveCompany(CompanyID company)53 static inline bool IsInteractiveCompany(CompanyID company)
54 {
55 	return company == _local_company;
56 }
57 
58 int CompanyServiceInterval(const Company *c, VehicleType type);
59 
60 #endif /* COMPANY_FUNC_H */
61