Re: [Freeciv-Dev] xaw client Find City and Airlift/Goto (PR#96)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--=====================_1519591==_
Content-Type: text/plain; charset="us-ascii"
At 1999/07/29 21:47 , David Pfitzner wrote:
>But those dialogs can still be useful if the player has no cities,
>but knows of some enemy cities.
I thought this kind of unlikely, but it's just a *little* more code... ;-)
This patch replaces my earlier patch. It does:
1. Fixed Goto/Airlift to be able to handle opening with no cities
owned by player, but with some known cities owned by others.
(Also, improved sensitivity setting of Airlift button.)
2. Disabled Find City and Airlift/Goto menus if no cities known at all.
3. Had to add a call to update_menus() in packhand.c.
jjm
--=====================_1519591==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment;
filename="pr73-find-city-airlift-goto-dialogs.diff"
diff -ruN -X /home/jjm/cvs/no.freeciv FreecivCVS/client/gui-xaw/gotodlg.c
freeciv/client/gui-xaw/gotodlg.c
--- FreecivCVS/client/gui-xaw/gotodlg.c Sat Jul 31 11:37:33 1999
+++ freeciv/client/gui-xaw/gotodlg.c Sun Aug 1 14:49:10 1999
@@ -94,6 +94,7 @@
{
Position x, y;
Dimension width, height;
+ Boolean no_player_cities = !(city_list_size(&game.player_ptr->cities));
if(get_client_state()!=CLIENT_GAME_RUNNING_STATE)
return;
@@ -142,6 +143,8 @@
goto_all_toggle = XtVaCreateManagedWidget("gotoalltoggle",
toggleWidgetClass,
goto_form,
+ XtNstate, no_player_cities,
+ XtNsensitive, !no_player_cities,
NULL);
goto_cancel_command = XtVaCreateManagedWidget("gotocancelcommand",
@@ -333,6 +336,8 @@
int i;
XawListChange(goto_list, dummy_city_list, 0, 0, FALSE);
+
+ XtSetSensitive(goto_airlift_command, False);
if(city_name_ptrs) {
for(i=0; i<ncities_total; i++) {
diff -ruN -X /home/jjm/cvs/no.freeciv FreecivCVS/client/gui-xaw/menu.c
freeciv/client/gui-xaw/menu.c
--- FreecivCVS/client/gui-xaw/menu.c Sat Jul 24 01:31:22 1999
+++ freeciv/client/gui-xaw/menu.c Sun Aug 1 14:34:03 1999
@@ -245,16 +245,24 @@
menu_entry_sensitive(game_menu, MENU_GAME_SERVER_OPTIONS2, 1);
menu_entry_sensitive(game_menu, MENU_GAME_OUTPUT_LOG, 1);
menu_entry_sensitive(game_menu, MENU_GAME_CLEAR_OUTPUT, 1);
- menu_entry_sensitive(game_menu, MENU_GAME_FIND_CITY, 0);
-
}
else {
struct unit *punit;
+ int i;
+ int any_cities = FALSE;
+
+ for(i=0; i<game.nplayers; i++) {
+ if (city_list_size(&game.players[i].cities)) {
+ any_cities = TRUE;
+ break;
+ }
+ }
+
XtVaSetValues(reports_menu->button, XtNsensitive, True, NULL);
XtVaSetValues(orders_menu->button, XtNsensitive, True, NULL);
XtVaSetValues(view_menu->button, XtNsensitive, True, NULL);
- menu_entry_sensitive(game_menu, MENU_GAME_FIND_CITY, 1);
+ menu_entry_sensitive(game_menu, MENU_GAME_FIND_CITY, any_cities);
menu_entry_sensitive(game_menu, MENU_GAME_OPTIONS, 1);
menu_entry_sensitive(game_menu, MENU_GAME_MSG_OPTIONS, 1);
menu_entry_sensitive(game_menu, MENU_GAME_SAVE_SETTINGS, 1);
@@ -267,7 +275,6 @@
menu_entry_sensitive(game_menu, MENU_GAME_OUTPUT_LOG, 1);
menu_entry_sensitive(game_menu, MENU_GAME_CLEAR_OUTPUT, 1);
menu_entry_sensitive(game_menu, MENU_GAME_DISCONNECT, 1);
- menu_entry_sensitive(game_menu, MENU_GAME_FIND_CITY, 1);
menu_entry_sensitive(reports_menu, MENU_REPORT_SPACESHIP,
(game.player_ptr->spaceship.state!=SSHIP_NONE));
@@ -323,6 +330,8 @@
menu_entry_sensitive(orders_menu, MENU_ORDER_WAKEUP,
is_unit_activity_on_tile(ACTIVITY_SENTRY,
punit->x,punit->y));
+ menu_entry_sensitive(orders_menu, MENU_ORDER_GOTO_CITY,
+ any_cities);
menu_entry_sensitive(orders_menu, MENU_ORDER_BUILD_WONDER,
unit_can_help_build_wonder_here(punit));
menu_entry_sensitive(orders_menu, MENU_ORDER_TRADE_ROUTE,
diff -ruN -X /home/jjm/cvs/no.freeciv FreecivCVS/client/packhand.c
freeciv/client/packhand.c
--- FreecivCVS/client/packhand.c Sat Jul 24 01:31:11 1999
+++ freeciv/client/packhand.c Sun Aug 1 14:30:11 1999
@@ -247,9 +247,11 @@
if(((city_is_new && get_client_state()==CLIENT_GAME_RUNNING_STATE &&
pcity->owner==game.player_idx) || packet->diplomat_investigate) &&
- (!game.player_ptr->ai.control || ai_popup_windows))
+ (!game.player_ptr->ai.control || ai_popup_windows)) {
+ update_menus();
popup_city_dialog(pcity, 0);
-
+ }
+
if(!city_is_new && pcity->owner==game.player_idx) {
struct unit *punit = get_unit_in_focus();
if (punit && (punit->x == pcity->x) && (punit->y == pcity->y)) {
--=====================_1519591==_--
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Freeciv-Dev] xaw client Find City and Airlift/Goto (PR#96),
jjm <=
|
|