Changeset - r26120:15c912177c88
src/ai/ai_gui.cpp
Show inline comments
 
@@ -1332,7 +1332,7 @@ struct AIDebugWindow : public Window {
 
						}
 
						if (all_unpaused) {
 
							/* All scripts have been unpaused => unpause the game. */
 
							Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 0, {});
 
							Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, false);
 
						}
 
					}
 
				}
 
@@ -1381,7 +1381,7 @@ struct AIDebugWindow : public Window {
 

	
 
					/* Pause the game. */
 
					if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
 
						Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
 
						Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
 
					}
 

	
 
					/* Highlight row that matched */
src/autoreplace_gui.cpp
Show inline comments
 
@@ -547,7 +547,7 @@ public:
 
					Command<CMD_SET_GROUP_FLAG>::Post(this->sel_group, GroupFlags::GF_REPLACE_WAGON_REMOVAL, !HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL), _ctrl_pressed);
 
				} else {
 
					// toggle renew_keep_length
 
					Command<CMD_CHANGE_COMPANY_SETTING>::Post(0, 0, Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1, "company.renew_keep_length");
 
					Command<CMD_CHANGE_COMPANY_SETTING>::Post("company.renew_keep_length", Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1);
 
				}
 
				break;
 
			}
src/cheat_gui.cpp
Show inline comments
 
@@ -55,7 +55,7 @@ static int32 _money_cheat_amount = 10000
 
 */
 
static int32 ClickMoneyCheat(int32 p1, int32 p2)
 
{
 
	Command<CMD_MONEY_CHEAT>::Post(0, (uint32)(p2 * _money_cheat_amount), 0, {});
 
	Command<CMD_MONEY_CHEAT>::Post(p2 * _money_cheat_amount);
 
	return _money_cheat_amount;
 
}
 

	
src/command_type.h
Show inline comments
 
@@ -404,26 +404,6 @@ enum CommandPauseLevel {
 
	CMDPL_ALL_ACTIONS,     ///< All actions may be executed.
 
};
 

	
 
/**
 
 * Defines the callback type for all command handler functions.
 
 *
 
 * This type defines the function header for all functions which handles a CMD_* command.
 
 * A command handler use the parameters to act according to the meaning of the command.
 
 * The tile parameter defines the tile to perform an action on.
 
 * The flag parameter is filled with flags from the DC_* enumeration. The parameters
 
 * p1 and p2 are filled with parameters for the command like "which road type", "which
 
 * order" or "direction". Each function should mentioned in there doxygen comments
 
 * the usage of these parameters.
 
 *
 
 * @param tile The tile to apply a command on
 
 * @param flags Flags for the command, from the DC_* enumeration
 
 * @param p1 Additional data for the command
 
 * @param p2 Additional data for the command
 
 * @param text Additional text
 
 * @return The CommandCost of the command, which can be succeeded or failed.
 
 */
 
typedef CommandCost CommandProc(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text);
 

	
 

	
 
template <typename T> struct CommandFunctionTraitHelper;
 
template <typename... Targs>
src/company_cmd.cpp
Show inline comments
 
