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

On 12/03/2008, William Allen Simpson <[EMAIL PROTECTED]> wrote:
>
>  <URL: http://bugs.freeciv.org/Ticket/Display.html?id=40147 >
>
>
> Confirmed and tested.  Redid the comments some more.
>
>  Committed trunk revision 14464.
>  Committed S2_2 revision 14465.

 Update patch for S2_1, containing #40175 patch (#40175 being bug in
earlier patch version committed to trunk and S2_2).


 - ML

diff -Nurd -X.diff_ignore freeciv/server/srv_main.c freeciv/server/srv_main.c
--- freeciv/server/srv_main.c	2008-03-29 08:25:37.000000000 +0200
+++ freeciv/server/srv_main.c	2008-04-02 03:13:11.000000000 +0300
@@ -1601,12 +1601,13 @@
 }
 
 /**************************************************************************
-   generate_players() - Selects a nation for players created with
-   server's "create <PlayerName>" command.  If <PlayerName> matches
-   one of the leader names for some nation, we choose that nation.
-   (I.e. if we issue "create Shaka" then we will make that AI player's
-   nation the Zulus if the Zulus have not been chosen by anyone else.
-   If they have, then we pick an available nation at random.)
+   Selects a nation for players created with "create <PlayerName>", or
+   with "set aifill <X>".
+
+   If <PlayerName> matches one of the leader names for some nation,
+   choose that nation.  For example, when the Zulus have not been chosen
+   by anyone else, "create Shaka" will make that AI player's nation the
+   Zulus.  Otherwise, pick an available nation at random.
 
    If the AI player name is one of the leader names for the AI player's
    nation, the player sex is set to the sex for that leader, else it
@@ -1615,8 +1616,6 @@
 **************************************************************************/
 static void generate_players(void)
 {
-  char leader_name[MAX_LEN_NAME];
-
   /* Select nations for AI players generated with server
    * 'create <name>' command
    */
@@ -1649,11 +1648,17 @@
 
     pplayer->city_style = city_style_of_nation(nation_of_player(pplayer));
 
-    pick_random_player_name(nation_of_player(pplayer), leader_name);
-    sz_strlcpy(pplayer->name, leader_name);
+    /* don't change the name of a created player */
+    if (!pplayer->was_created) {
+      char leader_name[MAX_LEN_NAME];
 
-    if (check_nation_leader_name(nation_of_player(pplayer), leader_name)) {
-      pplayer->is_male = get_nation_leader_sex(nation_of_player(pplayer), leader_name);
+      pick_random_player_name(nation_of_player(pplayer), leader_name);
+      sz_strlcpy(pplayer->name, leader_name);
+    }
+
+    if (check_nation_leader_name(nation_of_player(pplayer), pplayer->name)) {
+      pplayer->is_male = get_nation_leader_sex(nation_of_player(pplayer),
+                                               pplayer->name);
     } else {
       pplayer->is_male = (myrand(2) == 1);
     }
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to