Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.

When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
This commit is contained in:
Michael Lutz
2021-10-31 19:39:09 +01:00
parent e740c24eb7
commit 0f64ee5ce1
47 changed files with 375 additions and 332 deletions

View File

@@ -66,6 +66,7 @@
#include "framerate_type.h"
#include "industry.h"
#include "network/network_gui.h"
#include "misc_cmd.h"
#include "linkgraph/linkgraphschedule.h"
@@ -851,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) DoCommandP(CMD_PAUSE, 0, PM_PAUSED_NORMAL, 1);
if (_settings_client.gui.pause_on_newgame) Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
return;
}
@@ -880,7 +881,7 @@ static void MakeNewGameDone()
NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
}
if (_settings_client.gui.pause_on_newgame) DoCommandP(CMD_PAUSE, 0, PM_PAUSED_NORMAL, 1);
if (_settings_client.gui.pause_on_newgame) Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
CheckEngines();
CheckIndustries();
@@ -1045,7 +1046,7 @@ void SwitchToMode(SwitchMode new_mode)
}
OnStartGame(_network_dedicated);
/* Decrease pause counter (was increased from opening load dialog) */
DoCommandP(CMD_PAUSE, 0, PM_PAUSED_SAVELOAD, 0);
Command<CMD_PAUSE>::Post(0, PM_PAUSED_SAVELOAD, 0, {});
}
break;
}
@@ -1067,7 +1068,7 @@ void SwitchToMode(SwitchMode new_mode)
SetLocalCompany(OWNER_NONE);
_settings_newgame.game_creation.starting_year = _cur_year;
/* Cancel the saveload pausing */
DoCommandP(CMD_PAUSE, 0, PM_PAUSED_SAVELOAD, 0);
Command<CMD_PAUSE>::Post(0, PM_PAUSED_SAVELOAD, 0, {});
} else {
SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);