OpenTTD Source: src/misc_cmd.h File Reference

OpenTTD Source 13.1

Enumerations | Functions
misc_cmd.h File Reference
`#include "command_type.h"`
`#include "economy_type.h"`

Go to the source code of this file.

## Enumerations
enum | LoanCommand : byte { Interval, Max, Amount }

## Functions
CommandCost | CmdMoneyCheat (DoCommandFlag flags, Money amount)
| Change the financial flow of your company. More...
CommandCost | CmdChangeBankBalance (DoCommandFlag 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. More...
CommandCost | CmdIncreaseLoan (DoCommandFlag flags, LoanCommand cmd, Money amount)
| Increase the loan of your company. More...
CommandCost | CmdDecreaseLoan (DoCommandFlag flags, LoanCommand cmd, Money amount)
| Decrease the loan of your company. More...
CommandCost | CmdPause (DoCommandFlag flags, PauseMode mode, bool pause)
| Pause/Unpause the game (server-only). More...

## Detailed Description

Miscellaneous command definitions.

Definition in file misc_cmd.h.

## Function Documentation

## ◆ CmdChangeBankBalance()

CommandCost CmdChangeBankBalance | ( | DoCommandFlag | 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.

Parameters

  flags | operation to perform
  tile | tile to show text effect on (if not 0)
  delta | the amount of money to receive (if positive), or spend (if negative)
  company | the company ID.
  expenses_type | the expenses type which should register the cost/income

See also
  ExpensesType.

Returns
  zero cost or an error

Definition at line 207 of file misc_cmd.cpp.

References _current_company, CMD_ERROR, DC_EXEC, EXPENSES_END, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and OWNER_DEITY.

## ◆ CmdDecreaseLoan()

CommandCost CmdDecreaseLoan | ( | DoCommandFlag | flags,
|  | LoanCommand | cmd,
|  | Money | amount
| ) |  |

Decrease the loan of your company.

Parameters

  flags | operation to perform
  cmd | when LoanCommand::Interval: pays back LOAN_INTERVAL, when LoanCommand::Max: pays back the maximum loan permitting money (press CTRL), when LoanCommand::Amount: pays back the amount specified in `amount`
  amount | amount to decrease the loan with, multitude of LOAN_INTERVAL. Only used when cmd == LoanCommand::Amount.

Returns
  the cost of this operation or an error

Definition at line 86 of file misc_cmd.cpp.

References _current_company, CMD_ERROR, CompanyProperties::current_loan, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), and return_cmd_error.

## ◆ CmdIncreaseLoan()

CommandCost CmdIncreaseLoan | ( | DoCommandFlag | flags,
|  | LoanCommand | cmd,
|  | Money | amount
| ) |  |

Increase the loan of your company.

Parameters

  flags | operation to perform
  cmd | when LoanCommand::Interval: loans LOAN_INTERVAL, when LoanCommand::Max: loans the maximum loan permitting money (press CTRL), when LoanCommand::Amount: loans the amount specified in `amount`
  amount | amount to increase the loan with, multitude of LOAN_INTERVAL. Only used when cmd == LoanCommand::Amount.

Returns
  the cost of this operation or an error

Definition at line 39 of file misc_cmd.cpp.

References _current_company, CompanyProperties::current_loan, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get().

## ◆ CmdMoneyCheat()

CommandCost CmdMoneyCheat | ( | DoCommandFlag | flags,
|  | Money | amount
| ) |  |

Change the financial flow of your company.

Parameters

  flags | operation to perform
  amount | the amount of money to receive (if positive), or spend (if negative)

Returns
  the cost of this operation or an error

Definition at line 193 of file misc_cmd.cpp.

References EXPENSES_OTHER.

## ◆ CmdPause()

CommandCost CmdPause | ( | DoCommandFlag | flags,
|  | PauseMode | mode,
|  | bool | pause
| ) |  |

Pause/Unpause the game (server-only).

Set or unset a bit in the pause mode. If pause mode is zero the game is unpaused. A bitset is used instead of a boolean value/counter to have more control over the game when saving/loading, etc.

Parameters

  flags | operation to perform
  mode | the pause mode to change
  pause | true pauses, false unpauses this mode

Returns
  the cost of this operation or an error

Definition at line 144 of file misc_cmd.cpp.

References _networking, _pause_mode, AskUnsafeUnpauseCallback(), CMD_ERROR, DC_EXEC, NetworkHandlePauseChange(), PM_PAUSED_ACTIVE_CLIENTS, PM_PAUSED_ERROR, PM_PAUSED_GAME_SCRIPT, PM_PAUSED_JOIN, PM_PAUSED_LINK_GRAPH, PM_PAUSED_NORMAL, PM_PAUSED_SAVELOAD, SetWindowDirty(), ShowQuery(), WC_MAIN_TOOLBAR, and WC_STATUS_BAR.