summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-10-31 19:39:09 +0100
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commit0f64ee5ce1548d9cda69917f27c5b1a3cb91823d (patch)
tree161f0e6ac300e604de61b8203b5a58279637f9eb /src/openttd.cpp
parente740c24eb7a90bc771f5976d64d80639ee7576e5 (diff)
downloadopenttd-0f64ee5ce1548d9cda69917f27c5b1a3cb91823d.tar.xz
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.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index abd5d99df..c5c849e71 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -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);