Re: [Freeciv-Dev] (PR#40254) [PATCH] Cancel AI mode when attaching to aifill player.

2008-06-17 Thread Marko Lindqvist

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

2008/6/17 Madeline Book:
>
> This patch (+ the one from 40284) fixes a different
> problem then what I originally opened this ticket for.

 I see. So I were against your patch for wrong reasons. After
rechecking I'm no longer against it.

> Of course with this patch if you do the "Take this
> player" from the connection list menu in pregame then
> it aitoggles the player you are attached to into
> the correct state.

 May I commit this, or do we need longer discussion (in separate ticket) ?


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40254) [PATCH] Cancel AI mode when attaching to aifill player.

2008-06-15 Thread Marko Lindqvist

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.0 +0300
+++ freeciv/client/gui-gtk-2.0/pages.c	2008-06-16 05:00:35.0 +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


Re: [Freeciv-Dev] (PR#40254) [PATCH] Cancel AI mode when attaching to aifill player.

2008-06-05 Thread Marko Lindqvist

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

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)

 I don't like how things are not symmetric. When human detach from
player, human -> ai toggle comes from client. Your patch makes the
opposite in the server side.
 Not that I'm against your patch. IMHO these both toggles should
happen at server side.


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev