mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r1897) - Fix: [ 1120424 ] Set name overwrites same name. Renamings because your name is in use are virtual though so if name "b" is in use your name will become "b #1", renaming yourself again to "b" will become "b #2", and will toggle between these two.
This commit is contained in:
parent
fbe47d912a
commit
f22eab5544
|
@ -991,17 +991,20 @@ DEF_CONSOLE_CMD(ConSet) {
|
||||||
ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
|
ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
|
||||||
|
|
||||||
if (argc == 3 && ci != NULL) {
|
if (argc == 3 && ci != NULL) {
|
||||||
if (!_network_server)
|
// Don't change the name if it is the same as the old name
|
||||||
SEND_COMMAND(PACKET_CLIENT_SET_NAME)(argv[2]);
|
if (strncmp(ci->client_name, argv[2], sizeof(_network_player_name)) != 0) {
|
||||||
else {
|
if (!_network_server) {
|
||||||
if (NetworkFindName(argv[2])) {
|
SEND_COMMAND(PACKET_CLIENT_SET_NAME)(argv[2]);
|
||||||
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, argv[2]);
|
} else {
|
||||||
ttd_strlcpy(ci->client_name, argv[2], sizeof(ci->client_name));
|
if (NetworkFindName(argv[2])) {
|
||||||
NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
|
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, argv[2]);
|
||||||
|
ttd_strlcpy(ci->client_name, argv[2], sizeof(ci->client_name));
|
||||||
|
NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/* Also keep track of the new name on the client itself */
|
||||||
|
ttd_strlcpy(_network_player_name, argv[2], sizeof(_network_player_name));
|
||||||
}
|
}
|
||||||
/* Also keep track of the new name on the client itself */
|
|
||||||
ttd_strlcpy(_network_player_name, argv[2], sizeof(_network_player_name));
|
|
||||||
} else {
|
} else {
|
||||||
IConsolePrint(_iconsole_color_default, "With 'set name' you can change your network-player name.");
|
IConsolePrint(_iconsole_color_default, "With 'set name' you can change your network-player name.");
|
||||||
IConsolePrint(_iconsole_color_warning, "Usage: set name \"<name>\".");
|
IConsolePrint(_iconsole_color_warning, "Usage: set name \"<name>\".");
|
||||||
|
|
Loading…
Reference in New Issue