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

2008/6/5 Marko Lindqvist:
> 2008/5/30 Madeline Book:
>>
>> When a user connected to a server with some
>> AI players created by aifill, they were attached
>> to an existing AI player but AI mode was not
>> reset. So when the game started the player's
>> units moved on their own. This patch fixes that
>> problem by cancelling AI mode in the attached
>> player if AI mode is on and the server is in
>> the pregame state.
>
>  I looked this problem too when I were working with the connectdialog
> problems (still unsure what to do with the remaining patch I have)

 Now I can post it here. This requires send_chat_printf() patch from #40284.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/pages.c freeciv/client/gui-gtk-2.0/pages.c
--- freeciv/client/gui-gtk-2.0/pages.c	2008-06-16 05:00:22.000000000 +0300
+++ freeciv/client/gui-gtk-2.0/pages.c	2008-06-16 05:00:35.000000000 +0300
@@ -1000,14 +1000,23 @@
 static void take_callback(GtkWidget *w, gpointer data)
 {
   if (NULL != client.conn.playing) {
-    if (!client.conn.playing->ai.control) {
-      /* Make sure player reverts to AI control. This is much more neat,
-       * and hides the ugly double username in the name list because
-       * the player username equals the connection username. */
-      send_chat_printf("/aitoggle \"%s\"", player_name(client.conn.playing));
+    const char *name = player_name(client.conn.playing);
+  
+    if (client_is_observer()) {
+      if (client.conn.playing->ai.control) {
+        send_chat_printf("/aitoggle \"%s\"", name);
+      }
+      send_chat_printf("/take \"%s\"", name);
+    } else {
+      if (!client.conn.playing->ai.control) {
+        /* Make sure player reverts to AI control. This is much more neat,
+         * and hides the ugly double username in the name list because
+         * the player username equals the connection username. */
+        send_chat_printf("/aitoggle \"%s\"", name);
+      }
+      send_chat("/detach");
+      send_chat("/observe");
     }
-    send_chat("/detach");
-    send_chat("/observe");
   } else if (!client.conn.observer) {
     send_chat("/observe");
   } else {
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to