Re: [Freeciv-Dev] (PR#40234) [Patch] Start button sensitivity

2008-06-15 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40234 

2008/5/8 Marko Lindqvist:

 2008/5/8 Madeline Book:

   [cazfi - Wed May 07 21:59:32 2008]:
  
GTK-2
  
Current Start button sensitivity checks against global observer, but
   observer attached to player cannot start game either.

  The start button should also not be sensitive for detached
  connections (not observer and not attached to a player).

  Fixed that one.

  I also found out that Pick Nation is sometimes used to create new
 player (without nations selection) and sometimes to select nation for
 existing player. Now button text changes accordingly.
  Sensitivity of the Take Player/Pick Nation adjusted fixing two bugs:
  - Pick Nation is not sensitive for observers.* (S2_1 only, as in
 S2_2 and TRUNK observer seems to have full control over nation
 selection...)
  - Take Player is always available for detached connections

 - Updated S2_2/TRUNK version that uses new client_has_player() -function.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/civclient.c freeciv/client/civclient.c
--- freeciv/client/civclient.c	2008-06-16 01:02:16.0 +0300
+++ freeciv/client/civclient.c	2008-06-16 04:49:56.0 +0300
@@ -741,14 +741,22 @@
 }
 
 /**
-  Returns TRUE if the client can issue orders (such as giving unit
+  Returns TRUE iff the client can control player.
+**/
+bool can_client_control(void)
+{
+  return (NULL != client.conn.playing
+	   !client_is_observer());
+}
+
+/**
+  Returns TRUE iff the client can issue orders (such as giving unit
   commands).  This function should be called each time before allowing the
   user to give an order.
 **/
 bool can_client_issue_orders(void)
 {
-  return (NULL != client.conn.playing
-	   !client_is_observer()
+  return (can_client_control()
 	   C_S_RUNNING == client_state());
 }
 
diff -Nurd -X.diff_ignore freeciv/client/civclient.h freeciv/client/civclient.h
--- freeciv/client/civclient.h	2008-06-16 01:02:16.0 +0300
+++ freeciv/client/civclient.h	2008-06-16 04:49:56.0 +0300
@@ -81,6 +81,7 @@
 void set_seconds_to_turndone(double seconds);
 int get_seconds_to_turndone(void);
 double real_timer_callback(void);
+bool can_client_control(void);
 bool can_client_issue_orders(void);
 bool can_client_change_view(void);
 bool can_meet_with_player(const struct player *pplayer);
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/gui_main.c freeciv/client/gui-gtk-2.0/gui_main.c
--- freeciv/client/gui-gtk-2.0/gui_main.c	2008-06-16 01:02:16.0 +0300
+++ freeciv/client/gui-gtk-2.0/gui_main.c	2008-06-16 04:51:35.0 +0300
@@ -1586,14 +1586,25 @@
   } else {
 gtk_stockbutton_set_label(ready_button, _(_Start));
   }
-  gtk_widget_set_sensitive(ready_button, (NULL != client.conn.playing));
 
-  gtk_stockbutton_set_label(nation_button, _(Pick _Nation));
-  if (NULL == client.conn.playing) {
+  /* Sensitive only if client can control player */
+  gtk_widget_set_sensitive(ready_button, can_client_control());
+
+  if (!client_has_player()) {
+/* Nation button will attach to player */
+gtk_stockbutton_set_label(nation_button, _(_Take Player));
+gtk_widget_set_sensitive(nation_button, TRUE);
+  } else {
+/* Nation button will go to Nation selection */
+gtk_stockbutton_set_label(nation_button, _(Pick _Nation));
+
+/* Sensitive iff client can select nation.
+ * FIXME: Observer can always select nations? */
 gtk_widget_set_sensitive(nation_button, game.info.is_new_game);
+ /*  can_client_control()); */
   }
 
-  if (NULL != client.conn.playing || !client.conn.observer) {
+  if (!client_is_observer()) {
 gtk_stockbutton_set_label(take_button, _(_Observe));
   } else {
 gtk_stockbutton_set_label(take_button, _(Do not _observe));
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40234) [Patch] Start button sensitivity

2008-05-09 Thread Madeline Book

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40234 

 [EMAIL PROTECTED] - Thu May 08 09:12:40 2008]:
 
 2008/5/8 Madeline Book:
 
[EMAIL PROTECTED] - Wed May 07 21:59:32 2008]:
   
 GTK-2
   
 Current Start button sensitivity checks against
 global observer, but
 observer attached to player cannot start game either.
 
   The start button should also not be sensitive for detached
   connections (not observer and not attached to a player).
 
  Fixed that one.
 
  I also found out that Pick Nation is sometimes used to create new
 player (without nations selection) and sometimes to select nation for
 existing player. Now button text changes accordingly.
  Sensitivity of the Take Player/Pick Nation adjusted fixing
  two bugs:
  - Pick Nation is not sensitive for observers.* (S2_1 only, as in
 S2_2 and TRUNK observer seems to have full control over nation
 selection...)
  - Take Player is always available for detached connections
 
 
  *) Similar change is later required for connection menu