@@ -916,16 +916,11 @@ CommandCost CmdCompanyCtrl(DoCommandFlag
 
/**
 
 * Change the company manager's face.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 face bitmasked
 
 * @param text unused
 
 * @param cmf face bitmasked
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdSetCompanyManagerFace(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdSetCompanyManagerFace(DoCommandFlag flags, CompanyManagerFace cmf)
 
{
 
	CompanyManagerFace cmf = (CompanyManagerFace)p2;
 

	
 
	if (!IsValidCompanyManagerFace(cmf)) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
@@ -938,20 +933,13 @@ CommandCost CmdSetCompanyManagerFace(DoC
 
/**
 
 * Change the company's company-colour
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 bitstuffed:
 
 * p1 bits 0-7 scheme to set
 
 * p1 bit 8 set first/second colour
 
 * @param p2 new colour for vehicles, property, etc.
 
 * @param text unused
 
 * @param scheme scheme to set
 
 * @param primary set first/second colour
 
 * @param colour new colour for vehicles, property, etc.
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdSetCompanyColour(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdSetCompanyColour(DoCommandFlag flags, LiveryScheme scheme, bool primary, Colours colour)
 
{
 
	Colours colour = Extract<Colours, 0, 8>(p2);
 
	LiveryScheme scheme = Extract<LiveryScheme, 0, 8>(p1);
 
	bool second = HasBit(p1, 8);
 

	
 
	if (scheme >= LS_END || (colour >= COLOUR_END && colour != INVALID_COLOUR)) return CMD_ERROR;
 

	
 
	/* Default scheme can't be reset to invalid. */
 
@@ -960,14 +948,14 @@ CommandCost CmdSetCompanyColour(DoComman
 
	Company *c = Company::Get(_current_company);
 

	
 
	/* Ensure no two companies have the same primary colour */
 
	if (scheme == LS_DEFAULT && !second) {
 
	if (scheme == LS_DEFAULT && primary) {
 
		for (const Company *cc : Company::Iterate()) {
 
			if (cc != c && cc->colour == colour) return CMD_ERROR;
 
		}
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		if (!second) {
 
		if (primary) {
 
			if (scheme != LS_DEFAULT) SB(c->livery[scheme].in_use, 0, 1, colour != INVALID_COLOUR);
 
			if (colour == INVALID_COLOUR) colour = (Colours)c->livery[LS_DEFAULT].colour1;
 
			c->livery[scheme].colour1 = colour;
 
@@ -1051,13 +1039,10 @@ static bool IsUniqueCompanyName(const st
 
/**
 
 * Change the name of the company.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdRenameCompany(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdRenameCompany(DoCommandFlag flags, const std::string &text)
 
{
 
	bool reset = text.empty();
 

	
 
@@ -1097,13 +1082,10 @@ static bool IsUniquePresidentName(const 
 
/**
 
 * Change the name of the president.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 unused
 
 * @param text the new name or an empty string when resetting to the default
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdRenamePresident(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdRenamePresident(DoCommandFlag flags, const std::string &text)
 
{
 
	bool reset = text.empty();
 

	
 
@@ -1121,7 +1103,7 @@ CommandCost CmdRenamePresident(DoCommand
 
			c->president_name = text;
 

	
 
			if (c->name_1 == STR_SV_UNNAMED && c->name.empty()) {
 
				Command<CMD_RENAME_COMPANY>::Do(DC_EXEC, 0, 0, 0, text + " Transport");
 
				Command<CMD_RENAME_COMPANY>::Do(DC_EXEC, text + " Transport");
 
			}
 
		}
 

	
 
@@ -1182,19 +1164,16 @@ uint32 CompanyInfrastructure::GetTramTot
 
 * companies if you have paid off your loan (either explicitly, or implicitly
 
 * given the fact that you have more money than loan).
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 the amount of money to transfer; max 20.000.000
 
 * @param p2 the company to transfer the money to
 
 * @param text unused
 
 * @param money the amount of money to transfer; max 20.000.000
 
 * @param dest_company the company to transfer the money to
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdGiveMoney(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdGiveMoney(DoCommandFlag flags, uint32 money, CompanyID dest_company)
 
{
 
	if (!_settings_game.economy.give_money) return CMD_ERROR;
 

	
 
	const Company *c = Company::Get(_current_company);
 
	CommandCost amount(EXPENSES_OTHER, std::min<Money>(p1, 20000000LL));
 
	CompanyID dest_company = (CompanyID)p2;
 
	CommandCost amount(EXPENSES_OTHER, std::min<Money>(money, 20000000LL));
 

	
 
	/* You can only transfer funds that is in excess of your loan */
 
	if (c->money - c->current_loan < amount.GetCost() || amount.GetCost() < 0) return_cmd_error(STR_ERROR_INSUFFICIENT_FUNDS);
src/company_cmd.h
Show inline comments
 
@@ -11,15 +11,18 @@
 
#define COMPANY_CMD_H
 

	
 
#include "command_type.h"
 
#include "company_type.h"
 
#include "livery.h"
 

	
 
enum ClientID : uint32;
 
enum Colours : byte;
 

	
 
CommandCost CmdCompanyCtrl(DoCommandFlag flags, CompanyCtrlAction cca, CompanyID company_id, CompanyRemoveReason reason, ClientID client_id);
 
CommandProc CmdGiveMoney;
 
CommandProc CmdRenameCompany;
 
CommandProc CmdRenamePresident;
 
CommandProc CmdSetCompanyManagerFace;
 
CommandProc CmdSetCompanyColour;
 
CommandCost CmdGiveMoney(DoCommandFlag flags, uint32 money, CompanyID dest_company);
 
CommandCost CmdRenameCompany(DoCommandFlag flags, const std::string &text);
 
CommandCost CmdRenamePresident(DoCommandFlag flags, const std::string &text);
 
CommandCost CmdSetCompanyManagerFace(DoCommandFlag flags, CompanyManagerFace cmf);
 
CommandCost CmdSetCompanyColour(DoCommandFlag flags, LiveryScheme scheme, bool primary, Colours colour);
 

	
 
DEF_CMD_TRAIT(CMD_COMPANY_CTRL,             CmdCompanyCtrl,           CMD_SPECTATOR | CMD_CLIENT_ID | CMD_NO_EST, CMDT_SERVER_SETTING)
 
DEF_CMD_TRAIT(CMD_GIVE_MONEY,               CmdGiveMoney,             0,                                          CMDT_MONEY_MANAGEMENT)
src/company_gui.cpp
Show inline comments
 
@@ -440,11 +440,11 @@ struct CompanyFinancesWindow : Window {
 
				break;
 

	
 
			case WID_CF_INCREASE_LOAN: // increase loan
 
				Command<CMD_INCREASE_LOAN>::Post(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY, 0, 0, _ctrl_pressed, {});
 
				Command<CMD_INCREASE_LOAN>::Post(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY, _ctrl_pressed ? LoanCommand::Max : LoanCommand::Interval, 0);
 
				break;
 

	
 
			case WID_CF_REPAY_LOAN: // repay loan
 
				Command<CMD_DECREASE_LOAN>::Post(STR_ERROR_CAN_T_REPAY_LOAN, 0, 0, _ctrl_pressed, {});
 
				Command<CMD_DECREASE_LOAN>::Post(STR_ERROR_CAN_T_REPAY_LOAN, _ctrl_pressed ? LoanCommand::Max : LoanCommand::Interval, 0);
 
				break;
 

	
 
			case WID_CF_INFRASTRUCTURE: // show infrastructure details
 
@@ -1000,7 +1000,7 @@ public:
 
			for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
				/* Changed colour for the selected scheme, or all visible schemes if CTRL is pressed. */
 
				if (HasBit(this->sel, scheme) || (_ctrl_pressed && _livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme))) {
 
					Command<CMD_SET_COMPANY_COLOUR>::Post(0, scheme | (widget == WID_SCL_PRI_COL_DROPDOWN ? 0 : 256), index, {});
 
					Command<CMD_SET_COMPANY_COLOUR>::Post(scheme, widget == WID_SCL_PRI_COL_DROPDOWN, (Colours)index);
 
				}
 
			}
 
		} else {
 
@@ -1586,7 +1586,7 @@ public:
 

	
 
			/* OK button */
 
			case WID_SCMF_ACCEPT:
 
				Command<CMD_SET_COMPANY_MANAGER_FACE>::Post(0, 0, this->face, {});
 
				Command<CMD_SET_COMPANY_MANAGER_FACE>::Post(this->face);
 
				FALLTHROUGH;
 

	
 
			/* Cancel button */
 
@@ -2581,11 +2581,11 @@ struct CompanyWindow : Window
 
				break;
 

	
 
			case WID_C_BUY_SHARE:
 
				Command<CMD_BUY_SHARE_IN_COMPANY>::Post(STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS, 0, this->window_number, 0, {});
 
				Command<CMD_BUY_SHARE_IN_COMPANY>::Post(STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS, (CompanyID)this->window_number);
 
				break;
 

	
 
			case WID_C_SELL_SHARE:
 
				Command<CMD_SELL_SHARE_IN_COMPANY>::Post(STR_ERROR_CAN_T_SELL_25_SHARE_IN, 0, this->window_number, 0, {});
 
				Command<CMD_SELL_SHARE_IN_COMPANY>::Post(STR_ERROR_CAN_T_SELL_25_SHARE_IN, (CompanyID)this->window_number);
 
				break;
 

	
 
			case WID_C_COMPANY_PASSWORD:
 
@@ -2640,16 +2640,16 @@ struct CompanyWindow : Window
 
				Money money = (Money)(strtoull(str, nullptr, 10) / _currency->rate);
 
				uint32 money_c = Clamp(ClampToI32(money), 0, 20000000); // Clamp between 20 million and 0
 

	
 
				Command<CMD_GIVE_MONEY>::Post(STR_ERROR_CAN_T_GIVE_MONEY, 0, money_c, this->window_number, {});
 
				Command<CMD_GIVE_MONEY>::Post(STR_ERROR_CAN_T_GIVE_MONEY, money_c, (CompanyID)this->window_number);
 
				break;
 
			}
 

	
 
			case WID_C_PRESIDENT_NAME:
 
				Command<CMD_RENAME_PRESIDENT>::Post(STR_ERROR_CAN_T_CHANGE_PRESIDENT, 0, 0, 0, str);
 
				Command<CMD_RENAME_PRESIDENT>::Post(STR_ERROR_CAN_T_CHANGE_PRESIDENT, str);
 
				break;
 

	
 
			case WID_C_COMPANY_NAME:
 
				Command<CMD_RENAME_COMPANY>::Post(STR_ERROR_CAN_T_CHANGE_COMPANY_NAME, 0, 0, 0, str);
 
				Command<CMD_RENAME_COMPANY>::Post(STR_ERROR_CAN_T_CHANGE_COMPANY_NAME, str);
 
				break;
 

	
 
			case WID_C_COMPANY_JOIN:
 
@@ -2776,7 +2776,7 @@ struct BuyCompanyWindow : Window {
 
				break;
 

	
 
			case WID_BC_YES:
 
				Command<CMD_BUY_COMPANY>::Post(STR_ERROR_CAN_T_BUY_COMPANY, 0, this->window_number, 0, {});
 
				Command<CMD_BUY_COMPANY>::Post(STR_ERROR_CAN_T_BUY_COMPANY, (CompanyID)this->window_number);
 
				break;
 
		}
 
	}
src/console_cmds.cpp
Show inline comments
 
@@ -632,7 +632,7 @@ DEF_CONSOLE_CMD(ConPauseGame)
 
	}
 

	
 
	if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
 
		Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
 
		Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
 
		if (!_networking) IConsolePrint(CC_DEFAULT, "Game paused.");
 
	} else {
 
		IConsolePrint(CC_DEFAULT, "Game is already paused.");
 
@@ -654,7 +654,7 @@ DEF_CONSOLE_CMD(ConUnpauseGame)
 
	}
 

	
 
	if ((_pause_mode & PM_PAUSED_NORMAL) != PM_UNPAUSED) {
 
		Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 0, {});
 
		Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, false);
 
		if (!_networking) IConsolePrint(CC_DEFAULT, "Game unpaused.");
 
	} else if ((_pause_mode & PM_PAUSED_ERROR) != PM_UNPAUSED) {
 
		IConsolePrint(CC_DEFAULT, "Game is in error state and cannot be unpaused via console.");
src/core/overflowsafe_type.hpp
Show inline comments
 
@@ -39,9 +39,10 @@ public:
 
	constexpr OverflowSafeInt() : m_value(0) { }
 

	
 
	constexpr OverflowSafeInt(const OverflowSafeInt& other) : m_value(other.m_value) { }
 
	constexpr OverflowSafeInt(const int64 int_) : m_value(int_) { }
 
	constexpr OverflowSafeInt(const T int_) : m_value(int_) { }
 

	
 
	inline constexpr OverflowSafeInt& operator = (const OverflowSafeInt& other) { this->m_value = other.m_value; return *this; }
 
	inline constexpr OverflowSafeInt& operator = (T other) { this->m_value = other; return *this; }
 

	
 
	inline constexpr OverflowSafeInt operator - () const { return OverflowSafeInt(this->m_value == T_MIN ? T_MAX : -this->m_value); }
 

	
 
@@ -174,7 +175,7 @@ public:
 
	inline constexpr bool operator <  (const int other) const { return !(*this >= other); }
 
	inline constexpr bool operator <= (const int other) const { return !(*this > other); }
 

	
 
	inline constexpr operator int64 () const { return this->m_value; }
 
	inline constexpr operator T () const { return this->m_value; }
 
};
 

	
 

	
src/economy.cpp
Show inline comments
 
