Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2003:
[Freeciv-Dev] Re: (PR#4329) Silly messages
Home

[Freeciv-Dev] Re: (PR#4329) Silly messages

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ChrisK@xxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4329) Silly messages
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 31 May 2003 05:44:29 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Fri, 30 May 2003, ChrisK@xxxxxxxx wrote:
> CVS 30 MAY 2003 GTK 1.2 (12 hours ago)
>
> I get a lot messages like
> Production of Cruiser updated to Cruiser in Cordoba
> Productin of Riflemen upgraded to Riflemen in Leon
>
> *each*turn*
>
> Savegame attached.

Uh, I'm sorry about that. Fix attached. I'll commit at once to remove
those annoying messages.

  - Per

Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.213
diff -u -r1.213 cityturn.c
--- server/cityturn.c   28 May 2003 21:26:18 -0000      1.213
+++ server/cityturn.c   31 May 2003 12:42:23 -0000
@@ -849,13 +849,19 @@
 **************************************************************************/
 static Unit_Type_id unit_upgrades_to(struct city *pcity, Unit_Type_id id)
 {
-  Unit_Type_id latest_ok = id;
+  Unit_Type_id check = id, latest_ok = id;
 
-  if (!can_build_unit_direct(pcity, id))
+  if (!can_build_unit_direct(pcity, check)) {
     return -1;
-  while(unit_type_exists(id = unit_types[id].obsoleted_by))
-    if (can_build_unit_direct(pcity, id))
-      latest_ok = id;
+  }
+  while(unit_type_exists(check = unit_types[check].obsoleted_by)) {
+    if (can_build_unit_direct(pcity, check)) {
+      latest_ok = check;
+    }
+  }
+  if (latest_ok == id) {
+    return -1; /* Can't upgrade */
+  }
 
   return latest_ok;
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#4329) Silly messages, Per I. Mathisen <=