Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] Re: (PR#6785) Assertion triggers in 1.14-beta2!
Home

[Freeciv-Dev] Re: (PR#6785) Assertion triggers in 1.14-beta2!

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: matusik_s@xxxxx
Subject: [Freeciv-Dev] Re: (PR#6785) Assertion triggers in 1.14-beta2!
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Fri, 7 Nov 2003 02:13:51 -0800
Reply-to: rt@xxxxxxxxxxx

On Thu, 6 Nov 2003, mateusz stefek wrote:
> kaboom!!

I can reproduce this with beta3. The cause is civil war. This is fixed in
CVS HEAD by a rather large cleanup (by me). The following kludge should
stop the bug from taking down beta3 games:

Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.23.2.1
diff -u -r1.23.2.1 sanitycheck.c
--- server/sanitycheck.c        22 Sep 2003 04:42:47 -0000      1.23.2.1
+++ server/sanitycheck.c        7 Nov 2003 10:11:20 -0000
@@ -21,6 +21,7 @@
 #include "unit.h"

 #include "maphand.h"
+#include "unittools.h"

@@ -110,12 +111,22 @@
       assert(same_pos(pcity->x, pcity->y, x, y));
     }

+    restart:
     unit_list_iterate(ptile->units, punit) {
       assert(same_pos(punit->x, punit->y, x, y));

       /* Check diplomatic status of stacked units. */
       unit_list_iterate(ptile->units, punit2) {
-       assert(pplayers_allied(unit_owner(punit), unit_owner(punit2)));
+       if (!pplayers_allied(unit_owner(punit), unit_owner(punit2))) {
+          freelog(LOG_ERROR, "Erronous stacking detected on tile (%d, %d)
"
+                  "between %s's %s and %s's %s. The latter unit was "
+                  "deleted.", punit->x, punit->y, unit_owner(punit)->name,
+                  unit_name(punit->type), unit_owner(punit2)->name,
+                  unit_name(punit2->type));
+          wipe_unit(punit2);
+          goto restart; /* iterators no longer guaranteed sane */
+        }
       } unit_list_iterate_end;
       if (pcity) {
        assert(pplayers_allied(unit_owner(punit), city_owner(pcity)));

  - Per




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