summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-11-01 23:07:27 +0100
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commitccefa76a4686581b8d1a9bd13d7d754807a9f8d1 (patch)
treeb367f92a76d9e6e1690c86e5140c16b223a7d350 /src/network
parent6691ee3b963ee3282490360bb3cc1ea09d0c58ea (diff)
downloadopenttd-ccefa76a4686581b8d1a9bd13d7d754807a9f8d1.tar.xz
Codechange: Template DoCommandPInternal.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_client.cpp3
-rw-r--r--src/network/network_command.cpp16
-rw-r--r--src/network/network_gui.cpp2
-rw-r--r--src/network/network_server.cpp2
4 files changed, 4 insertions, 19 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index dd42f5f6f..cc7cd8336 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -18,6 +18,7 @@
#include "../company_func.h"
#include "../company_base.h"
#include "../company_gui.h"
+#include "../company_cmd.h"
#include "../core/random_func.hpp"
#include "../date_func.h"
#include "../gfx_func.h"
@@ -839,7 +840,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(CMD_COMPANY_CTRL, STR_NULL, nullptr, _local_company, 0, CCA_NEW, 0, {});
+ Command<CMD_COMPANY_CTRL>::SendNet(STR_NULL, 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 983f4b565..f99c71b97 100644
--- a/src/network/network_command.cpp
+++ b/src/network/network_command.cpp
@@ -176,22 +176,6 @@ static CommandQueue _local_wait_queue;
/** Local queue of packets waiting for execution. */
static CommandQueue _local_execution_queue;
-/**
- * Prepare a DoCommand to be send over the network
- * @param cmd The command to execute (a CMD_* value)
- * @param err_message Message prefix to show on error
- * @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 text The text to pass
- */
-void NetworkSendCommand(Commands cmd, StringID err_message, CommandCallback *callback, CompanyID company, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
-{
- auto data = EndianBufferWriter<CommandDataBuffer>::FromValue(std::make_tuple(tile, p1, p2, text));
- NetworkSendCommand(cmd, err_message, callback, company, tile, data);
-}
/**
* Prepare a DoCommand to be send over the network
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index a2b34593e..ac12402ea 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1538,7 +1538,7 @@ private:
if (_network_server) {
Command<CMD_COMPANY_CTRL>::Post(0, CCA_NEW, _network_own_client_id, {});
} else {
- NetworkSendCommand(CMD_COMPANY_CTRL, STR_NULL, nullptr, _local_company, 0, CCA_NEW, 0, {});
+ Command<CMD_COMPANY_CTRL>::SendNet(STR_NULL, nullptr, _local_company, 0, CCA_NEW, 0, {});
}
}
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 65f3188de..ad891aef8 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -2081,7 +2081,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(CMD_RENAME_PRESIDENT, STR_NULL, nullptr, c->index, 0, 0, 0, ci->client_name);
+ Command<CMD_RENAME_PRESIDENT>::SendNet(STR_NULL, nullptr, c->index, 0, 0, 0, ci->client_name);
}
/* Announce new company on network. */