summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-10-03 17:15:48 +0200
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commit549caca39cebc8c988f4e51d79d353cab4646d58 (patch)
tree6739fb0721fae36d6fc58eabd4be642062386dee /src/network
parentb6933a2ebdf66c5fb23b2226d3ce07d71426d7d2 (diff)
downloadopenttd-549caca39cebc8c988f4e51d79d353cab4646d58.tar.xz
Codechange: Move command arguments to the back of the networked command function calls.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network.cpp4
-rw-r--r--src/network/network_client.cpp2
-rw-r--r--src/network/network_command.cpp8
-rw-r--r--src/network/network_gui.cpp6
-rw-r--r--src/network/network_server.cpp6
5 files changed, 13 insertions, 13 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index dd0a91594..6e111926e 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -394,7 +394,7 @@ static void CheckPauseHelper(bool pause, PauseMode pm)
{
if (pause == ((_pause_mode & pm) != PM_UNPAUSED)) return;
- DoCommandP(0, pm, pause ? 1 : 0, CMD_PAUSE);
+ DoCommandP(CMD_PAUSE, 0, pm, pause ? 1 : 0);
}
/**
@@ -1064,7 +1064,7 @@ void NetworkGameLoop()
while (f != nullptr && !feof(f)) {
if (_date == next_date && _date_fract == next_date_fract) {
if (cp != nullptr) {
- NetworkSendCommand(cp->tile, cp->p1, cp->p2, cp->cmd & ~CMD_FLAGS_MASK, nullptr, cp->text, cp->company);
+ NetworkSendCommand(cp->cmd & ~CMD_FLAGS_MASK, nullptr, cp->company, cp->tile, cp->p1, cp->p2, cp->text);
Debug(desync, 0, "Injecting: {:08x}; {:02x}; {:02x}; {:06x}; {:08x}; {:08x}; {:08x}; \"{}\" ({})", _date, _date_fract, (int)_current_company, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text, GetCommandName(cp->cmd));
delete cp;
cp = nullptr;
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index f03601b39..e638df005 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -839,7 +839,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
* the server will give us a client-id and let us in */
_network_join_status = NETWORK_JOIN_STATUS_REGISTERING;
ShowJoinStatusWindow();
- NetworkSendCommand(0, CCA_NEW, 0, CMD_COMPANY_CTRL, nullptr, {}, _local_company);
+ NetworkSendCommand(CMD_COMPANY_CTRL, nullptr, _local_company, 0, CCA_NEW, 0, {});
}
} else {
/* take control over an existing company */
diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp
index 6d03aaaa1..f1a0f682d 100644
--- a/src/network/network_command.cpp
+++ b/src/network/network_command.cpp
@@ -125,15 +125,15 @@ static CommandQueue _local_execution_queue;
/**
* Prepare a DoCommand to be send over the network
+ * @param cmd The command to execute (a CMD_* value)
+ * @param callback A callback function to call after the command is finished
+ * @param company The company that wants to send the command
* @param tile The tile to perform a command on (see #CommandProc)
* @param p1 Additional data for the command (see #CommandProc)
* @param p2 Additional data for the command (see #CommandProc)
- * @param cmd The command to execute (a CMD_* value)
- * @param callback A callback function to call after the command is finished
* @param text The text to pass
- * @param company The company that wants to send the command
*/
-void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const std::string &text, CompanyID company)
+void NetworkSendCommand(uint32 cmd, CommandCallback *callback, CompanyID company, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
{
assert((cmd & CMD_FLAGS_MASK) == 0);
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 76385a087..c795e1550 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1395,7 +1395,7 @@ static void AdminCompanyResetCallback(Window *w, bool confirmed)
{
if (confirmed) {
if (NetworkCompanyHasClients(_admin_company_id)) return;
- DoCommandP(0, CCA_DELETE | _admin_company_id << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
+ DoCommandP(CMD_COMPANY_CTRL, 0, CCA_DELETE | _admin_company_id << 16 | CRR_MANUAL << 24, 0);
}
}
@@ -1535,9 +1535,9 @@ private:
static void OnClickCompanyNew(NetworkClientListWindow *w, Point pt, CompanyID company_id)
{
if (_network_server) {
- DoCommandP(0, CCA_NEW, _network_own_client_id, CMD_COMPANY_CTRL);
+ DoCommandP(CMD_COMPANY_CTRL, 0, CCA_NEW, _network_own_client_id);
} else {
- NetworkSendCommand(0, CCA_NEW, 0, CMD_COMPANY_CTRL, nullptr, {}, _local_company);
+ NetworkSendCommand(CMD_COMPANY_CTRL, nullptr, _local_company, 0, CCA_NEW, 0, {});
}
}
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 9deaa5522..65e801073 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -1553,7 +1553,7 @@ static void NetworkAutoCleanCompanies()
/* Is the company empty for autoclean_unprotected-months, and is there no protection? */
if (_settings_client.network.autoclean_unprotected != 0 && _network_company_states[c->index].months_empty > _settings_client.network.autoclean_unprotected && _network_company_states[c->index].password.empty()) {
/* Shut the company down */
- DoCommandP(0, CCA_DELETE | c->index << 16 | CRR_AUTOCLEAN << 24, 0, CMD_COMPANY_CTRL);
+ DoCommandP(CMD_COMPANY_CTRL, 0, CCA_DELETE | c->index << 16 | CRR_AUTOCLEAN << 24, 0);
IConsolePrint(CC_INFO, "Auto-cleaned company #{} with no password.", c->index + 1);
}
/* Is the company empty for autoclean_protected-months, and there is a protection? */
@@ -1567,7 +1567,7 @@ static void NetworkAutoCleanCompanies()
/* Is the company empty for autoclean_novehicles-months, and has no vehicles? */
if (_settings_client.network.autoclean_novehicles != 0 && _network_company_states[c->index].months_empty > _settings_client.network.autoclean_novehicles && vehicles_in_company[c->index] == 0) {
/* Shut the company down */
- DoCommandP(0, CCA_DELETE | c->index << 16 | CRR_AUTOCLEAN << 24, 0, CMD_COMPANY_CTRL);
+ DoCommandP(CMD_COMPANY_CTRL, 0, CCA_DELETE | c->index << 16 | CRR_AUTOCLEAN << 24, 0);
IConsolePrint(CC_INFO, "Auto-cleaned company #{} with no vehicles.", c->index + 1);
}
} else {
@@ -2078,7 +2078,7 @@ void NetworkServerNewCompany(const Company *c, NetworkClientInfo *ci)
/* ci is nullptr when replaying, or for AIs. In neither case there is a client. */
ci->client_playas = c->index;
NetworkUpdateClientInfo(ci->client_id);
- NetworkSendCommand(0, 0, 0, CMD_RENAME_PRESIDENT, nullptr, ci->client_name, c->index);
+ NetworkSendCommand(CMD_RENAME_PRESIDENT, nullptr, c->index, 0, 0, 0, ci->client_name);
}
/* Announce new company on network. */