Add support for money cheat in multiplayer

Add a setting for whether this is permitted by multiplayer clients
This commit is contained in:
Jonathan G Rennison
2020-04-14 22:04:41 +01:00
parent b209b37db9
commit ab99c16601
11 changed files with 80 additions and 11 deletions

View File

@@ -198,6 +198,29 @@ CommandCost CmdPause(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2,
*/
CommandCost CmdMoneyCheat(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (_networking && !_settings_game.difficulty.money_cheat_in_multiplayer) return CMD_ERROR;
if (flags & DC_EXEC) {
_cheats.money.been_used = true;
SetWindowDirty(WC_CHEATS, 0);
}
return CommandCost(EXPENSES_OTHER, -(int32)p1);
}
/**
* Change the financial flow of your company (admin).
* @param tile unused
* @param flags operation to perform
* @param p1 the amount of money to receive (if positive), or spend (if negative)
* @param p2 unused
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdMoneyCheatAdmin(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (flags & DC_EXEC) {
_cheats.money.been_used = true;
SetWindowDirty(WC_CHEATS, 0);
}
return CommandCost(EXPENSES_OTHER, -(int32)p1);
}