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:
@@ -42,6 +42,8 @@
|
||||
#include "game/game.hpp"
|
||||
#include "table/strings.h"
|
||||
#include "walltime_func.h"
|
||||
#include "company_cmd.h"
|
||||
#include "misc_cmd.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
@@ -630,7 +632,7 @@ DEF_CONSOLE_CMD(ConPauseGame)
|
||||
}
|
||||
|
||||
if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
|
||||
DoCommandP(CMD_PAUSE, 0, PM_PAUSED_NORMAL, 1);
|
||||
Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
|
||||
if (!_networking) IConsolePrint(CC_DEFAULT, "Game paused.");
|
||||
} else {
|
||||
IConsolePrint(CC_DEFAULT, "Game is already paused.");
|
||||
@@ -652,7 +654,7 @@ DEF_CONSOLE_CMD(ConUnpauseGame)
|
||||
}
|
||||
|
||||
if ((_pause_mode & PM_PAUSED_NORMAL) != PM_UNPAUSED) {
|
||||
DoCommandP(CMD_PAUSE, 0, PM_PAUSED_NORMAL, 0);
|
||||
Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 0, {});
|
||||
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.");
|
||||
@@ -863,7 +865,7 @@ DEF_CONSOLE_CMD(ConResetCompany)
|
||||
}
|
||||
|
||||
/* It is safe to remove this company */
|
||||
DoCommandP(CMD_COMPANY_CTRL, 0, CCA_DELETE | index << 16 | CRR_MANUAL << 24, 0);
|
||||
Command<CMD_COMPANY_CTRL>::Post(0, CCA_DELETE | index << 16 | CRR_MANUAL << 24, 0, {});
|
||||
IConsolePrint(CC_DEFAULT, "Company deleted.");
|
||||
|
||||
return true;
|
||||
@@ -1220,7 +1222,7 @@ DEF_CONSOLE_CMD(ConStartAI)
|
||||
}
|
||||
|
||||
/* Start a new AI company */
|
||||
DoCommandP(CMD_COMPANY_CTRL, 0, CCA_NEW_AI | INVALID_COMPANY << 16, 0);
|
||||
Command<CMD_COMPANY_CTRL>::Post(0, CCA_NEW_AI | INVALID_COMPANY << 16, 0, {});
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1256,8 +1258,8 @@ DEF_CONSOLE_CMD(ConReloadAI)
|
||||
}
|
||||
|
||||
/* First kill the company of the AI, then start a new one. This should start the current AI again */
|
||||
DoCommandP(CMD_COMPANY_CTRL, 0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0);
|
||||
DoCommandP(CMD_COMPANY_CTRL, 0, CCA_NEW_AI | company_id << 16, 0);
|
||||
Command<CMD_COMPANY_CTRL>::Post(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0, {});
|
||||
Command<CMD_COMPANY_CTRL>::Post(0, CCA_NEW_AI | company_id << 16, 0, {});
|
||||
IConsolePrint(CC_DEFAULT, "AI reloaded.");
|
||||
|
||||
return true;
|
||||
@@ -1294,7 +1296,7 @@ DEF_CONSOLE_CMD(ConStopAI)
|
||||
}
|
||||
|
||||
/* Now kill the company of the AI. */
|
||||
DoCommandP(CMD_COMPANY_CTRL, 0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0);
|
||||
Command<CMD_COMPANY_CTRL>::Post(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0, {});
|
||||
IConsolePrint(CC_DEFAULT, "AI stopped, company deleted.");
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user