Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] Re: (PR#18220) [Patch] Fix ai_choose_help_wonder() crash
Home

[Freeciv-Dev] Re: (PR#18220) [Patch] Fix ai_choose_help_wonder() crash

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: marko.lindqvist@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#18220) [Patch] Fix ai_choose_help_wonder() crash
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Sun, 2 Jul 2006 04:35:11 -0700
Reply-to: bugs@xxxxxxxxxxx

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

 Updated comment.
 Also patch for S2_1 added. It seems identical, but for some reason
trunk version did not apply.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/advdomestic.c freeciv/ai/advdomestic.c
--- freeciv/ai/advdomestic.c    2006-06-30 20:33:15.671875000 +0300
+++ freeciv/ai/advdomestic.c    2006-07-02 13:40:40.140625000 +0300
@@ -118,13 +118,13 @@
       /* This sets our tech want in cases where we cannot actually build
        * the unit. */
       unit_type = ai_wants_role_unit(pplayer, pcity, F_HELP_WONDER, want);
-      if (can_build_unit(pcity, unit_type)) {
+      if (unit_type != NULL) {
         choice->want = want;
         choice->type = CT_NONMIL;
         choice->choice = unit_type->index;
       } else {
-        CITY_LOG(LOG_DEBUG, pcity, "would but could not build %s, bumped reqs",
-                 unit_name(unit_type));
+        CITY_LOG(LOG_DEBUG, pcity,
+                 "would but could not build F_HELP_WONDER unit, bumped reqs");
       }
     }
   }
diff -Nurd -X.diff_ignore freeciv/ai/aitech.c freeciv/ai/aitech.c
--- freeciv/ai/aitech.c 2006-06-30 20:33:17.796875000 +0300
+++ freeciv/ai/aitech.c 2006-07-02 13:43:13.406250000 +0300
@@ -207,7 +207,7 @@
 }
 
 /**************************************************************************
-  Returns the best unit we can build, or U_LAST if none.  "Best" here
+  Returns the best unit we can build, or NULL if none. "Best" here
   means last in the unit list as defined in the ruleset.  Assigns tech 
   wants for techs to get better units with given role, but only for the
   cheapest to research "next" unit up the "chain".
diff -Nurd -X.diff_ignore freeciv/ai/advdomestic.c freeciv/ai/advdomestic.c
--- freeciv/ai/advdomestic.c    2006-02-05 13:38:47.421875000 +0200
+++ freeciv/ai/advdomestic.c    2006-07-02 14:28:12.500000000 +0300
@@ -118,13 +118,13 @@
       /* This sets our tech want in cases where we cannot actually build
        * the unit. */
       unit_type = ai_wants_role_unit(pplayer, pcity, F_HELP_WONDER, want);
-      if (can_build_unit(pcity, unit_type)) {
+      if (unit_type != NULL) {
         choice->want = want;
         choice->type = CT_NONMIL;
         choice->choice = unit_type->index;
       } else {
-        CITY_LOG(LOG_DEBUG, pcity, "would but could not build %s, bumped reqs",
-                 unit_name(unit_type));
+        CITY_LOG(LOG_DEBUG, pcity,
+                 "would but could not build F_HELP_WONDER unit, bumped reqs");
       }
     }
   }
diff -Nurd -X.diff_ignore freeciv/ai/aitech.c freeciv/ai/aitech.c
--- freeciv/ai/aitech.c 2006-02-05 13:38:48.328125000 +0200
+++ freeciv/ai/aitech.c 2006-07-02 14:29:03.828125000 +0300
@@ -207,7 +207,7 @@
 }
 
 /**************************************************************************
-  Returns the best unit we can build, or U_LAST if none.  "Best" here
+  Returns the best unit we can build, or NULL if none.  "Best" here
   means last in the unit list as defined in the ruleset.  Assigns tech 
   wants for techs to get better units with given role, but only for the
   cheapest to research "next" unit up the "chain".

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