summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-11 22:07:26 +0000
committerrubidium <rubidium@openttd.org>2008-08-11 22:07:26 +0000
commit3b4c3a3df690d5ec02ba2bf93a69aa6fe9908810 (patch)
tree946bb9e6d885bc1eb08d0131905d3c4df18bb2d9
parent5f52c44c14bf4c61ec8db6a57195992564fb22a5 (diff)
downloadopenttd-3b4c3a3df690d5ec02ba2bf93a69aa6fe9908810.tar.xz
(svn r14045) -Codechange: move the network's limitation to chat messages to a more logical location and give it a more consistent name.
-rw-r--r--src/network/core/config.h1
-rw-r--r--src/network/network_client.cpp6
-rw-r--r--src/network/network_internal.h2
-rw-r--r--src/network/network_server.cpp6
-rw-r--r--src/network/network_type.h2
5 files changed, 8 insertions, 9 deletions
diff --git a/src/network/core/config.h b/src/network/core/config.h
index 6b4b471bf..4911d2a4c 100644
--- a/src/network/core/config.h
+++ b/src/network/core/config.h
@@ -32,6 +32,7 @@ enum {
NETWORK_PLAYERS_LENGTH = 200, ///< The maximum length for the list of players that controls a company, in bytes including '\0'
NETWORK_CLIENT_NAME_LENGTH = 25, ///< The maximum length of a player, in bytes including '\0'
NETWORK_RCONCOMMAND_LENGTH = 500, ///< The maximum length of a rconsole command, in bytes including '\0'
+ NETWORK_CHAT_LENGTH = 1000, ///< The maximum length of a chat message, in bytes including '\0'
NETWORK_GRF_NAME_LENGTH = 80, ///< Maximum length of the name of a GRF
/**
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 2222c3182..4814973a1 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -245,7 +245,7 @@ DEF_CLIENT_SEND_COMMAND_PARAM(PACKET_CLIENT_CHAT)(NetworkAction action, DestType
// uint8: ActionID (see network_data.h, NetworkAction)
// uint8: Destination Type (see network_data.h, DestType);
// uint16: Destination Player
- // String: Message (max MAX_TEXT_MSG_LEN)
+ // String: Message (max NETWORK_CHAT_LENGTH)
//
Packet *p = NetworkSend_Init(PACKET_CLIENT_CHAT);
@@ -713,13 +713,13 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMMAND)
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT)
{
- char name[NETWORK_NAME_LENGTH], msg[MAX_TEXT_MSG_LEN];
+ char name[NETWORK_NAME_LENGTH], msg[NETWORK_CHAT_LENGTH];
const NetworkClientInfo *ci = NULL, *ci_to;
NetworkAction action = (NetworkAction)p->Recv_uint8();
uint16 index = p->Recv_uint16();
bool self_send = p->Recv_bool();
- p->Recv_string(msg, MAX_TEXT_MSG_LEN);
+ p->Recv_string(msg, NETWORK_CHAT_LENGTH);
ci_to = NetworkFindClientInfoFromIndex(index);
if (ci_to == NULL) return NETWORK_RECV_STATUS_OKAY;
diff --git a/src/network/network_internal.h b/src/network/network_internal.h
index 28d38f889..42c7f66be 100644
--- a/src/network/network_internal.h
+++ b/src/network/network_internal.h
@@ -32,8 +32,6 @@
*/
//#define NETWORK_SEND_DOUBLE_SEED
-#define MAX_TEXT_MSG_LEN 1024 /* long long long long sentences :-) */
-
enum MapPacket {
MAP_PACKET_START,
MAP_PACKET_NORMAL,
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 279c49bd5..56f8b724e 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -509,7 +509,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CHAT)(NetworkTCPSocketHandler *cs, N
// Data:
// uint8: ActionID (see network_data.h, NetworkAction)
// uint16: Client-index
- // String: Message (max MAX_TEXT_MSG_LEN)
+ // String: Message (max NETWORK_CHAT_LENGTH)
//
Packet *p = NetworkSend_Init(PACKET_SERVER_CHAT);
@@ -1160,9 +1160,9 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_CHAT)
NetworkAction action = (NetworkAction)p->Recv_uint8();
DestType desttype = (DestType)p->Recv_uint8();
int dest = p->Recv_uint16();
- char msg[MAX_TEXT_MSG_LEN];
+ char msg[NETWORK_CHAT_LENGTH];
- p->Recv_string(msg, MAX_TEXT_MSG_LEN);
+ p->Recv_string(msg, NETWORK_CHAT_LENGTH);
const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs);
switch (action) {
diff --git a/src/network/network_type.h b/src/network/network_type.h
index c05033696..880a8ffae 100644
--- a/src/network/network_type.h
+++ b/src/network/network_type.h
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file network_internal.h Variables and function used internally. */
+/** @file network_type.h Types used for networking. */
#ifndef NETWORK_TYPE_H
#define NETWORK_TYPE_H