summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main_gui.c4
-rw-r--r--network.h3
-rw-r--r--network_gui.c6
-rw-r--r--network_server.c32
4 files changed, 23 insertions, 22 deletions
diff --git a/main_gui.c b/main_gui.c
index c80ac1ae1..03c4db845 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -163,7 +163,7 @@ static void MenuClickSettings(int index)
case 2: ShowPatchesSelection(); return;
case 3: ShowNewgrf(); return;
- case 5: DeleteAllNonVitalWindows(); return;
+ case 5: DeleteAllNonVitalWindows(); return;
case 6: _display_opt ^= DO_SHOW_TOWN_NAMES; MarkWholeScreenDirty(); return;
case 7: _display_opt ^= DO_SHOW_STATION_NAMES; MarkWholeScreenDirty(); return;
case 8: _display_opt ^= DO_SHOW_SIGNS; MarkWholeScreenDirty(); return;
@@ -339,7 +339,7 @@ void ShowNetworkChatQueryWindow(byte desttype, byte dest)
{
_rename_id = desttype + (dest << 8);
_rename_what = 2;
- ShowChatWindow(STR_EMPTY, STR_NETWORK_CHAT_QUERY_CAPTION, 60, 250, 1, 0);
+ ShowChatWindow(STR_EMPTY, STR_NETWORK_CHAT_QUERY_CAPTION, 150, 338, 1, 0);
}
void ShowNetworkGiveMoneyWindow(byte player)
diff --git a/network.h b/network.h
index a02ee5446..23b708802 100644
--- a/network.h
+++ b/network.h
@@ -47,6 +47,7 @@
#define NETWORK_REVISION_LENGTH 10
#define NETWORK_PASSWORD_LENGTH 20
#define NETWORK_PLAYERS_LENGTH 200
+#define NETWORK_CLIENT_NAME_LENGTH 25
// This is the struct used by both client and server
// some fields will be empty on the client (like game_password) by default
@@ -88,7 +89,7 @@ typedef struct NetworkPlayerInfo {
typedef struct NetworkClientInfo {
uint16 client_index; // Index of the client (same as ClientState->index)
- char client_name[NETWORK_NAME_LENGTH]; // Name of the client
+ char client_name[NETWORK_CLIENT_NAME_LENGTH]; // Name of the client
byte client_lang; // The language of the client
byte client_playas; // As which player is this client playing
uint32 client_ip; // IP-address of the client (so he can be banned)
diff --git a/network_gui.c b/network_gui.c
index 94d3f7310..4fa7e082b 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -1408,9 +1408,9 @@ press_ok:;
static const Widget _chat_window_widgets[] = {
{ WWT_IMGBTN, 14, 0, 639, 0, 13, 0x0, STR_NULL}, // background
-{ WWT_IMGBTN, 14, 2, 379, 1, 12, 0x0, STR_NULL}, // text box
-{ WWT_TEXTBTN, 14, 380, 509, 1, 12, STR_NETWORK_SEND,STR_NULL}, // send button
-{ WWT_TEXTBTN, 14, 510, 639, 1, 12, STR_012E_CANCEL, STR_NULL}, // cancel button
+{ WWT_IMGBTN, 14, 2, 399, 1, 12, 0x0, STR_NULL}, // text box
+{ WWT_TEXTBTN, 14, 400, 519, 1, 12, STR_NETWORK_SEND,STR_NULL}, // send button
+{ WWT_TEXTBTN, 14, 520, 639, 1, 12, STR_012E_CANCEL, STR_NULL}, // cancel button
{ WIDGETS_END},
};
diff --git a/network_server.c b/network_server.c
index 9e54bfd34..fc24b6ce9 100644
--- a/network_server.c
+++ b/network_server.c
@@ -135,7 +135,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkClientState *cs, Netwo
NetworkClientState *new_cs;
char str[100];
- char client_name[NETWORK_NAME_LENGTH];
+ char client_name[NETWORK_CLIENT_NAME_LENGTH];
Packet *p = NetworkSend_Init(PACKET_SERVER_ERROR);
NetworkSend_uint8(p, error);
@@ -712,7 +712,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_MAP_OK)
{
// Client has the map, now start syncing
if (cs->status == STATUS_DONE_MAP && !cs->quited) {
- char client_name[NETWORK_NAME_LENGTH];
+ char client_name[NETWORK_CLIENT_NAME_LENGTH];
NetworkClientState *new_cs;
NetworkGetClientName(client_name, sizeof(client_name), cs);
@@ -849,7 +849,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_ERROR)
NetworkClientState *new_cs;
byte errorno = NetworkRecv_uint8(p);
char str[100];
- char client_name[NETWORK_NAME_LENGTH];
+ char client_name[NETWORK_CLIENT_NAME_LENGTH];
// The client was never joined.. thank the client for the packet, but ignore it
if (cs->status < STATUS_DONE_MAP || cs->quited) {
@@ -880,7 +880,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_QUIT)
// clients.
NetworkClientState *new_cs;
char str[100];
- char client_name[NETWORK_NAME_LENGTH];
+ char client_name[NETWORK_CLIENT_NAME_LENGTH];
// The client was never joined.. thank the client for the packet, but ignore it
if (cs->status < STATUS_DONE_MAP || cs->quited) {
@@ -1043,17 +1043,17 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_SET_PASSWORD)
DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_SET_NAME)
{
- char name[NETWORK_NAME_LENGTH];
+ char client_name[NETWORK_CLIENT_NAME_LENGTH];
NetworkClientInfo *ci;
- NetworkRecv_string(p, name, sizeof(name));
+ NetworkRecv_string(p, client_name, sizeof(client_name));
ci = DEREF_CLIENT_INFO(cs);
if (ci != NULL) {
// Display change
- if (NetworkFindName(name)) {
- NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, name);
- ttd_strlcpy(ci->client_name, name, sizeof(ci->client_name));
+ if (NetworkFindName(client_name)) {
+ NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, client_name);
+ ttd_strlcpy(ci->client_name, client_name, sizeof(ci->client_name));
NetworkUpdateClientInfo(ci->client_index);
}
}
@@ -1229,7 +1229,7 @@ void NetworkPopulateCompanyInfo(void)
ttd_strlcpy(_network_player_info[ci->client_playas-1].players, ci->client_name, sizeof(_network_player_info[ci->client_playas-1].players));
FOR_ALL_CLIENTS(cs) {
- char client_name[NETWORK_NAME_LENGTH];
+ char client_name[NETWORK_CLIENT_NAME_LENGTH];
NetworkGetClientName(client_name, sizeof(client_name), cs);
@@ -1339,22 +1339,22 @@ static void NetworkAutoCleanCompanies()
// This function changes new_name to a name that is unique (by adding #1 ...)
// and it returns true if that succeeded.
-bool NetworkFindName(char new_name[NETWORK_NAME_LENGTH])
+bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH])
{
NetworkClientState *new_cs;
NetworkClientInfo *ci;
bool found_name = false;
byte number = 0;
- char original_name[NETWORK_NAME_LENGTH];
+ char original_name[NETWORK_CLIENT_NAME_LENGTH];
// We use NETWORK_NAME_LENGTH in here, because new_name is really a pointer
- ttd_strlcpy(original_name, new_name, NETWORK_NAME_LENGTH);
+ ttd_strlcpy(original_name, new_name, NETWORK_CLIENT_NAME_LENGTH);
while (!found_name) {
found_name = true;
FOR_ALL_CLIENTS(new_cs) {
ci = DEREF_CLIENT_INFO(new_cs);
- if (strncmp(ci->client_name, new_name, NETWORK_NAME_LENGTH) == 0) {
+ if (strncmp(ci->client_name, new_name, NETWORK_CLIENT_NAME_LENGTH) == 0) {
// Name already in use
found_name = false;
break;
@@ -1363,7 +1363,7 @@ bool NetworkFindName(char new_name[NETWORK_NAME_LENGTH])
// Check if it is the same as the server-name
ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
if (ci != NULL) {
- if (strncmp(ci->client_name, new_name, NETWORK_NAME_LENGTH) == 0) {
+ if (strncmp(ci->client_name, new_name, NETWORK_CLIENT_NAME_LENGTH) == 0) {
// Name already in use
found_name = false;
}
@@ -1374,7 +1374,7 @@ bool NetworkFindName(char new_name[NETWORK_NAME_LENGTH])
// Stop if we tried for more then 50 times..
if (number++ > 50) break;
- snprintf(new_name, NETWORK_NAME_LENGTH, "%s #%d", original_name, number);
+ snprintf(new_name, NETWORK_CLIENT_NAME_LENGTH, "%s #%d", original_name, number);
}
}