Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] Re: (PR#4024) New tech aquired
Home

[Freeciv-Dev] Re: (PR#4024) New tech aquired

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: a-l@xxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4024) New tech aquired
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 27 Apr 2003 07:45:24 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Fri, 18 Apr 2003, a-l@xxxxxxx wrote:
> Change an instance of "poptechup" to "new_tech_aquired" in
> packhand.c: handle_player_info().
>
> In this and maybe future cases it is useful to distinguish between
> "change current research" (causes popup) and "gained a new tech"
> (maybe through treaty or looting).

My fix (committed) attached. See cvs message for more info.

  - Per

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.301
diff -u -r1.301 packhand.c
--- client/packhand.c   17 Apr 2003 20:06:35 -0000      1.301
+++ client/packhand.c   27 Apr 2003 14:38:19 -0000
@@ -1281,7 +1281,7 @@
 void handle_player_info(struct packet_player_info *pinfo)
 {
   int i;
-  bool poptechup = FALSE;
+  bool poptechup, new_tech;
   char msg[MAX_LEN_MSG];
   struct player *pplayer = &game.players[pinfo->playerno];
 
@@ -1317,12 +1317,11 @@
   if (pplayer->is_connected
       || get_client_state() == CLIENT_GAME_RUNNING_STATE
       || get_client_state() == CLIENT_GAME_OVER_STATE) {
-    poptechup = poptechup || read_player_info_techs(pplayer, 
pinfo->inventions);
+    new_tech = read_player_info_techs(pplayer, pinfo->inventions);
   }
 
   poptechup = (pplayer->research.researching != pinfo->researching
-               || pplayer->ai.tech_goal != pinfo->tech_goal
-               || poptechup);
+               || pplayer->ai.tech_goal != pinfo->tech_goal);
   pplayer->research.bulbs_researched = pinfo->bulbs_researched;
   pplayer->research.techs_researched = pinfo->techs_researched;
   pplayer->research.researching=pinfo->researching;
@@ -1330,17 +1329,20 @@
   pplayer->ai.tech_goal=pinfo->tech_goal;
   
   if (can_client_change_view() && pplayer == game.player_ptr) {
-    if(poptechup) {
-      if(!game.player_ptr->ai.control || ai_popup_windows)
+    if (poptechup) {
+      if (!game.player_ptr->ai.control || ai_popup_windows) {
        popup_science_dialog(FALSE);
+      }
       science_dialog_update();
-
+    }
+    if (new_tech) {
       /* If we just learned bridge building and focus is on a settler
         on a river the road menu item will remain disabled unless we
         do this. (applys in other cases as well.) */
-      if (get_unit_in_focus())
+      if (get_unit_in_focus()) {
        update_menus();
-    } 
+      }
+    }
   }
 
   if (pplayer == game.player_ptr && pplayer->turn_done != pinfo->turn_done) {

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