|
OpenTTD Source
14.0-beta1
|
Go to the documentation of this file.
26 #include "table/strings.h"
51 case LoanCommand::Interval:
54 case LoanCommand::Max:
57 case LoanCommand::Amount:
59 if (loan < LOAN_INTERVAL || c->current_loan + loan > max_loan || loan %
LOAN_INTERVAL != 0)
return CMD_ERROR;
95 case LoanCommand::Interval:
98 case LoanCommand::Max:
102 case LoanCommand::Amount:
130 if (amount != COMPANY_MAX_LOAN_DEFAULT) {
139 if (amount != COMPANY_MAX_LOAN_DEFAULT) amount -= (int64_t)amount %
LOAN_INTERVAL;
189 STR_NEWGRF_UNPAUSE_WARNING_TITLE,
190 STR_NEWGRF_UNPAUSE_WARNING,
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
static Titem * Get(size_t index)
Returns Titem with given index.
@ EXPENSES_END
Number of expense types.
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback, bool focus)
Show a confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre o...
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
Class to backup a specific variable and restore it later.
@ EXPENSES_OTHER
Other expenses.
static const int LOAN_INTERVAL
The "steps" in loan size, in British Pounds!
CommandCost CmdDecreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount)
Decrease the loan of your company.
static const uint TILE_SIZE
Tile size in world coordinates.
void NetworkHandlePauseChange(PauseMode prev_mode, PauseMode changed_mode)
Handle the pause mode change so we send the right messages to the chat.
Owner
Enum for all companies/owners.
@ DC_EXEC
execute the given command
DoCommandFlag
List of flags for a command.
Money current_loan
Amount of money borrowed from the bank.
@ PM_UNPAUSED
A normal unpaused game.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
Money GetAvailableMoneyForCommand()
This functions returns the money which can be used to execute a command.
Common return value for all commands.
@ PM_PAUSED_SAVELOAD
A game paused for saving/loading.
Money money
Money owned by the company.
void InvalidateCompanyWindows(const Company *company)
Refresh all windows owned by a company.
PauseMode _pause_mode
The current pause mode.
CommandCost CmdIncreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount)
Increase the loan of your company.
CommandCost CmdPause(DoCommandFlag flags, PauseMode mode, bool pause)
Pause/Unpause the game (server-only).
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.
bool _networking
are we in networking mode?
CommandCost CmdMoneyCheat(DoCommandFlag, Money amount)
Change the financial flow of your company.
Money GetMaxLoan() const
Calculate the max allowed loan for this company.
PauseMode
Modes of pausing we've got.
static void AskUnsafeUnpauseCallback(Window *, bool confirmed)
In case of an unsafe unpause, we want the user to confirm that it might crash.
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
Display animated income or costs on the map.
@ PM_PAUSED_GAME_SCRIPT
A game paused by a game script.
@ PM_PAUSED_ACTIVE_CLIENTS
A game paused for 'min_active_clients'.
CompanyID _current_company
Company currently doing an action.
void Restore()
Restore the variable.
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
@ PM_PAUSED_NORMAL
A game normally paused.
static const int64_t MAX_LOAN_LIMIT
The max amount possible to configure for a max loan of a company.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
@ PM_PAUSED_LINK_GRAPH
A game paused due to the link graph schedule lagging.
@ PM_PAUSED_JOIN
A game paused for 'pause_on_join'.
Data structure for an opened window.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
@ WC_STATUS_BAR
Statusbar (at the bottom of your screen); Window numbers:
void SubtractMoneyFromCompany(const CommandCost &cost)
Subtract money from the _current_company, if the company is valid.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
ExpensesType
Types of expenses.
@ PM_PAUSED_ERROR
A game paused because a (critical) error.
@ WC_MAIN_TOOLBAR
Main toolbar (the long bar at the top); Window numbers:
int GetTilePixelZ(TileIndex tile)
Get bottom height of the tile.
@ PM_COMMAND_DURING_PAUSE
A game paused, and a command executed during the pause; resets on autosave.
Money max_loan
Max allowed amount of the loan or COMPANY_MAX_LOAN_DEFAULT.
CommandCost CmdSetCompanyMaxLoan(DoCommandFlag flags, CompanyID company, Money amount)
Sets the max loan amount of your company.