Complete.Org: Mailing Lists: Archives: freeciv-ai: November 2004:
[freeciv-ai] (PR#11066) Units that cannot be obsoleted trigger assert fo
Home

[freeciv-ai] (PR#11066) Units that cannot be obsoleted trigger assert fo

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [freeciv-ai] (PR#11066) Units that cannot be obsoleted trigger assert for AI
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Wed, 17 Nov 2004 22:03:44 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=11066 >

In advmilitary.c:
819  !can_build_unit_direct(pcity, unit_types[unit_type].obsoleted_by))

But obsoleted_by can be -1 (meaning nobody obsoletes it).  But
can_build_unit functions have just been made more strict, which causes
and assert.

I attach a patch but would rather have can_build_unit_* changed to the
previous behaviour -- if a looney type is supplied, the answer is of
course FALSE.

Gr
Index: ai/advmilitary.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v
retrieving revision 1.176
diff -u -r1.176 advmilitary.c
--- ai/advmilitary.c    30 Oct 2004 14:04:54 -0000      1.176
+++ ai/advmilitary.c    18 Nov 2004 05:59:35 -0000
@@ -815,8 +815,10 @@
     
     if ((move_type == LAND_MOVING || (move_type == SEA_MOVING && shore))
         && tech_req != A_LAST
-        && (tech_dist > 0 ||
-            !can_build_unit_direct(pcity, unit_types[unit_type].obsoleted_by))
+        && (tech_dist > 0 
+            || unit_types[unit_type].obsoleted_by == -1
+            || !can_build_unit_direct(pcity, 
+                                      unit_types[unit_type].obsoleted_by))
         && unit_types[unit_type].attack_strength > 0 /* or we'll get SIGFPE */
         && move_type == orig_move_type) {
       /* TODO: Case for Airport. -- Raahul */

[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] (PR#11066) Units that cannot be obsoleted trigger assert for AI, Gregory Berkolaiko <=