@@ -315,7 +315,7 @@ void ChangeOwnershipOfCompanyItems(Owner
 
			for (i = 0; i < 4; i++) {
 
				if (c->share_owners[i] == old_owner) {
 
					/* Sell its shares */
 
					CommandCost res = Command<CMD_SELL_SHARE_IN_COMPANY>::Do(DC_EXEC | DC_BANKRUPT, 0, c->index, 0, {});
 
					CommandCost res = Command<CMD_SELL_SHARE_IN_COMPANY>::Do(DC_EXEC | DC_BANKRUPT, c->index);
 
					/* Because we are in a DoCommand, we can't just execute another one and
 
					 *  expect the money to be removed. We need to do it ourself! */
 
					SubtractMoneyFromCompany(res);
 
@@ -335,7 +335,7 @@ void ChangeOwnershipOfCompanyItems(Owner
 
			} else {
 
				cur_company2.Change(c->share_owners[i]);
 
				/* Sell the shares */
 
				CommandCost res = Command<CMD_SELL_SHARE_IN_COMPANY>::Do(DC_EXEC | DC_BANKRUPT, 0, old_owner, 0, {});
 
				CommandCost res = Command<CMD_SELL_SHARE_IN_COMPANY>::Do(DC_EXEC | DC_BANKRUPT, old_owner);
 
				/* Because we are in a DoCommand, we can't just execute another one and
 
				 *  expect the money to be removed. We need to do it ourself! */
 
				SubtractMoneyFromCompany(res);
 
@@ -2013,16 +2013,12 @@ extern int GetAmountOwnedBy(const Compan
 
/**
 
 * Acquire shares in an opposing company.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param p1 company to buy the shares from
 
 * @param p2 unused
 
 * @param text unused
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdBuyShareInCompany(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdBuyShareInCompany(DoCommandFlag flags, TileIndex tile, CompanyID target_company)
 
{
 
	CommandCost cost(EXPENSES_OTHER);
 
	CompanyID target_company = (CompanyID)p1;
 
	Company *c = Company::GetIfValid(target_company);
 

	
 
	/* Check if buying shares is allowed (protection against modified clients)
 
@@ -2065,15 +2061,11 @@ CommandCost CmdBuyShareInCompany(DoComma
 
/**
 
 * Sell shares in an opposing company.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param p1 company to sell the shares from
 
 * @param p2 unused
 
 * @param text unused
 
 * @param target_company company to sell the shares from
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdSellShareInCompany(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdSellShareInCompany(DoCommandFlag flags, CompanyID target_company)
 
{
 
	CompanyID target_company = (CompanyID)p1;
 
	Company *c = Company::GetIfValid(target_company);
 

	
 
	/* Cannot sell own shares */
 
@@ -2106,15 +2098,11 @@ CommandCost CmdSellShareInCompany(DoComm
 
 * that company.
 
 * @todo currently this only works for AI companies
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param p1 company to buy up
 
 * @param p2 unused
 
 * @param text unused
 
 * @param target_company company to buy up
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdBuyCompany(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdBuyCompany(DoCommandFlag flags, CompanyID target_company)
 
{
 
	CompanyID target_company = (CompanyID)p1;
 
	Company *c = Company::GetIfValid(target_company);
 
	if (c == nullptr) return CMD_ERROR;
 

	
src/economy_cmd.h
Show inline comments
 
@@ -11,10 +11,11 @@
 
#define ECONOMY_CMD_H
 

	
 
#include "command_type.h"
 
#include "company_type.h"
 

	
 
CommandProc CmdBuyShareInCompany;
 
CommandProc CmdSellShareInCompany;
 
CommandProc CmdBuyCompany;
 
CommandCost CmdBuyShareInCompany(DoCommandFlag flags, TileIndex tile, CompanyID target_company);
 
CommandCost CmdSellShareInCompany(DoCommandFlag flags, CompanyID target_company);
 
CommandCost CmdBuyCompany(DoCommandFlag flags, CompanyID target_company);
 

	
 
DEF_CMD_TRAIT(CMD_BUY_SHARE_IN_COMPANY,  CmdBuyShareInCompany,  0, CMDT_MONEY_MANAGEMENT)
 
DEF_CMD_TRAIT(CMD_SELL_SHARE_IN_COMPANY, CmdSellShareInCompany, 0, CMDT_MONEY_MANAGEMENT)
src/fios_gui.cpp
Show inline comments
 
@@ -359,7 +359,7 @@ public:
 
		/* pause is only used in single-player, non-editor mode, non-menu mode. It
 
		 * will be unpaused in the WE_DESTROY event handler. */
 
		if (_game_mode != GM_MENU && !_networking && _game_mode != GM_EDITOR) {
 
			Command<CMD_PAUSE>::Post(0, PM_PAUSED_SAVELOAD, 1, {});
 
			Command<CMD_PAUSE>::Post(PM_PAUSED_SAVELOAD, true);
 
		}
 
		SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
 

	
 
@@ -403,7 +403,7 @@ public:
 
	{
 
		/* pause is only used in single-player, non-editor mode, non menu mode */
 
		if (!_networking && _game_mode != GM_EDITOR && _game_mode != GM_MENU) {
 
			Command<CMD_PAUSE>::Post(0, PM_PAUSED_SAVELOAD, 0, {});
 
			Command<CMD_PAUSE>::Post(PM_PAUSED_SAVELOAD, false);
 
		}
 
		this->Window::Close();
 
	}
src/highscore_gui.cpp
Show inline comments
 
@@ -97,7 +97,7 @@ struct EndGameWindow : EndGameHighScoreB
 
	EndGameWindow(WindowDesc *desc) : EndGameHighScoreBaseWindow(desc)
 
	{
 
		/* Pause in single-player to have a look at the highscore at your own leisure */
 
		if (!_networking) Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
 
		if (!_networking) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
 

	
 
		this->background_img = SPR_TYCOON_IMG1_BEGIN;
 

	
 
@@ -125,7 +125,7 @@ struct EndGameWindow : EndGameHighScoreB
 

	
 
	void Close() override
 
	{
 
		if (!_networking) Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 0, {}); // unpause
 
		if (!_networking) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, false); // unpause
 
		ShowHighscoreTable(this->window_number, this->rank);
 
		this->EndGameHighScoreBaseWindow::Close();
 
	}
 
@@ -160,7 +160,7 @@ struct HighScoreWindow : EndGameHighScor
 
	{
 
		/* pause game to show the chart */
 
		this->game_paused_by_player = _pause_mode == PM_PAUSED_NORMAL;
 
		if (!_networking && !this->game_paused_by_player) Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
 
		if (!_networking && !this->game_paused_by_player) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
 

	
 
		/* Close all always on-top windows to get a clean screen */
 
		if (_game_mode != GM_MENU) HideVitalWindows();
 
@@ -175,7 +175,7 @@ struct HighScoreWindow : EndGameHighScor
 
	{
 
		if (_game_mode != GM_MENU) ShowVitalWindows();
 

	
 
		if (!_networking && !this->game_paused_by_player) Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 0, {}); // unpause
 
		if (!_networking && !this->game_paused_by_player) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, false); // unpause
 

	
 
		this->EndGameHighScoreBaseWindow::Close();
 
	}
src/linkgraph/linkgraphschedule.cpp
Show inline comments
 
@@ -174,7 +174,7 @@ void StateGameLoop_LinkGraphPauseControl
 
	if (_pause_mode & PM_PAUSED_LINK_GRAPH) {
 
		/* We are paused waiting on a job, check the job every tick. */
 
		if (!LinkGraphSchedule::instance.IsJoinWithUnfinishedJobDue()) {
 
			Command<CMD_PAUSE>::Post(0, PM_PAUSED_LINK_GRAPH, 0, {});
 
			Command<CMD_PAUSE>::Post(PM_PAUSED_LINK_GRAPH, false);
 
		}
 
	} else if (_pause_mode == PM_UNPAUSED &&
 
			_date_fract == LinkGraphSchedule::SPAWN_JOIN_TICK - 2 &&
 
@@ -182,7 +182,7 @@ void StateGameLoop_LinkGraphPauseControl
 
			LinkGraphSchedule::instance.IsJoinWithUnfinishedJobDue()) {
 
		/* Perform check two _date_fract ticks before we would join, to make
 
		 * sure it also works in multiplayer. */
 
		Command<CMD_PAUSE>::Post(0, PM_PAUSED_LINK_GRAPH, 1, {});
 
		Command<CMD_PAUSE>::Post(PM_PAUSED_LINK_GRAPH, true);
 
	}
 
}
 

	
src/livery.h
Show inline comments
 
@@ -17,7 +17,7 @@ static const byte LIT_COMPANY = 1; ///< 
 
static const byte LIT_ALL     = 2; ///< Show the liveries of all companies
 

	
 
/** List of different livery schemes. */
 
enum LiveryScheme {
 
enum LiveryScheme : byte {
 
	LS_BEGIN = 0,
 
	LS_DEFAULT = 0,
 

	
src/main_gui.cpp
Show inline comments
 
@@ -327,7 +327,7 @@ struct MainWindow : Window
 

	
 
			case GHK_MONEY: // Gimme money
 
				/* You can only cheat for money in singleplayer mode. */
 
				if (!_networking) Command<CMD_MONEY_CHEAT>::Post(0, 10000000, 0, {});
 
				if (!_networking) Command<CMD_MONEY_CHEAT>::Post(10000000);
 
				break;
 

	
 
			case GHK_UPDATE_COORDS: // Update the coordinates of all station signs
src/misc/endian_buffer.hpp
Show inline comments
 
@@ -14,6 +14,7 @@
 
#include <string_view>
 
#include "../core/span_type.hpp"
 
#include "../core/bitmath_func.hpp"
 
#include "../core/overflowsafe_type.hpp"
 

	
 
struct StrongTypedefBase;
 

	
 
@@ -37,6 +38,9 @@ public:
 
	EndianBufferWriter &operator <<(std::string_view data) { this->Write(data); return *this; }
 
	EndianBufferWriter &operator <<(bool data) { return *this << static_cast<byte>(data ? 1 : 0); }
 

	
 
	template <typename T>
 
	EndianBufferWriter &operator <<(const OverflowSafeInt<T> &data) { return *this << static_cast<T>(data); };
 

	
 
	template <typename... Targs>
 
	EndianBufferWriter &operator <<(const std::tuple<Targs...> &data)
 
	{
 
@@ -127,6 +131,9 @@ public:
 
	EndianBufferReader &operator >>(std::string &data) { data = this->ReadStr(); return *this; }
 
	EndianBufferReader &operator >>(bool &data) { data = this->Read<byte>() != 0; return *this; }
 

	
 
	template <typename T>
 
	EndianBufferReader &operator >>(OverflowSafeInt<T> &data) { data = this->Read<T>(); return *this; };
 

	
 
	template <typename... Targs>
 
	EndianBufferReader &operator >>(std::tuple<Targs...> &data)
 
	{
src/misc_cmd.cpp
Show inline comments
 
@@ -28,22 +28,16 @@
 

	
 
#include "safeguards.h"
 

	
 
/* Make sure we can discard lower 2 bits of 64bit amount when passing it to Cmd[In|De]creaseLoan() */
 
static_assert((LOAN_INTERVAL & 3) == 0);
 

	
 
/**
 
 * Increase the loan of your company.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 higher half of amount to increase the loan with, multitude of LOAN_INTERVAL. Only used when (p2 & 3) == 2.
 
 * @param p2 (bit 2-31) - lower half of amount (lower 2 bits assumed to be 0)
 
 *           (bit 0-1)  - when 0: loans LOAN_INTERVAL
 
 *                        when 1: loans the maximum loan permitting money (press CTRL),
 
 *                        when 2: loans the amount specified in p1 and p2
 
 * @param text unused
 
 * @param 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 \c amount
 
 * @param amount amount to increase the loan with, multitude of LOAN_INTERVAL. Only used when cmd == LoanCommand::Amount.
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdIncreaseLoan(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdIncreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount)
 
{
 
	Company *c = Company::Get(_current_company);
 

	
 
@@ -53,16 +47,16 @@ CommandCost CmdIncreaseLoan(DoCommandFla
 
	}
 

	
 
	Money loan;
 
	switch (p2 & 3) {
 
	switch (cmd) {
 
		default: return CMD_ERROR; // Invalid method
 
		case 0: // Take some extra loan
 
		case LoanCommand::Interval: // Take some extra loan
 
			loan = LOAN_INTERVAL;
 
			break;
 
		case 1: // Take a loan as big as possible
 
		case LoanCommand::Max: // Take a loan as big as possible
 
			loan = _economy.max_loan - c->current_loan;
 
			break;
 
		case 2: // Take the given amount of loan
 
			loan = ((uint64)p1 << 32) | (p2 & 0xFFFFFFFC);
 
		case LoanCommand::Amount: // Take the given amount of loan
 
			loan = amount;
 
			if (loan < LOAN_INTERVAL || c->current_loan + loan > _economy.max_loan || loan % LOAN_INTERVAL != 0) return CMD_ERROR;
 
			break;
 
	}
 
@@ -82,33 +76,30 @@ CommandCost CmdIncreaseLoan(DoCommandFla
 
/**
 
 * Decrease the loan of your company.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 higher half of amount to decrease the loan with, multitude of LOAN_INTERVAL. Only used when (p2 & 3) == 2.
 
 * @param p2 (bit 2-31) - lower half of amount (lower 2 bits assumed to be 0)
 
 *           (bit 0-1)  - when 0: pays back LOAN_INTERVAL
 
 *                        when 1: pays back the maximum loan permitting money (press CTRL),
 
 *                        when 2: pays back the amount specified in p1 and p2
 
 * @param text unused
 
 * @param 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 \c amount
 
 * @param amount amount to decrease the loan with, multitude of LOAN_INTERVAL. Only used when cmd == LoanCommand::Amount.
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdDecreaseLoan(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdDecreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount)
 
{
 
	Company *c = Company::Get(_current_company);
 

	
 
	if (c->current_loan == 0) return_cmd_error(STR_ERROR_LOAN_ALREADY_REPAYED);
 

	
 
	Money loan;
 
	switch (p2 & 3) {
 
	switch (cmd) {
 
		default: return CMD_ERROR; // Invalid method
 
		case 0: // Pay back one step
 
		case LoanCommand::Interval: // Pay back one step
 
			loan = std::min(c->current_loan, (Money)LOAN_INTERVAL);
 
			break;
 
		case 1: // Pay back as much as possible
 
		case LoanCommand::Max: // Pay back as much as possible
 
			loan = std::max(std::min(c->current_loan, c->money), (Money)LOAN_INTERVAL);
 
			loan -= loan % LOAN_INTERVAL;
 
			break;
 
		case 2: // Repay the given amount of loan
 
			loan = ((uint64)p1 << 32) | (p2 & 0xFFFFFFFC);
 
		case LoanCommand::Amount: // Repay the given amount of loan
 
			loan = amount;
 
			if (loan % LOAN_INTERVAL != 0 || loan < LOAN_INTERVAL || loan > c->current_loan) return CMD_ERROR; // Invalid amount to loan
 
			break;
 
	}
 
@@ -135,7 +126,7 @@ CommandCost CmdDecreaseLoan(DoCommandFla
 
static void AskUnsafeUnpauseCallback(Window *w, bool confirmed)
 
{
 
	if (confirmed) {
 
		Command<CMD_PAUSE>::Post(0, PM_PAUSED_ERROR, 0, {});
 
		Command<CMD_PAUSE>::Post(PM_PAUSED_ERROR, false);
 
	}
 
}
 

	
 
@@ -145,15 +136,13 @@ static void AskUnsafeUnpauseCallback(Win
 
 * unpaused. A bitset is used instead of a boolean value/counter to have
 
 * more control over the game when saving/loading, etc.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 the pause mode to change
 
 * @param p2 1 pauses, 0 unpauses this mode
 
 * @param text unused
 
 * @param mode the pause mode to change
 
 * @param pause true pauses, false unpauses this mode
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdPause(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdPause(DoCommandFlag flags, PauseMode mode, bool pause)
 
{
 
	switch (p1) {
 
	switch (mode) {
 
		case PM_PAUSED_SAVELOAD:
 
		case PM_PAUSED_ERROR:
 
		case PM_PAUSED_NORMAL:
 
@@ -169,7 +158,7 @@ CommandCost CmdPause(DoCommandFlag flags
 
		default: return CMD_ERROR;
 
	}
 
	if (flags & DC_EXEC) {
 
		if (p1 == PM_PAUSED_NORMAL && _pause_mode & PM_PAUSED_ERROR) {
 
		if (mode == PM_PAUSED_NORMAL && _pause_mode & PM_PAUSED_ERROR) {
 
			ShowQuery(
 
				STR_NEWGRF_UNPAUSE_WARNING_TITLE,
 
				STR_NEWGRF_UNPAUSE_WARNING,
 
@@ -179,13 +168,13 @@ CommandCost CmdPause(DoCommandFlag flags
 
		} else {
 
			PauseMode prev_mode = _pause_mode;
 

	
 
			if (p2 == 0) {
 
				_pause_mode = static_cast<PauseMode>(_pause_mode & (byte)~p1);
 
			if (pause) {
 
				_pause_mode |= mode;
 
			} else {
 
				_pause_mode = static_cast<PauseMode>(_pause_mode | (byte)p1);
 
				_pause_mode &= ~mode;
 
			}
 

	
 
			NetworkHandlePauseChange(prev_mode, (PauseMode)p1);
 
			NetworkHandlePauseChange(prev_mode, mode);
 
		}
 

	
 
		SetWindowDirty(WC_STATUS_BAR, 0);
 
@@ -197,33 +186,25 @@ CommandCost CmdPause(DoCommandFlag flags
 
/**
 
 * Change the financial flow of your company.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 the amount of money to receive (if positive), or spend (if negative)
 
 * @param p2 unused
 
 * @param text unused
 
 * @param amount the amount of money to receive (if positive), or spend (if negative)
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdMoneyCheat(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdMoneyCheat(DoCommandFlag flags, Money amount)
 
{
 
	return CommandCost(EXPENSES_OTHER, -(int32)p1);
 
	return CommandCost(EXPENSES_OTHER, -amount);
 
}
 

	
 
/**
 
 * Change the bank bank balance of a company by inserting or removing money without affecting the loan.
 
 * @param flags operation to perform
 
 * @param tile tile to show text effect on (if not 0)
 
 * @param p1 the amount of money to receive (if positive), or spend (if negative)
 
 * @param p2 (bit 0-7)  - the company ID.
 
 *           (bit 8-15) - the expenses type which should register the cost/income @see ExpensesType.
 
 * @param text unused
 
 * @param delta the amount of money to receive (if positive), or spend (if negative)
 
 * @param company the company ID.
 
 * @param expenses_type the expenses type which should register the cost/income @see ExpensesType.
 
 * @return zero cost or an error
 
 */
 
CommandCost CmdChangeBankBalance(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdChangeBankBalance(DoCommandFlag flags, TileIndex tile, Money delta, CompanyID company, ExpensesType expenses_type)
 
{
 
	int32 delta = (int32)p1;
 
	CompanyID company = (CompanyID) GB(p2, 0, 8);
 
	ExpensesType expenses_type = Extract<ExpensesType, 8, 8>(p2);
 

	
 
	if (!Company::IsValidID(company)) return CMD_ERROR;
 
	if (expenses_type >= EXPENSES_END) return CMD_ERROR;
 
	if (_current_company != OWNER_DEITY) return CMD_ERROR;
src/misc_cmd.h
Show inline comments
 
@@ -11,12 +11,21 @@
 
#define MISC_CMD_H
 

	
 
#include "command_type.h"
 
#include "economy_type.h"
 

	
 
CommandProc CmdMoneyCheat;
 
CommandProc CmdChangeBankBalance;
 
CommandProc CmdIncreaseLoan;
 
CommandProc CmdDecreaseLoan;
 
CommandProc CmdPause;
 
enum PauseMode : byte;
 

	
 
enum class LoanCommand : byte {
 
	Interval,
 
	Max,
 
	Amount,
 
};
 

	
 
CommandCost CmdMoneyCheat(DoCommandFlag flags, Money amount);
 
CommandCost CmdChangeBankBalance(DoCommandFlag flags, TileIndex tile, Money delta, CompanyID company, ExpensesType expenses_type);
 
CommandCost CmdIncreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount);
 
CommandCost CmdDecreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount);
 
CommandCost CmdPause(DoCommandFlag flags, PauseMode mode, bool pause);
 

	
 
DEF_CMD_TRAIT(CMD_MONEY_CHEAT,         CmdMoneyCheat,        CMD_OFFLINE,             CMDT_CHEAT)
 
DEF_CMD_TRAIT(CMD_CHANGE_BANK_BALANCE, CmdChangeBankBalance, CMD_DEITY,               CMDT_MONEY_MANAGEMENT)
src/network/network.cpp
Show inline comments
 
@@ -395,7 +395,7 @@ static void CheckPauseHelper(bool pause,
 
{
 
	if (pause == ((_pause_mode & pm) != PM_UNPAUSED)) return;
 

	
 
	Command<CMD_PAUSE>::Post(0, pm, pause ? 1 : 0, {});
 
	Command<CMD_PAUSE>::Post(pm, pause);
 
}
 

	
 
/**
 
@@ -1128,7 +1128,7 @@ void NetworkGameLoop()
 
				cp = new CommandPacket();
 
				cp->company = COMPANY_SPECTATOR;
 
				cp->cmd = CMD_PAUSE;
 
				cp->data = EndianBufferWriter<>::FromValue(CommandTraits<CMD_PAUSE>::Args{ 0, PM_PAUSED_NORMAL, 1, "" });
 
				cp->data = EndianBufferWriter<>::FromValue(CommandTraits<CMD_PAUSE>::Args{ PM_PAUSED_NORMAL, true });
 
				_ddc_fastforward = false;
 
			} else if (strncmp(p, "sync: ", 6) == 0) {
 
				int ret = sscanf(p + 6, "%x; %x; %x; %x", &next_date, &next_date_fract, &sync_state[0], &sync_state[1]);
src/network/network_server.cpp
Show inline comments
 
@@ -2081,7 +2081,7 @@ void NetworkServerNewCompany(const Compa
 
		/* ci is nullptr when replaying, or for AIs. In neither case there is a client. */
 
		ci->client_playas = c->index;
 
		NetworkUpdateClientInfo(ci->client_id);
 
		Command<CMD_RENAME_PRESIDENT>::SendNet(STR_NULL, nullptr, c->index, 0, 0, 0, ci->client_name);
 
		Command<CMD_RENAME_PRESIDENT>::SendNet(STR_NULL, nullptr, c->index, ci->client_name);
 
	}
 

	
 
	/* Announce new company on network. */
src/news_cmd.h
Show inline comments
 
@@ -11,8 +11,10 @@
 
#define NEWS_CMD_H
 

	
 
#include "command_type.h"
 
#include "company_type.h"
 
#include "news_type.h"
 

	
 
CommandProc CmdCustomNewsItem;
 
CommandCost CmdCustomNewsItem(DoCommandFlag flags, NewsType type, NewsReferenceType reftype1, CompanyID company, uint32 reference, const std::string &text);
 

	
 
DEF_CMD_TRAIT(CMD_CUSTOM_NEWS_ITEM, CmdCustomNewsItem, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT)
 

	
src/news_gui.cpp
Show inline comments
 
@@ -837,23 +837,17 @@ void AddNewsItem(StringID string, NewsTy
 
/**
 
 * Create a new custom news item.
 
 * @param flags type of operation
 
 * @param tile unused
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 -  7) - NewsType of the message.
 
 * - p1 = (bit  8 - 15) - NewsReferenceType of first reference.
 
 * - p1 = (bit 16 - 23) - Company this news message is for.
 
 * @param p2 First reference of the news message.
 
 * @aram type NewsType of the message.
 
 * @param reftype1 NewsReferenceType of first reference.
 
 * @param company Company this news message is for.
 
 * @param reference First reference of the news message.
 
 * @param text The text of the news message.
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdCustomNewsItem(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdCustomNewsItem(DoCommandFlag flags, NewsType type, NewsReferenceType reftype1, CompanyID company, uint32 reference, const std::string &text)
 
{
 
	if (_current_company != OWNER_DEITY) return CMD_ERROR;
 

	
 
	NewsType type = (NewsType)GB(p1, 0, 8);
 
	NewsReferenceType reftype1 = (NewsReferenceType)GB(p1, 8, 8);
 
	CompanyID company = (CompanyID)GB(p1, 16, 8);
 

	
 
	if (company != INVALID_OWNER && !Company::IsValidID(company)) return CMD_ERROR;
 
	if (type >= NT_END) return CMD_ERROR;
 
	if (text.empty()) return CMD_ERROR;
 
@@ -861,27 +855,27 @@ CommandCost CmdCustomNewsItem(DoCommandF
 
	switch (reftype1) {
 
		case NR_NONE: break;
 
		case NR_TILE:
 
			if (!IsValidTile(p2)) return CMD_ERROR;
 
			if (!IsValidTile(reference)) return CMD_ERROR;
 
			break;
 

	
 
		case NR_VEHICLE:
 
			if (!Vehicle::IsValidID(p2)) return CMD_ERROR;
 
			if (!Vehicle::IsValidID(reference)) return CMD_ERROR;
 
			break;
 

	
 
		case NR_STATION:
 
			if (!Station::IsValidID(p2)) return CMD_ERROR;
 
			if (!Station::IsValidID(reference)) return CMD_ERROR;
 
			break;
 

	
 
		case NR_INDUSTRY:
 
			if (!Industry::IsValidID(p2)) return CMD_ERROR;
 
			if (!Industry::IsValidID(reference)) return CMD_ERROR;
 
			break;
 

	
 
		case NR_TOWN:
 
			if (!Town::IsValidID(p2)) return CMD_ERROR;
 
			if (!Town::IsValidID(reference)) return CMD_ERROR;
 
			break;
 

	
 
		case NR_ENGINE:
 
			if (!Engine::IsValidID(p2)) return CMD_ERROR;
 
			if (!Engine::IsValidID(reference)) return CMD_ERROR;
 
			break;
 

	
 
		default: return CMD_ERROR;
 
@@ -892,7 +886,7 @@ CommandCost CmdCustomNewsItem(DoCommandF
 
	if (flags & DC_EXEC) {
 
		NewsStringData *news = new NewsStringData(text);
 
		SetDParamStr(0, news->string);
 
		AddNewsItem(STR_NEWS_CUSTOM_ITEM, type, NF_NORMAL, reftype1, p2, NR_NONE, UINT32_MAX, news);
 
		AddNewsItem(STR_NEWS_CUSTOM_ITEM, type, NF_NORMAL, reftype1, reference, NR_NONE, UINT32_MAX, news);
 
	}
 

	
 
	return CommandCost();
src/news_type.h
Show inline comments
 
@@ -18,7 +18,7 @@
 
/**
 
 * Type of news.
 
 */
 
enum NewsType {
 
enum NewsType : byte {
 
	NT_ARRIVAL_COMPANY, ///< First vehicle arrived for company
 
	NT_ARRIVAL_OTHER,   ///< First vehicle arrived for competitor
 
	NT_ACCIDENT,        ///< An accident or disaster has occurred
 
@@ -47,7 +47,7 @@ enum NewsType {
 
 * You have to make sure, #ChangeVehicleNews catches the DParams of your message.
 
 * This is NOT ensured by the references.
 
 */
 
enum NewsReferenceType {
 
enum NewsReferenceType : byte {
 
	NR_NONE,      ///< Empty reference
 
	NR_TILE,      ///< Reference tile.     Scroll to tile when clicking on the news.
 
	NR_VEHICLE,   ///< Reference vehicle.  Scroll to vehicle when clicking on the news. Delete news when vehicle is deleted.
src/openttd.cpp
Show inline comments
 
@@ -852,7 +852,7 @@ static void MakeNewGameDone()
 
	/* In a dedicated server, the server does not play */
 
	if (!VideoDriver::GetInstance()->HasGUI()) {
 
		OnStartGame(true);
 
		if (_settings_client.gui.pause_on_newgame) Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
 
		if (_settings_client.gui.pause_on_newgame) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
 
		return;
 
	}
 

	
 
@@ -881,7 +881,7 @@ static void MakeNewGameDone()
 
		NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
 
	}
 

	
 
	if (_settings_client.gui.pause_on_newgame) Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
 
	if (_settings_client.gui.pause_on_newgame) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
 

	
 
	CheckEngines();
 
	CheckIndustries();
 
@@ -1046,7 +1046,7 @@ void SwitchToMode(SwitchMode new_mode)
 
				}
 
				OnStartGame(_network_dedicated);
 
				/* Decrease pause counter (was increased from opening load dialog) */
 
				Command<CMD_PAUSE>::Post(0, PM_PAUSED_SAVELOAD, 0, {});
 
				Command<CMD_PAUSE>::Post(PM_PAUSED_SAVELOAD, false);
 
			}
 
			break;
 
		}
 
@@ -1068,7 +1068,7 @@ void SwitchToMode(SwitchMode new_mode)
 
				SetLocalCompany(OWNER_NONE);
 
				_settings_newgame.game_creation.starting_year = _cur_year;
 
				/* Cancel the saveload pausing */
 
				Command<CMD_PAUSE>::Post(0, PM_PAUSED_SAVELOAD, 0, {});
 
				Command<CMD_PAUSE>::Post(PM_PAUSED_SAVELOAD, false);
 
			} else {
 
				SetDParamStr(0, GetSaveLoadErrorString());
 
				ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
src/script/api/script_company.cpp
Show inline comments
 
@@ -52,7 +52,7 @@
 
	EnforcePreconditionEncodedText(false, text);
 
	EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_COMPANY_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
 

	
 
	return ScriptObject::Command<CMD_RENAME_COMPANY>::Do(0, 0, 0, text);
 
	return ScriptObject::Command<CMD_RENAME_COMPANY>::Do(text);
 
}
 

	
 
/* static */ char *ScriptCompany::GetName(ScriptCompany::CompanyID company)
 
@@ -73,7 +73,7 @@
 
	EnforcePreconditionEncodedText(false, text);
 
	EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_PRESIDENT_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
 

	
 
	return ScriptObject::Command<CMD_RENAME_PRESIDENT>::Do(0, 0, 0, text);
 
	return ScriptObject::Command<CMD_RENAME_PRESIDENT>::Do(text);
 
}
 

	
 
/* static */ char *ScriptCompany::GetPresidentName(ScriptCompany::CompanyID company)
 
@@ -101,7 +101,7 @@
 
	GenderEthnicity ge = (GenderEthnicity)((gender == GENDER_FEMALE ? (1 << ::GENDER_FEMALE) : 0) | (::InteractiveRandom() & (1 << ETHNICITY_BLACK)));
 
	RandomCompanyManagerFaceBits(cmf, ge, false);
 

	
 
	return ScriptObject::Command<CMD_SET_COMPANY_MANAGER_FACE>::Do(0, 0, cmf, {});
 
	return ScriptObject::Command<CMD_SET_COMPANY_MANAGER_FACE>::Do(cmf);
 
}
 

	
 
/* static */ ScriptCompany::Gender ScriptCompany::GetPresidentGender(CompanyID company)
 
@@ -211,9 +211,9 @@
 
	Money amount = abs(loan - GetLoanAmount());
 

	
 
	if (loan > GetLoanAmount()) {
 
		return ScriptObject::Command<CMD_INCREASE_LOAN>::Do(0, amount >> 32, (amount & 0xFFFFFFFC) | 2, {});
 
		return ScriptObject::Command<CMD_INCREASE_LOAN>::Do(LoanCommand::Amount, amount);
 
	} else {
 
		return ScriptObject::Command<CMD_DECREASE_LOAN>::Do(0, amount >> 32, (amount & 0xFFFFFFFC) | 2, {});
 
		return ScriptObject::Command<CMD_DECREASE_LOAN>::Do(LoanCommand::Amount, amount);
 
	}
 
}
 

	
 
@@ -244,7 +244,7 @@
 
	EnforcePrecondition(false, company != COMPANY_INVALID);
 

	
 
	/* Network commands only allow 0 to indicate invalid tiles, not INVALID_TILE */
 
	return ScriptObject::Command<CMD_CHANGE_BANK_BALANCE>::Do(tile == INVALID_TILE ? (TileIndex)0U : tile, (uint32)(delta), company | expenses_type << 8, {});
 
	return ScriptObject::Command<CMD_CHANGE_BANK_BALANCE>::Do(tile == INVALID_TILE ? (TileIndex)0U : tile, delta, (::CompanyID)company, (::ExpensesType)expenses_type);
 
}
 

	
 
/* static */ bool ScriptCompany::BuildCompanyHQ(TileIndex tile)
 
@@ -266,7 +266,7 @@
 

	
 
/* static */ bool ScriptCompany::SetAutoRenewStatus(bool autorenew)
 
{
 
	return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do(0, 0, autorenew ? 1 : 0, "company.engine_renew");
 
	return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do("company.engine_renew", autorenew ? 1 : 0);
 
}
 

	
 
/* static */ bool ScriptCompany::GetAutoRenewStatus(CompanyID company)
 
@@ -279,7 +279,7 @@
 

	
 
/* static */ bool ScriptCompany::SetAutoRenewMonths(int16 months)
 
{
 
	return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do(0, 0, months, "company.engine_renew_months");
 
	return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do("company.engine_renew_months", months);
 
}
 

	
 
/* static */ int16 ScriptCompany::GetAutoRenewMonths(CompanyID company)
 
@@ -294,7 +294,7 @@
 
{
 
	EnforcePrecondition(false, money >= 0);
 
	EnforcePrecondition(false, (int64)money <= UINT32_MAX);
 
	return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do(0, 0, money, "company.engine_renew_money");
 
	return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do("company.engine_renew_money", money);
 
}
 

	
 
/* static */ Money ScriptCompany::GetAutoRenewMoney(CompanyID company)
 
@@ -307,12 +307,12 @@
 

	
 
/* static */ bool ScriptCompany::SetPrimaryLiveryColour(LiveryScheme scheme, Colours colour)
 
{
 
	return ScriptObject::Command<CMD_SET_COMPANY_COLOUR>::Do(0, scheme, colour, {});
 
	return ScriptObject::Command<CMD_SET_COMPANY_COLOUR>::Do((::LiveryScheme)scheme, true, (::Colours)colour);
 
}
 

	
 
/* static */ bool ScriptCompany::SetSecondaryLiveryColour(LiveryScheme scheme, Colours colour)
 
{
 
	return ScriptObject::Command<CMD_SET_COMPANY_COLOUR>::Do(0, scheme | 1 << 8, colour, {});
 
	return ScriptObject::Command<CMD_SET_COMPANY_COLOUR>::Do((::LiveryScheme)scheme, false, (::Colours)colour);
 
}
 

	
 
/* static */ ScriptCompany::Colours ScriptCompany::GetPrimaryLiveryColour(ScriptCompany::LiveryScheme scheme)
src/script/api/script_controller.cpp
Show inline comments
 
@@ -60,7 +60,7 @@
 
	ShowAIDebugWindow(ScriptObject::GetRootCompany());
 

	
 
	if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
 
		ScriptObject::Command<CMD_PAUSE>::Do(0, PM_PAUSED_NORMAL, 1, {});
 
		ScriptObject::Command<CMD_PAUSE>::Do(PM_PAUSED_NORMAL, true);
 
	}
 
}
 

	
src/script/api/script_event_types.cpp
Show inline comments
 
@@ -117,7 +117,7 @@ bool ScriptEventEnginePreview::AcceptPre
 

	
 
bool ScriptEventCompanyAskMerger::AcceptMerger()
 
{
 
	return ScriptObject::Command<CMD_BUY_COMPANY>::Do(0, this->owner, 0, {});
 
	return ScriptObject::Command<CMD_BUY_COMPANY>::Do((::CompanyID)this->owner);
 
}
 

	
 
ScriptEventAdminPort::ScriptEventAdminPort(const std::string &json) :
src/script/api/script_game.cpp
Show inline comments
 
@@ -18,12 +18,12 @@
 

	
 
/* static */ bool ScriptGame::Pause()
 
{
 
	return ScriptObject::Command<CMD_PAUSE>::Do(0, PM_PAUSED_GAME_SCRIPT, 1, {});
 
	return ScriptObject::Command<CMD_PAUSE>::Do(PM_PAUSED_GAME_SCRIPT, true);
 
}
 

	
 
/* static */ bool ScriptGame::Unpause()
 
{
 
	return ScriptObject::Command<CMD_PAUSE>::Do(0, PM_PAUSED_GAME_SCRIPT, 0, {});
 
	return ScriptObject::Command<CMD_PAUSE>::Do(PM_PAUSED_GAME_SCRIPT, false);
 
}
 

	
 
/* static */ bool ScriptGame::IsPaused()
src/script/api/script_gamesettings.cpp
Show inline comments
 
@@ -38,7 +38,7 @@
 

	
 
	if ((sd->flags & SF_NO_NETWORK_SYNC) != 0) return false;
 

	
 
	return ScriptObject::Command<CMD_CHANGE_SETTING>::Do(0, 0, value, sd->GetName());
 
	return ScriptObject::Command<CMD_CHANGE_SETTING>::Do(sd->GetName(), value);
 
}
 

	
 
/* static */ bool ScriptGameSettings::IsDisabledVehicleType(ScriptVehicle::VehicleType vehicle_type)
src/script/api/script_group.cpp
Show inline comments
 
@@ -130,7 +130,7 @@
 
{
 
	if (HasWagonRemoval() == enable_removal) return true;
 

	
 
	return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do(0, 0, enable_removal ? 1 : 0, "company.renew_keep_length");
 
	return ScriptObject::Command<CMD_CHANGE_COMPANY_SETTING>::Do("company.renew_keep_length", enable_removal ? 1 : 0);
 
}
 

	
 
/* static */ bool ScriptGroup::HasWagonRemoval()
src/script/api/script_news.cpp
Show inline comments
 
@@ -39,5 +39,5 @@
 
	if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY;
 

	
 
	if (ref_type == NR_NONE) reference = 0;
 
	return ScriptObject::Command<CMD_CUSTOM_NEWS_ITEM>::Do(0, type | (ref_type << 8) | (c << 16), reference, encoded);
 
	return ScriptObject::Command<CMD_CUSTOM_NEWS_ITEM>::Do((::NewsType)type, (::NewsReferenceType)ref_type, (::CompanyID)c, reference, encoded);
 
}
src/script/api/script_subsidy.cpp
Show inline comments
 
@@ -39,7 +39,7 @@
 
	EnforcePrecondition(false, (from_type == SPT_INDUSTRY && ScriptIndustry::IsValidIndustry(from_id)) || (from_type == SPT_TOWN && ScriptTown::IsValidTown(from_id)));
 
	EnforcePrecondition(false, (to_type == SPT_INDUSTRY && ScriptIndustry::IsValidIndustry(to_id)) || (to_type == SPT_TOWN && ScriptTown::IsValidTown(to_id)));
 

	
 
	return ScriptObject::Command<CMD_CREATE_SUBSIDY>::Do(0, from_type | (from_id << 8) | (cargo_type << 24), to_type | (to_id << 8), {});
 
	return ScriptObject::Command<CMD_CREATE_SUBSIDY>::Do(cargo_type, (::SourceType)from_type, from_id, (::SourceType)to_type, to_id);
 
}
 

	
 
/* static */ ScriptCompany::CompanyID ScriptSubsidy::GetAwardedTo(SubsidyID subsidy_id)
src/settings.cpp
Show inline comments
 
@@ -1487,18 +1487,16 @@ const SettingDesc *GetSettingFromName(co
 
/**
 
 * Network-safe changing of settings (server-only).
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 the new value for the setting
 
 * @param name the name of the setting to change
 
 * @param value the new value for the setting
 
 * The new value is properly clamped to its minimum/maximum when setting
 
 * @param text the name of the setting to change
 
 * @return the cost of this operation or an error
 
 * @see _settings
 
 */
 
CommandCost CmdChangeSetting(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdChangeSetting(DoCommandFlag flags, const std::string &name, int32 value)
 
{
 
	if (text.empty()) return CMD_ERROR;
 
	const SettingDesc *sd = GetSettingFromName(text);
 
	if (name.empty()) return CMD_ERROR;
 
	const SettingDesc *sd = GetSettingFromName(name);
 

	
 
	if (sd == nullptr) return CMD_ERROR;
 
	if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) return CMD_ERROR;
 
@@ -1507,7 +1505,7 @@ CommandCost CmdChangeSetting(DoCommandFl
 
	if (!sd->IsEditable(true)) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		sd->AsIntSetting()->ChangeValue(&GetGameSettings(), p2);
 
		sd->AsIntSetting()->ChangeValue(&GetGameSettings(), value);
 
	}
 

	
 
	return CommandCost();
 
@@ -1516,23 +1514,21 @@ CommandCost CmdChangeSetting(DoCommandFl
 
/**
 
 * Change one of the per-company settings.
 
 * @param flags operation to perform
 
 * @param tile unused
 
 * @param p1 unused
 
 * @param p2 the new value for the setting
 
 * @param name the name of the company setting to change
 
 * @param value the new value for the setting
 
 * The new value is properly clamped to its minimum/maximum when setting
 
 * @param text the name of the company setting to change
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdChangeCompanySetting(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdChangeCompanySetting(DoCommandFlag flags, const std::string &name, int32 value)
 
{
 
	if (text.empty()) return CMD_ERROR;
 
	const SettingDesc *sd = GetCompanySettingFromName(text.c_str());
 
	if (name.empty()) return CMD_ERROR;
 
	const SettingDesc *sd = GetCompanySettingFromName(name);
 

	
 
	if (sd == nullptr) return CMD_ERROR;
 
	if (!sd->IsIntSetting()) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		sd->AsIntSetting()->ChangeValue(&Company::Get(_current_company)->settings, p2);
 
		sd->AsIntSetting()->ChangeValue(&Company::Get(_current_company)->settings, value);
 
	}
 

	
 
	return CommandCost();
 
@@ -1550,7 +1546,7 @@ bool SetSettingValue(const IntSettingDes
 
	const IntSettingDesc *setting = sd->AsIntSetting();
 
	if ((setting->flags & SF_PER_COMPANY) != 0) {
 
		if (Company::IsValidID(_local_company) && _game_mode != GM_MENU) {
 
			return Command<CMD_CHANGE_COMPANY_SETTING>::Post(0, 0, value, setting->GetName());
 
			return Command<CMD_CHANGE_COMPANY_SETTING>::Post(setting->GetName(), value);
 
		}
 

	
 
		setting->ChangeValue(&_settings_client.company, value);
 
@@ -1576,7 +1572,7 @@ bool SetSettingValue(const IntSettingDes
 

	
 
	/* send non-company-based settings over the network */
 
	if (!_networking || (_networking && _network_server)) {
 
		return Command<CMD_CHANGE_SETTING>::Post(0, 0, value, setting->GetName());
 
		return Command<CMD_CHANGE_SETTING>::Post(setting->GetName(), value);
 
	}
 
	return false;
 
}
 
@@ -1604,7 +1600,7 @@ void SyncCompanySettings()
 
		const SettingDesc *sd = GetSettingDesc(desc);
 
		uint32 old_value = (uint32)sd->AsIntSetting()->Read(new_object);
 
		uint32 new_value = (uint32)sd->AsIntSetting()->Read(old_object);
 
		if (old_value != new_value) Command<CMD_CHANGE_COMPANY_SETTING>::SendNet(STR_NULL, nullptr, _local_company, 0, 0, new_value, sd->GetName());
 
		if (old_value != new_value) Command<CMD_CHANGE_COMPANY_SETTING>::SendNet(STR_NULL, nullptr, _local_company, sd->GetName(), new_value);
 
	}
 
}
 

	
src/settings_cmd.h
Show inline comments
 
@@ -12,8 +12,8 @@
 

	
 
#include "command_type.h"
 

	
 
CommandProc CmdChangeSetting;
 
CommandProc CmdChangeCompanySetting;
 
CommandCost CmdChangeSetting(DoCommandFlag flags, const std::string &name, int32 value);
 
CommandCost CmdChangeCompanySetting(DoCommandFlag flags, const std::string &name, int32 value);
 

	
 
DEF_CMD_TRAIT(CMD_CHANGE_SETTING,         CmdChangeSetting,        CMD_SERVER, CMDT_SERVER_SETTING)
 
DEF_CMD_TRAIT(CMD_CHANGE_COMPANY_SETTING, CmdChangeCompanySetting, 0,          CMDT_COMPANY_SETTING)
src/subsidy.cpp
Show inline comments
 
@@ -232,27 +232,17 @@ void CreateSubsidy(CargoID cid, SourceTy
 
/**
 
 * Create a new subsidy.
 
 * @param flags type of operation
 
 * @param tile unused.
 
 * @param p1 various bitstuffed elements
 
 * - p1 = (bit  0 -  7) - SourceType of source.
 
 * - p1 = (bit  8 - 23) - SourceID of source.
 
 * - p1 = (bit 24 - 31) - CargoID of subsidy.
 
 * @param p2 various bitstuffed elements
 
 * - p2 = (bit  0 -  7) - SourceType of destination.
 
 * - p2 = (bit  8 - 23) - SourceID of destination.
 
 * @param text unused.
 
 * @param cid CargoID of subsidy.
 
 * @param src_type SourceType of source.
 
 * @param src SourceID of source.
 
 * @param dst_type SourceType of destination.
 
 * @param dst SourceID of destination.
 
 * @return the cost of this operation or an error
 
 */
 
CommandCost CmdCreateSubsidy(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
 
CommandCost CmdCreateSubsidy(DoCommandFlag flags, CargoID cid, SourceType src_type, SourceID src, SourceType dst_type, SourceID dst)
 
{
 
	if (!Subsidy::CanAllocateItem()) return CMD_ERROR;
 

	
 
	CargoID cid = GB(p1, 24, 8);
 
	SourceType src_type = (SourceType)GB(p1, 0, 8);
 
	SourceID src = GB(p1, 8, 16);
 
	SourceType dst_type = (SourceType)GB(p2, 0, 8);
 
	SourceID dst = GB(p2, 8, 16);
 

	
 
	if (_current_company != OWNER_DEITY) return CMD_ERROR;
 

	
 
	if (cid >= NUM_CARGO || !::CargoSpec::Get(cid)->IsValid()) return CMD_ERROR;
src/subsidy_cmd.h
Show inline comments
 
@@ -11,8 +11,9 @@
 
#define SUBSIDY_CMD_H
 

	
 
#include "command_type.h"
 
#include "cargo_type.h"
 

	
 
CommandProc CmdCreateSubsidy;
 
CommandCost CmdCreateSubsidy(DoCommandFlag flags, CargoID cid, SourceType src_type, SourceID src, SourceType dst_type, SourceID dst);
 

	
 
DEF_CMD_TRAIT(CMD_CREATE_SUBSIDY, CmdCreateSubsidy, CMD_DEITY, CMDT_OTHER_MANAGEMENT)
 

	
src/toolbar_gui.cpp
Show inline comments
 
@@ -266,7 +266,7 @@ static CallBackFunction ToolbarPauseClic
 
{
 
	if (_networking && !_network_server) return CBF_NONE; // only server can pause the game
 

	
 
	if (Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, _pause_mode == PM_UNPAUSED, {})) {
 
	if (Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, _pause_mode == PM_UNPAUSED)) {
 
		if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP);
 
	}
 
	return CBF_NONE;
src/train_cmd.cpp
Show inline comments
 
@@ -88,7 +88,7 @@ void CheckTrainsLengths()
 

	
 
						if (!_networking && first) {
 
							first = false;
 
							Command<CMD_PAUSE>::Post(0, PM_PAUSED_ERROR, 1, {});
 
							Command<CMD_PAUSE>::Post(PM_PAUSED_ERROR, true);
 
						}
 
						/* Break so we warn only once for each train. */
 
						break;
src/vehicle.cpp
Show inline comments
 
@@ -311,7 +311,7 @@ void ShowNewGrfVehicleError(EngineID eng
 
		SetDParamStr(0, grfconfig->GetName());
 
		SetDParam(1, engine);
 
		ShowErrorMessage(part1, part2, WL_CRITICAL);
 
		if (!_networking) Command<CMD_PAUSE>::Do(DC_EXEC, 0, critical ? PM_PAUSED_ERROR : PM_PAUSED_NORMAL, 1, {});
 
		if (!_networking) Command<CMD_PAUSE>::Do(DC_EXEC, critical ? PM_PAUSED_ERROR : PM_PAUSED_NORMAL, true);
 
	}
 

	
 
	/* debug output */
0 comments (0 inline, 0 general)