OpenTTD Source: src/misc_cmd.h Source File

OpenTTD Source 15.3

misc_cmd.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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef MISC_CMD_H
11#define MISC_CMD_H
12
13#include "command_type.h"
14#include "economy_type.h"
15#include "openttd.h"
16
17enum class LoanCommand : uint8_t {
18 Interval,
19 Max,
20 Amount,
21};
22
23 CommandCost CmdMoneyCheat(DoCommandFlags flags, Money amount);
24 CommandCost CmdChangeBankBalance(DoCommandFlags flags, TileIndex tile, Money delta, CompanyID company, ExpensesType expenses_type);
25 CommandCost CmdIncreaseLoan(DoCommandFlags flags, LoanCommand cmd, Money amount);
26 CommandCost CmdDecreaseLoan(DoCommandFlags flags, LoanCommand cmd, Money amount);
27 CommandCost CmdSetCompanyMaxLoan(DoCommandFlags flags, CompanyID company, Money amount);
28 CommandCost CmdPause(DoCommandFlags flags, PauseMode mode, bool pause);
29
30DEF_CMD_TRAIT(CMD_MONEY_CHEAT, CmdMoneyCheat, CommandFlags({CommandFlag::Offline, CommandFlag::NoEst}), CommandType::Cheat)
31DEF_CMD_TRAIT(CMD_CHANGE_BANK_BALANCE, CmdChangeBankBalance, CommandFlag::Deity, CommandType::MoneyManagement)
32DEF_CMD_TRAIT(CMD_INCREASE_LOAN, CmdIncreaseLoan, {}, CommandType::MoneyManagement)
33DEF_CMD_TRAIT(CMD_DECREASE_LOAN, CmdDecreaseLoan, {}, CommandType::MoneyManagement)
34DEF_CMD_TRAIT(CMD_SET_COMPANY_MAX_LOAN, CmdSetCompanyMaxLoan, CommandFlag::Deity, CommandType::MoneyManagement)
35DEF_CMD_TRAIT(CMD_PAUSE, CmdPause, CommandFlags({CommandFlag::Server, CommandFlag::NoEst}), CommandType::ServerSetting)
36
37#endif /* MISC_CMD_H */
CommandCost
Common return value for all commands.
Definition command_type.h:24
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
OverflowSafeInt< int64_t >
command_type.h
Types related to commands.
CommandType::Cheat
@ Cheat
A cheat of some sorts.
CommandType::MoneyManagement
@ MoneyManagement
Management of money, i.e. loans.
CommandType::ServerSetting
@ ServerSetting
Pausing/removing companies/server settings.
CommandFlag::NoEst
@ NoEst
the command is never estimated.
CommandFlag::Deity
@ Deity
the command may be executed by COMPANY_DEITY
CommandFlag::Offline
@ Offline
the command cannot be executed in a multiplayer game; single-player only
CommandFlag::Server
@ Server
the command can only be initiated by the server
CMD_PAUSE
@ CMD_PAUSE
pause the game
Definition command_type.h:288
CMD_MONEY_CHEAT
@ CMD_MONEY_CHEAT
do the money cheat
Definition command_type.h:307
CMD_DECREASE_LOAN
@ CMD_DECREASE_LOAN
decrease the loan from the bank
Definition command_type.h:268
CMD_INCREASE_LOAN
@ CMD_INCREASE_LOAN
increase the loan from the bank
Definition command_type.h:267
CMD_SET_COMPANY_MAX_LOAN
@ CMD_SET_COMPANY_MAX_LOAN
sets the max loan for the company
Definition command_type.h:269
CMD_CHANGE_BANK_BALANCE
@ CMD_CHANGE_BANK_BALANCE
change bank balance to charge costs or give money from a GS
Definition command_type.h:308
economy_type.h
Types related to the economy.
ExpensesType
ExpensesType
Types of expenses.
Definition economy_type.h:178
CmdMoneyCheat
CommandCost CmdMoneyCheat(DoCommandFlags flags, Money amount)
Change the financial flow of your company.
Definition misc_cmd.cpp:220
CmdChangeBankBalance
CommandCost CmdChangeBankBalance(DoCommandFlags flags, TileIndex tile, Money delta, CompanyID company, ExpensesType expenses_type)
Change the bank bank balance of a company by inserting or removing money without affecting the loan.
Definition misc_cmd.cpp:234
CmdDecreaseLoan
CommandCost CmdDecreaseLoan(DoCommandFlags flags, LoanCommand cmd, Money amount)
Decrease the loan of your company.
Definition misc_cmd.cpp:85
CmdIncreaseLoan
CommandCost CmdIncreaseLoan(DoCommandFlags flags, LoanCommand cmd, Money amount)
Increase the loan of your company.
Definition misc_cmd.cpp:39
CmdPause
CommandCost CmdPause(DoCommandFlags flags, PauseMode mode, bool pause)
Pause/Unpause the game (server-only).
Definition misc_cmd.cpp:167
CmdSetCompanyMaxLoan
CommandCost CmdSetCompanyMaxLoan(DoCommandFlags flags, CompanyID company, Money amount)
Sets the max loan amount of your company.
Definition misc_cmd.cpp:125
openttd.h
Some generic types.
PauseMode
PauseMode
Modes of pausing we've got.
Definition openttd.h:68
PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >