Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2006:
[Freeciv-Dev] (PR#15873) loading a saved game starts all players in AI m
Home

[Freeciv-Dev] (PR#15873) loading a saved game starts all players in AI m

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: joseph@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#15873) loading a saved game starts all players in AI mode, even mine!
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Apr 2006 22:59:13 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch fixes some problems.

* /ai %s is changed to /aitoggle "%s" in chat messages.
* Several places that would create-aitoggle-take instead just "take -".

However this doesn't seem to fix the bug: when loading a game with an ai
player with a space in the name and choosing that player, the aitoggle
does not happen correctly.

-jason

Index: client/gui-gtk-2.0/pages.c
===================================================================
--- client/gui-gtk-2.0/pages.c  (revision 11866)
+++ client/gui-gtk-2.0/pages.c  (working copy)
@@ -1009,7 +1009,7 @@
        * the player username equals the connection username. */
       char buf[512];
 
-      my_snprintf(buf, sizeof(buf), "/ai %s", aconnection.player->name);
+      my_snprintf(buf, sizeof(buf), "/aitoggle \"%s\"", 
aconnection.player->name);
       send_chat(buf);
     }
     send_chat("/detach");
@@ -1093,7 +1093,7 @@
 
   if (conn_menu_player->ai.control) {
     /* See comment on detach command for why */
-    my_snprintf(buf, sizeof(buf), "/ai \"%s\"", conn_menu_player->name);
+    my_snprintf(buf, sizeof(buf), "/aitoggle \"%s\"", conn_menu_player->name);
     send_chat(buf);
   }
   my_snprintf(buf, sizeof(buf), "/take \"%s\"", conn_menu_player->name);
@@ -1587,18 +1587,10 @@
   if (!packet->load_successful) {
   } else {
     if (game.info.is_new_game) {
-      char message[MAX_LEN_MSG];
-
       set_client_page(PAGE_START);
       
       /* It's pregame. Create a player and connect to him */
-      my_snprintf(message, sizeof(message), "/create %s", user_name);
-      send_chat(message);
-      my_snprintf(message, sizeof(message), "/ai %s", user_name);
-      send_chat(message);
-      my_snprintf(message, sizeof(message), "/take \"%s\"", user_name);
-      send_chat(message);
-
+      send_chat("/take -");
     } else {
       update_nation_page(packet);
       set_client_page(PAGE_NATION);
@@ -2014,15 +2006,8 @@
   /* if nplayers is zero, we suppose it's a scenario */
   if (packet->nplayers == 0) {
     GtkTreeIter iter;
-    char message[MAX_LEN_MSG];
+    send_chat("/take -");
 
-    my_snprintf(message, sizeof(message), "/create %s", user_name);
-    send_chat(message);
-    my_snprintf(message, sizeof(message), "/ai %s", user_name);
-    send_chat(message);
-    my_snprintf(message, sizeof(message), "/take \"%s\"", user_name);
-    send_chat(message);
-
     /* create a false entry */
     gtk_list_store_append(nation_store, &iter);
     gtk_list_store_set(nation_store, &iter,
Index: client/gui-gtk-2.0/plrdlg.c
===================================================================
--- client/gui-gtk-2.0/plrdlg.c (revision 11866)
+++ client/gui-gtk-2.0/plrdlg.c (working copy)
@@ -835,7 +835,7 @@
 
     gtk_tree_model_get(model, &it, ncolumns - 1, &plrno, -1);
 
-    my_snprintf(buf, sizeof(buf), "/aitoggle %s", get_player(plrno)->name);
+    my_snprintf(buf, sizeof(buf), "/aitoggle \"%s\"", get_player(plrno)->name);
     send_chat(buf);
   }
 }
Index: client/gui-win32/connectdlg.c
===================================================================
--- client/gui-win32/connectdlg.c       (revision 11866)
+++ client/gui-win32/connectdlg.c       (working copy)
@@ -202,15 +202,8 @@
 
   /* if nplayers is zero, we suppose it's a scenario */
   if (packet->load_successful && packet->nplayers == 0) {
-    char message[MAX_LEN_MSG];
+    send_chat("/take -");
 
-    my_snprintf(message, sizeof(message), "/create %s", user_name);
-    send_chat(message);
-    my_snprintf(message, sizeof(message), "/ai %s", user_name);
-    send_chat(message);
-    my_snprintf(message, sizeof(message), "/take %s", user_name);
-    send_chat(message);
-
     /* create a false entry */
     row[0] = user_name;
     row[1] = "";

[Prev in Thread] Current Thread [Next in Thread]