Fix #449: Town setting override not being allowed for MP admins

When the setting to enable for clients was not enabled
This commit is contained in:
Jonathan G Rennison
2022-10-31 18:40:47 +00:00
parent 0f697c5501
commit 95a646d09b
4 changed files with 25 additions and 4 deletions

View File

@@ -3809,8 +3809,6 @@ CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
*/
CommandCost CmdOverrideTownSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (_networking && !_settings_game.difficulty.override_town_settings_in_multiplayer) return CMD_ERROR;
Town *t = Town::GetIfValid(p1);
if (t == nullptr) return CMD_ERROR;
@@ -3856,6 +3854,25 @@ CommandCost CmdOverrideTownSetting(TileIndex tile, DoCommandFlag flags, uint32 p
return CommandCost();
}
/**
* Override a town setting (non-admin use)
* @param tile unused
* @param flags type of operation
* @param p1 town to do the action at
* @param p2 various bitstuffed elements
* - p2 = (bit 0 - 7) - what setting to change
* - p2 = (bit 8 - 15) - the data to modify
* - p2 = (bit 16) - whether to override the value, or use the default
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdOverrideTownSettingNonAdmin(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (_networking && !_settings_game.difficulty.override_town_settings_in_multiplayer) return CMD_ERROR;
return CmdOverrideTownSetting(tile, flags, p1, p2, text);
}
template <typename Func>
static void ForAllStationsNearTown(Town *t, Func func)
{