I think Create Player or Become Player might be less
confusing than Take Player on account of the taking
of existing players done by the /take command already.


--
笑わずにキスをすることがきますか?

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


Re: [Freeciv-Dev] (PR#40234) [Patch] Start button sensitivity

2008-05-09 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40234 

2008/5/10 Madeline Book [EMAIL PROTECTED]:

  I think Create Player or Become Player might be less

 I considered those, as I think their meaning would be easier to
understand than Take Player. Problem is that sometimes it ends
creating player, and sometimes it takes existing player.

  confusing than Take Player on account of the taking
  of existing players done by the /take command already.

 This *is* /take -.


 - ML



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


Re: [Freeciv-Dev] (PR#40234) [Patch] Start button sensitivity

2008-05-08 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40234 

2008/5/8 Madeline Book:

   [EMAIL PROTECTED] - Wed May 07 21:59:32 2008]:
  
GTK-2
  
Current Start button sensitivity checks against global observer, but
   observer attached to player cannot start game either.

  The start button should also not be sensitive for detached
  connections (not observer and not attached to a player).

 Fixed that one.

 I also found out that Pick Nation is sometimes used to create new
player (without nations selection) and sometimes to select nation for
existing player. Now button text changes accordingly.
 Sensitivity of the Take Player/Pick Nation adjusted fixing two bugs:
 - Pick Nation is not sensitive for observers.* (S2_1 only, as in
S2_2 and TRUNK observer seems to have full control over nation
selection...)
 - Take Player is always available for detached connections


 *) Similar change is later required for connection menu


 - ML

diff -Nurd -X.diff_ignore freeciv/client/civclient.c freeciv/client/civclient.c
--- freeciv/client/civclient.c  2008-04-08 15:32:21.0 +0300
+++ freeciv/client/civclient.c  2008-05-08 11:46:28.0 +0300
@@ -741,14 +741,22 @@
 }
 
 /**
-  Returns TRUE if the client can issue orders (such as giving unit
+  Returns TRUE iff the client can control player.
+**/
+bool can_client_control(void)
+{
+  return (NULL != client.conn.playing
+  !client_is_observer());
+}
+
+/**
+  Returns TRUE iff the client can issue orders (such as giving unit
   commands).  This function should be called each time before allowing the
   user to give an order.
 **/
 bool can_client_issue_orders(void)
 {
-  return (NULL != client.conn.playing
-  !client_is_observer()
+  return (can_client_control()
   C_S_RUNNING == client_state());
 }
 
diff -Nurd -X.diff_ignore freeciv/client/civclient.h freeciv/client/civclient.h
--- freeciv/client/civclient.h  2008-03-08 16:33:11.0 +0200
+++ freeciv/client/civclient.h  2008-05-08 11:46:28.0 +0300
@@ -77,6 +77,7 @@
 void set_seconds_to_turndone(double seconds);
 int get_seconds_to_turndone(void);
 double real_timer_callback(void);
+bool can_client_control(void);
 bool can_client_issue_orders(void);
 bool can_client_change_view(void);
 bool can_meet_with_player(const struct player *pplayer);
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/gui_main.c 
freeciv/client/gui-gtk-2.0/gui_main.c
--- freeciv/client/gui-gtk-2.0/gui_main.c   2008-03-08 16:32:57.0 
+0200
+++ freeciv/client/gui-gtk-2.0/gui_main.c   2008-05-08 12:01:23.0 
+0300
@@ -1586,14 +1586,25 @@
   } else {
 gtk_stockbutton_set_label(ready_button, _(_Start));
   }
-  gtk_widget_set_sensitive(ready_button, (NULL != client.conn.playing));
 
