Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] (PR#4620) Re: Re: (PR#5106) assertion in get_defender
Home

[Freeciv-Dev] (PR#4620) Re: Re: (PR#5106) assertion in get_defender

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx, ChrisK@xxxxxxxx, kenn@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#4620) Re: Re: (PR#5106) assertion in get_defender
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Aug 2003 09:08:08 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Gregory Berkolaiko wrote:
> On Fri, 15 Aug 2003, Jason Short wrote:
> 
> 
>>>Now it crashes earlier:
>>>
>>>1: get_defender bug: b's Battleship vs Palmiro Togliatti's Transport 
>>>(total 2 units) on Ocean at (29,39).
>>> > civserver: combat.c:626: get_defender: Assertion `0' failed.
>>>Aborted (core dumped)
>>
>>The battleship is attacking a transport.  The transport's tile contains
>>a second unit - the Mech. Inf. from an allied player that is being
>>transported_by the transport.
> 
> 
> This particular occurence is described in my latest email under PR#4260

Calling can_unit_attack_unit_at_tile is not enough.  In fact, it's 
already done.  We need to call can_player_attack_tile.  Or perhaps 
can_unit_attack_unit_at_tile should call this function?

I'm not sure about your proposed long-term solution.  Do all 
get_defender users correctly check can_player_attack_tile?

jason

Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.282
diff -u -r1.282 aiunit.c
--- ai/aiunit.c 2003/08/08 22:11:41     1.282
+++ ai/aiunit.c 2003/08/15 16:05:04
@@ -2230,7 +2230,8 @@
         continue;
       }
 
-      if (!can_unit_attack_unit_at_tile(punit, aunit, aunit->x, aunit->y)
+      if (!can_player_attack_tile(pplayer, aunit->x, aunit->y)
+         || !can_unit_attack_unit_at_tile(punit, aunit, aunit->x, aunit->y)
           || !(aunit == get_defender(punit, aunit->x, aunit->y))) {
         /* We cannot attack it, or it is not the main defender. */
         continue;

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