prüfroutine und korrektur für verpfuschte besitzer-flags

This commit is contained in:
Enno Rehling 2001-02-12 23:06:44 +00:00
parent 92c3d3f8be
commit 45d09b12fb
2 changed files with 65 additions and 6 deletions

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* $Id: laws.c,v 1.20 2001/02/12 22:39:56 enno Exp $
* $Id: laws.c,v 1.21 2001/02/12 23:06:44 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -2105,7 +2105,7 @@ sinkships(void)
#include "eressea.h"
#include "build.h"
static void
void
reorder_owners(region * r)
{
unit ** up=&r->units, ** useek;
@ -2122,7 +2122,14 @@ reorder_owners(region * r)
unit * u = *useek;
if (u->building==b) {
unit ** insert;
if (fval(u, FL_OWNER)) insert=ubegin;
if (fval(u, FL_OWNER)) {
unit * nu = *ubegin;
insert=ubegin;
if (nu && nu->building==u->building && fval(nu, FL_OWNER)) {
log_error(("[reorder_owners] %s hat mehrere Besitzer mit FL_OWNER.\n", buildingname(nu->building)));
freset(nu, FL_OWNER);
}
}
else insert = uend;
if (insert!=useek) {
*useek = u->next; /* raus aus der liste */
@ -2164,7 +2171,14 @@ reorder_owners(region * r)
unit * u = *useek;
if (u->ship==sh) {
unit ** insert;
if (fval(u, FL_OWNER)) insert=ubegin;
if (fval(u, FL_OWNER)) {
unit * nu = *ubegin;
insert = ubegin;
if (nu && nu->ship==u->ship && fval(nu, FL_OWNER)) {
log_error(("[reorder_owners] %s hat mehrere Besitzer mit FL_OWNER.\n", shipname(nu->ship)));
freset(nu, FL_OWNER);
}
}
else insert = uend;
if (insert!=useek) {
*useek = u->next; /* raus aus der liste */

View file

@ -1,6 +1,6 @@
/* vi: set ts=2:
*
* $Id: korrektur.c,v 1.21 2001/02/12 22:39:57 enno Exp $
* $Id: korrektur.c,v 1.22 2001/02/12 23:06:44 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
@ -32,6 +32,7 @@
/* kernel includes */
#include <border.h>
#include <building.h>
#include <ship.h>
#include <faction.h>
#include <item.h>
#include <magic.h>
@ -66,6 +67,49 @@
#include <attributes/targetregion.h>
#include <attributes/key.h>
extern void reorder_owners(struct region * r);
static void
verify_owners(boolean bOnce)
{
region * r;
for (r=regions;r;r=r->next) {
unit * u;
boolean bFail = false;
for (u=r->units;u;u=u->next) {
if (u->building) {
unit * bo = buildingowner(r, u->building);
if (!fval(bo, FL_OWNER)) {
log_error(("[verify_owners] %u ist Besitzer von %s, hat aber FL_OWNER nicht.\n", unitname(bo), buildingname(u->building)));
bFail = true;
if (bOnce) break;
}
if (bo!=u && fval(bo, FL_OWNER)) {
log_error(("[verify_owners] %u ist NICHT Besitzer von %s, hat aber FL_OWNER.\n", unitname(u), buildingname(u->building)));
bFail = true;
if (bOnce) break;
}
}
if (u->ship) {
unit * bo = shipowner(r, u->ship);
if (!fval(bo, FL_OWNER)) {
log_error(("[verify_owners] %u ist Besitzer von %s, hat aber FL_OWNER nicht.\n", unitname(bo), shipname(u->ship)));
bFail = true;
if (bOnce) break;
}
if (bo!=u && fval(bo, FL_OWNER)) {
log_error(("[verify_owners] %u ist NICHT Besitzer von %s, hat aber FL_OWNER.\n", unitname(u), shipname(u->ship)));
bFail = true;
if (bOnce) break;
}
}
}
if (bFail) reorder_owners(r);
}
}
static void
fix_skills(void)
{
@ -1909,7 +1953,8 @@ korrektur(void)
#endif
make_gms();
/* Wieder entfernen! */
do_once(atoi36("trgr"), fix_targetregion_resolve())
do_once(atoi36("trgr"), fix_targetregion_resolve());
verify_owners(false);
/* fix_herbtypes(); */
#ifdef CONVERT_TRIGGER