OpenTTD

company_func.h
Go to the documentation of this file.
1 /* $Id: company_func.h 24996 2013-02-14 17:08:56Z rubidium $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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 */
9
12 #ifndef COMPANY_FUNC_H
13 #define COMPANY_FUNC_H
14
15 #include "command_type.h"
16 #include "company_type.h"
17 #include "gfx_type.h"
18 #include "vehicle_type.h"
19
20 bool MayCompanyTakeOver(CompanyID cbig, CompanyID small);
21 void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner);
22 void GetNameOfOwner(Owner owner, TileIndex tile);
23 void SetLocalCompany(CompanyID new_company);
24 void ShowBuyCompanyDialog(CompanyID company);
25 void CompanyAdminUpdate(const Company *company);
26 void CompanyAdminBankrupt(CompanyID company_id);
27 void UpdateLandscapingLimits();
28
29 bool CheckCompanyHasMoney(CommandCost &cost);
30 void SubtractMoneyFromCompany(CommandCost cost);
31 void SubtractMoneyFromCompanyFract(CompanyID company, CommandCost cost);
32 CommandCost CheckOwnership(Owner owner, TileIndex tile = 0);
33 CommandCost CheckTileOwnership(TileIndex tile);
34
35 extern CompanyByte _local_company;
36 extern CompanyByte _current_company;
37
38 extern Colours _company_colours[MAX_COMPANIES];
39 extern CompanyManagerFace _company_manager_face;
40
45 static inline bool IsLocalCompany()
46 {
47 return _local_company == _current_company;
48 }
49
55 static inline bool IsInteractiveCompany(CompanyID company)
56 {
57 return company == _local_company;
58 }
59
60 int CompanyServiceInterval(const Company *c, VehicleType type);
61
62 #endif /* COMPANY_FUNC_H */
IsLocalCompany
static bool IsLocalCompany()
Is the current company the local company?
Definition: company_func.h:45
ChangeOwnershipOfCompanyItems
void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
Change the ownership of all the items of a company.
Definition: economy.cpp:289
_company_manager_face
CompanyManagerFace _company_manager_face
for company manager face storage in openttd.cfg
Definition: company_cmd.cpp:49
UpdateLandscapingLimits
void UpdateLandscapingLimits()
Update the landscaping limits per company.
Definition: company_cmd.cpp:265
CommandCost
Common return value for all commands.
Definition: command_type.h:25
SubtractMoneyFromCompanyFract
void SubtractMoneyFromCompanyFract(CompanyID company, CommandCost cost)
Subtract money from a company, including the money fraction.
Definition: company_cmd.cpp:252
command_type.h
Types related to commands.
_local_company
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
CheckCompanyHasMoney
bool CheckCompanyHasMoney(CommandCost &cost)
Verify whether the company can pay the bill.
Definition: company_cmd.cpp:194
CompanyManagerFace
uint32 CompanyManagerFace
Company manager face bits, info see in company_manager_face.h.
Definition: company_type.h:55
GetNameOfOwner
void GetNameOfOwner(Owner owner, TileIndex tile)
Set the right DParams to get the name of an owner.
Definition: company_cmd.cpp:281
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
SubtractMoneyFromCompany
void SubtractMoneyFromCompany(CommandCost cost)
Subtract money from the _current_company, if the company is valid.
Definition: company_cmd.cpp:241
MayCompanyTakeOver
bool MayCompanyTakeOver(CompanyID cbig, CompanyID small)
May company cbig buy company csmall?
Definition: company_cmd.cpp:622
SetLocalCompany
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...
Definition: company_cmd.cpp:102
_company_colours
Colours _company_colours[MAX_COMPANIES]
NOSAVE: can be determined from company structs.
Definition: company_cmd.cpp:48
TinyEnumT< Owner >
MAX_COMPANIES
Maximum number of companies.
Definition: company_type.h:25
Company
Definition: company_base.h:110
IsInteractiveCompany
static bool IsInteractiveCompany(CompanyID company)
Is the user representing company?
Definition: company_func.h:55
_current_company
CompanyByte _current_company
Company currently doing an action.
Definition: company_cmd.cpp:47
ShowBuyCompanyDialog
void ShowBuyCompanyDialog(CompanyID company)
Show the query to buy another company.
Definition: company_gui.cpp:2574
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
vehicle_type.h
Types related to vehicles.
CheckTileOwnership
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
Definition: company_cmd.cpp:328
CompanyAdminUpdate
void CompanyAdminUpdate(const Company *company)
Called whenever company related information changes in order to notify admins.
Definition: company_cmd.cpp:774
company_type.h
Types related to companies.
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:20
CompanyServiceInterval
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
Definition: company_cmd.cpp:1154
CheckOwnership
CommandCost CheckOwnership(Owner owner, TileIndex tile=0)
Check whether the current owner owns something.
Definition: company_cmd.cpp:310
gfx_type.h
Types related to the graphics and/or input devices.