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/>.
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"
16 #include "vehicle_type.h"
18 bool CheckTakeoverVehicleLimit(CompanyID cbig
, CompanyID small
);
19 void ChangeOwnershipOfCompanyItems(Owner old_owner
, Owner new_owner
);
20 static const int OWNED_BY_OWNER_IN_PARAMETERS_OFFSET
= 2; ///< The index in the parameters for the owner information.
21 void SetDParamsForOwnedBy(Owner owner
, TileIndex tile
);
22 void SetLocalCompany(CompanyID new_company
);
23 void ShowBuyCompanyDialog(CompanyID company
, bool hostile_takeover
);
24 void CompanyAdminUpdate(const Company
*company
);
25 void CompanyAdminBankrupt(CompanyID company_id
);
26 void UpdateLandscapingLimits();
27 void UpdateCompanyLiveries(Company
*c
);
29 Money
GetAvailableMoney(CompanyID company
);
30 Money
GetAvailableMoneyForCommand();
31 bool CheckCompanyHasMoney(CommandCost
&cost
);
32 void SubtractMoneyFromCompany(const CommandCost
&cost
);
33 void SubtractMoneyFromCompanyFract(CompanyID company
, const CommandCost
&cost
);
34 CommandCost
CheckOwnership(Owner owner
, TileIndex tile
= 0U);
35 CommandCost
CheckTileOwnership(TileIndex tile
);
37 extern CompanyID _local_company
;
38 extern CompanyID _current_company
;
40 extern Colours _company_colours
[MAX_COMPANIES
];
41 extern CompanyManagerFace _company_manager_face
;
44 * Is the current company the local company?
45 * @return \c true of the current company is the local company, \c false otherwise.
47 inline bool IsLocalCompany()
49 return _local_company
== _current_company
;
53 * Is the user representing \a company?
54 * @param company Company where interaction is needed with.
55 * @return Gives \c true if the user can answer questions interactively as representative of \a company, else \c false
57 inline bool IsInteractiveCompany(CompanyID company
)
59 return company
== _local_company
;
62 int CompanyServiceInterval(const Company
*c
, VehicleType type
);
63 CompanyID
GetFirstPlayableCompanyID();
65 #endif /* COMPANY_FUNC_H */