-  gtk_stockbutton_set_label(nation_button, _(Pick _Nation));
-  if (NULL == client.conn.playing) {
+  /* Sensitive only if client can control player */
+  gtk_widget_set_sensitive(ready_button, can_client_control());
+
+  if (!client.conn.playing) {
+/* Nation button will attach to player */
+gtk_stockbutton_set_label(nation_button, _(_Take Player));
+gtk_widget_set_sensitive(nation_button, TRUE);
+  } else {
+/* Nation button will go to Nation selection */
+gtk_stockbutton_set_label(nation_button, _(Pick _Nation));
+
+/* Sensitive iff client can select nation.
+ * FIXME: Observer can always select nations? */
 gtk_widget_set_sensitive(nation_button, game.info.is_new_game);
+ /*  can_client_control()); */
   }
 
-  if (NULL != client.conn.playing || !client.conn.observer) {
+  if (!client_is_observer()) {
 gtk_stockbutton_set_label(take_button, _(_Observe));
   } else {
 gtk_stockbutton_set_label(take_button, _(Do not _observe));
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/gui_main.c 
freeciv/client/gui-gtk-2.0/gui_main.c
--- freeciv/client/gui-gtk-2.0/gui_main.c   2008-01-15 04:04:31.0 
+0200
+++ freeciv/client/gui-gtk-2.0/gui_main.c   2008-05-08 11:58:49.0 
+0300
@@ -1511,11 +1511,19 @@
   } else {
 gtk_stockbutton_set_label(ready_button, _(_Start));
   }
-  gtk_widget_set_sensitive(ready_button, (game.player_ptr != NULL));
 
-  gtk_stockbutton_set_label(nation_button, _(Pick _Nation));
-  if (!aconnection.player) {
-gtk_widget_set_sensitive(nation_button, game.info.is_new_game);
+  /* Observers and detached connections cannot start game. */
+  gtk_widget_set_sensitive(ready_button,
+   (!aconnection.observer  game.player_ptr));
+
+  if (!game.player_ptr) {
+gtk_stockbutton_set_label(nation_button, _(_Take Player));
+gtk_widget_set_sensitive(nation_button, TRUE);

[Freeciv-Dev] (PR#40234) [Patch] Start button sensitivity

2008-05-07 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40234 

 GTK-2

 Current Start button sensitivity checks against global observer, but
observer attached to player cannot start game either.

 Fix attached.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/gui_main.c freeciv/client/gui-gtk-2.0/gui_main.c
--- freeciv/client/gui-gtk-2.0/gui_main.c	2008-03-08 16:12:56.0 +0200
+++ freeciv/client/gui-gtk-2.0/gui_main.c	2008-05-08 00:48:29.0 +0300
@@ -1586,7 +1586,9 @@
   } else {
 gtk_stockbutton_set_label(ready_button, _(_Start));
   }
-  gtk_widget_set_sensitive(ready_button, (NULL != client.conn.playing));
+
+  /* Observer cannot start game. */
+  gtk_widget_set_sensitive(ready_button, (!client.conn.observer));
 
   gtk_stockbutton_set_label(nation_button, _(Pick _Nation));
   if (NULL == client.conn.playing) {
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/gui_main.c freeciv/client/gui-gtk-2.0/gui_main.c
--- freeciv/client/gui-gtk-2.0/gui_main.c	2008-01-15 04:04:31.0 +0200
+++ freeciv/client/gui-gtk-2.0/gui_main.c	2008-05-08 00:55:16.0 +0300
@@ -1511,7 +1511,9 @@
   } else {
 gtk_stockbutton_set_label(ready_button, _(_Start));
   }
-  gtk_widget_set_sensitive(ready_button, (game.player_ptr != NULL));
+
+  /* Observer cannot start game. */
+  gtk_widget_set_sensitive(ready_button, (!aconnection.observer));
 
   gtk_stockbutton_set_label(nation_button, _(Pick _Nation));
   if (!aconnection.player) {
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40234) [Patch] Start button sensitivity

2008-05-07 Thread Madeline Book

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40234 

 [EMAIL PROTECTED] - Wed May 07 21:59:32 2008]:
 
  GTK-2
 
  Current Start button sensitivity checks against global observer, but
 observer attached to player cannot start game either.

The start button should also not be sensitive for detached
connections (not observer and not attached to a player).


---
そのものを忘れないで下さい。

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