Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] bug in combat.c: get_defender
Home

[Freeciv-Dev] bug in combat.c: get_defender

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] bug in combat.c: get_defender
From: Lobo Gris <molv@xxxxxxxxxxxxx>
Date: Sun, 17 Aug 2003 00:44:32 -0300
Reply-to: molv@xxxxxxxxxxxxx

This happens when a sea transport unit of nation A contains allies of nation B, 
and there is an attacker of nation C which is allied of A but is not allied of 
B, so the algorithm does not find a defender, but the number of enemies of C is 
greater than 0 (this condition generates the assertion).

In this concrete case, Alexander and Tiglath are my allies, but they aren't 
allied between them, and Tiglath settlers are inside my trirreme.

1: get_defender bug: Alexander's Caravel vs Tiglath-Pileser's Settlers (total 3 
units) on Ocean at (5,3). 
civserver: combat.c:647: get_defender: Assertion `false' failed.
Aborted

I think the best fix is to delete the following lines, which are senseless 
since the AI can be allied with humans:


  if (count > 0 && !bestdef) {
    struct tile *ptile = map_get_tile(x, y);
    struct unit *punit = unit_list_get(&ptile->units, 0);

    freelog(LOG_ERROR, "get_defender bug: %s's %s vs %s's %s (total %d"
            " units) on %s at (%d,%d). ", unit_owner(attacker)->name,
            unit_type(attacker)->name, unit_owner(punit)->name,
            unit_type(punit)->name, unit_list_size(&ptile->units),
            get_terrain_name(ptile->terrain), x, y);
    assert(FALSE);
  }



[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] bug in combat.c: get_defender, Lobo Gris <=