Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
[Freeciv-Dev] xaw client Find City and Airlift/Goto dialogs report empty
Home

[Freeciv-Dev] xaw client Find City and Airlift/Goto dialogs report empty

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] xaw client Find City and Airlift/Goto dialogs report empty malloc if no cities (PR#73)
From: jjm@xxxxxxxxxxxx
Date: Sat, 24 Jul 1999 21:11:04 -0700 (PDT)

Full_Name: Jeff Mallatt
Version: 1.8.1
OS: Linux
Submission from: (NULL) (199.103.194.35)


In the xaw client, the Find City and Airlift/Goto dialogs report an empty
malloc
if opened when there are no cities.

This patch fixes the problem by simply disabling these menu items if the player
has no cities.

diff -Nur freeciv-old/client/gui-xaw/menu.c freeciv/client/gui-xaw/menu.c
--- freeciv-old/client/gui-xaw/menu.c   Sat Jul 24 01:31:22 1999
+++ freeciv/client/gui-xaw/menu.c       Sat Jul 24 12:01:17 1999
@@ -245,7 +245,6 @@
     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 {
@@ -253,8 +252,9 @@
     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,
+                        city_list_size(&game.player_ptr->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 +268,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 +323,10 @@
       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,
+                          city_list_size(&game.player_ptr->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,



[Prev in Thread] Current Thread [Next in Thread]