<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39503 >

When a user gets cut in a pregame, the next player user name is set to
"Unassigned".

--- server/stdinhand.c	2007-08-07 14:10:49.000000000 +0200
+++ server/stdinhand.c.new	2007-08-07 14:16:35.000000000 +0200
@@ -3750,6 +3750,7 @@
   enum m_pre_result match_result;
   struct connection *ptarget;
   struct player *pplayer;
+  bool was_connected;
 
   ptarget = find_conn_by_user_prefix(name, &match_result);
 
@@ -3760,7 +3761,8 @@
     return TRUE;
   }
 
-  pplayer = !ptarget->observer ? ptarget->player : NULL;
+  pplayer = ptarget->player;
+  was_connected = pplayer ? pplayer->is_connected : FALSE;
 
   cmd_reply(CMD_CUT, caller, C_DISCONNECTED,
 	    _("Cutting connection %s."), ptarget->username);
@@ -3768,7 +3770,7 @@
   close_connection(ptarget);
 
   /* if we cut the connection, unassign the login name */
-  if (pplayer) {
+  if (pplayer && was_connected && !pplayer->is_connected) {
     sz_strlcpy(pplayer->username, ANON_USER_NAME);
   }
   return TRUE;
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to