bugfix owners V

This commit is contained in:
Enno Rehling 2001-02-11 14:26:40 +00:00
parent 99bf6d0637
commit 96e81a669f
1 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: laws.c,v 1.16 2001/02/11 13:50:39 enno Exp $ * $Id: laws.c,v 1.17 2001/02/11 14:26:40 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -2111,6 +2111,7 @@ reorder_owners(region * r)
unit ** up=&r->units, ** useek; unit ** up=&r->units, ** useek;
building * b=NULL; building * b=NULL;
ship * sh=NULL; ship * sh=NULL;
int len = listlen(r->units);
for (b = r->buildings;b;b=b->next) { for (b = r->buildings;b;b=b->next) {
unit ** ubegin = up; unit ** ubegin = up;
@ -2144,11 +2145,13 @@ reorder_owners(region * r)
fprintf(stderr, "WARNING: Einheit %s war Besitzer von nichts.\n", unitname(u)); fprintf(stderr, "WARNING: Einheit %s war Besitzer von nichts.\n", unitname(u));
freset(u, FL_OWNER); freset(u, FL_OWNER);
} }
*useek = u->next; if (useek!=up) {
useek = &u->next; *useek = u->next; /* raus aus der liste */
u->next = *up; u->next = *up;
up = &u->next; *up = u;
} else useek=&u->next; }
}
if (*useek==u) useek = &u->next;
} }
for (sh = r->ships;sh;sh=sh->next) { for (sh = r->ships;sh;sh=sh->next) {
@ -2173,6 +2176,7 @@ reorder_owners(region * r)
} }
up = uend; up = uend;
} }
assert(len==listlen(r->units));
} }
#if 0 #if 0