Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2002:
[Freeciv-Dev] Civserver upgrade building (PR#1585)
Home

[Freeciv-Dev] Civserver upgrade building (PR#1585)

[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] Civserver upgrade building (PR#1585)
From: dspeyer@xxxxxxxxxxx
Date: Mon, 17 Jun 2002 12:55:11 -0700 (PDT)

Full_Name: Daniel Speyer
Version: CVS 
Distribution: Built from source
Client: Both (or N/A)
OS: Gnu/Linux -- Debian woody
Submission from: (NULL) (12.243.200.32)


If you develope musketeers before pikemen, your cities will continue to build
phalanxes.  This can be very annoying.  This patch should fix it (apply to
freeciv/server/cityturn.c):


diff -u cityturn.c.old cityturn.c
--- cityturn.c.old      Mon Jun 17 15:40:04 2002
+++ cityturn.c  Mon Jun 17 15:41:09 2002
@@ -842,13 +842,13 @@
 **************************************************************************/
 static Unit_Type_id unit_upgrades_to(struct city *pcity, Unit_Type_id id)
 {
-  Unit_Type_id latest_ok = id;
-
-  if (!can_build_unit_direct(pcity, id))
-    return -1;
-  while(unit_type_exists(id = unit_types[id].obsoleted_by))
-    if (can_build_unit_direct(pcity, id))
+  Unit_Type_id latest_ok = -1;
+  
+  for(; unit_type_exists(id); id = unit_types[id].obsoleted_by){
+    if (can_build_unit_direct(pcity, id)){
       latest_ok = id;
+    }
+  }
 
   return latest_ok;
 }




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