<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.000000000 +0300
+++ freeciv/client/civclient.c 2008-06-16 04:49:56.000000000 +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.000000000 +0300
+++ freeciv/client/civclient.h 2008-06-16 04:49:56.000000000 +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.000000000 +0300
+++ freeciv/client/gui-gtk-2.0/gui_main.c 2008-06-16 04:51:35.000000000 +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
[email protected]
https://mail.gna.org/listinfo/freeciv-dev