Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] Re: (PR#13885) "Technology goal is Magnetism"
Home

[Freeciv-Dev] Re: (PR#13885) "Technology goal is Magnetism"

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#13885) "Technology goal is Magnetism"
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 8 Sep 2005 12:57:21 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13885 >

Jason Short wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13885 >
> 
> Clicking on the tech tree will repeatedly bring up the same message 
> ("Technology goal is Magnetism") in the messages dialog.  Obviously the 
> text should not be sent by the server if the goal isn't changed.

These patches fix it for 2.0 and the development version.

-jason

Index: server/techtools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/techtools.c,v
retrieving revision 1.24
diff -p -u -r1.24 techtools.c
--- server/techtools.c  8 Sep 2005 19:51:23 -0000       1.24
+++ server/techtools.c  8 Sep 2005 19:55:49 -0000
@@ -574,12 +574,16 @@ void choose_tech(struct player *plr, Tec
 ****************************************************************************/
 void choose_tech_goal(struct player *plr, Tech_type_id tech)
 {
-  /* It's been suggested that if the research target is empty then
-   * choose_random_tech should be called here. */
-  notify_player(plr, NULL, E_TECH_GAIN /* ? */,
-               _("Technology goal is %s."),
-               get_tech_name(plr, tech));
-  get_player_research(plr)->tech_goal = tech;
+  struct player_research *research = get_player_research(plr);
+
+  if (research && tech != research->tech_goal) {
+    /* It's been suggested that if the research target is empty then
+     * choose_random_tech should be called here. */
+    notify_player(plr, NULL, E_TECH_GAIN /* ? */,
+                 _("Technology goal is %s."),
+                 get_tech_name(plr, tech));
+    research->tech_goal = tech;
+  }
 }
 
 /****************************************************************************
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.330.2.37
diff -p -u -r1.330.2.37 plrhand.c
--- server/plrhand.c    8 Sep 2005 06:21:06 -0000       1.330.2.37
+++ server/plrhand.c    8 Sep 2005 19:56:06 -0000
@@ -676,9 +676,11 @@ void choose_tech(struct player *plr, int
 
 void choose_tech_goal(struct player *plr, int tech)
 {
-  notify_player(plr, _("Game: Technology goal is %s."),
-               get_tech_name(plr, tech));
-  plr->ai.tech_goal = tech;
+  if (plr->ai.tech_goal != tech) {
+    notify_player(plr, _("Game: Technology goal is %s."),
+                 get_tech_name(plr, tech));
+    plr->ai.tech_goal = tech;
+  }
 }
 
 /**************************************************************************

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