summaryrefslogtreecommitdiff
path: root/src/network/network_client.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-30 18:20:26 +0000
committerrubidium <rubidium@openttd.org>2008-05-30 18:20:26 +0000
commit2f3b88ef9a217e911c897de49cc616e73a233b59 (patch)
treeae098eb73283ba9ab9875b3df24bbe3b5eb7fef1 /src/network/network_client.cpp
parente81386476f09997485e7f707f3349685e2140a97 (diff)
downloadopenttd-2f3b88ef9a217e911c897de49cc616e73a233b59.tar.xz
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
Diffstat (limited to 'src/network/network_client.cpp')
-rw-r--r--src/network/network_client.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 9411a28a4..cd2df7f23 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -7,7 +7,7 @@
#include "../stdafx.h"
#include "../debug.h"
#include "../openttd.h"
-#include "network_data.h"
+#include "network_internal.h"
#include "core/tcp.h"
#include "network_client.h"
#include "network_gamelist.h"
@@ -938,4 +938,39 @@ NetworkRecvStatus NetworkClient_ReadPackets(NetworkTCPSocketHandler *cs)
return res;
}
+void NetworkClientSendRcon(const char *password, const char *command)
+{
+ SEND_COMMAND(PACKET_CLIENT_RCON)(password, command);
+}
+
+void NetworkUpdatePlayerName()
+{
+ NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
+
+ if (ci == NULL) return;
+
+ /* Don't change the name if it is the same as the old name */
+ if (strcmp(ci->client_name, _settings_client.network.player_name) != 0) {
+ if (!_network_server) {
+ SEND_COMMAND(PACKET_CLIENT_SET_NAME)(_settings_client.network.player_name);
+ } else {
+ if (NetworkFindName(_settings_client.network.player_name)) {
+ NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, "%s", _settings_client.network.player_name);
+ ttd_strlcpy(ci->client_name, _settings_client.network.player_name, sizeof(ci->client_name));
+ NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
+ }
+ }
+ }
+}
+
+void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg)
+{
+ SEND_COMMAND(PACKET_CLIENT_CHAT)(action, type, dest, msg);
+}
+
+void NetworkClientSetPassword()
+{
+ SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_player_info[_local_player].password);
+}
+
#endif /* ENABLE_NETWORK */