forked from github/server
bugfix owners II
This commit is contained in:
parent
3b9145d084
commit
ee48ac4893
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: laws.c,v 1.13 2001/02/11 12:10:58 enno Exp $
|
* $Id: laws.c,v 1.14 2001/02/11 12:56:27 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)
|
||||||
|
@ -2110,64 +2110,74 @@ resolve_ship(void * id) {
|
||||||
return findship((int)id);
|
return findship((int)id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
static void
|
||||||
reorder_owners(region * r)
|
reorder_owners(region * r)
|
||||||
{
|
{
|
||||||
unit ** up=&r->units;
|
unit ** up=&r->units, ** useek;
|
||||||
building * b=NULL;
|
building * b=NULL;
|
||||||
ship * sh=NULL;
|
ship * sh=NULL;
|
||||||
while (*up) {
|
|
||||||
unit * u = *up;
|
for (b = r->buildings;b;b=b->next) {
|
||||||
if (u->building!=b) {
|
unit ** ubegin = up;
|
||||||
/* if this is a new building */
|
unit ** uend = up;
|
||||||
b = u->building;
|
|
||||||
if (b && !fval(u, FL_OWNER)) {
|
useek = up;
|
||||||
/* if the first unit is not the owner, find the real one */
|
while (*useek) {
|
||||||
unit ** uo = &u->next;
|
unit * u = *useek;
|
||||||
while (*uo && (!fval((*uo), FL_OWNER) || (*uo)->building!=b)) {
|
if (u->building==b) {
|
||||||
uo=&(*uo)->next;
|
unit ** insert;
|
||||||
|
if (fval(u, FL_OWNER)) insert=ubegin;
|
||||||
|
else insert = uend;
|
||||||
|
if (insert!=up) {
|
||||||
|
*useek = u->next; /* raus aus der liste */
|
||||||
|
u->next = *insert;
|
||||||
|
*insert = u;
|
||||||
|
}
|
||||||
|
if (insert==uend) uend=&u->next;
|
||||||
|
}
|
||||||
|
if (*useek==u) useek = &u->next;
|
||||||
|
}
|
||||||
|
up = uend;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*uo && (*uo)->building==b) {
|
useek=up;
|
||||||
/* if successful, move *uo to the top */
|
while (*useek) {
|
||||||
*up = *uo;
|
unit * u = *useek;
|
||||||
*uo = (*uo)->next;
|
assert(!u->building);
|
||||||
(*up)->next = u;
|
if (u->ship==NULL) {
|
||||||
}
|
assert(!fval(u, FL_OWNER));
|
||||||
else {
|
*useek = u->next;
|
||||||
fprintf(stderr, "WARNING: Gebäude %s hatte keinen Besitzer. Setze %s\n", buildingname(b), unitname(u));
|
useek = &u->next;
|
||||||
fset(u, FL_OWNER);
|
u->next = *up;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (u->ship!=sh) {
|
|
||||||
/* if this is a new ship */
|
|
||||||
sh = u->ship;
|
|
||||||
if (sh && !fval(u, FL_OWNER)) {
|
|
||||||
/* if the first unit is not the owner, find the real one */
|
|
||||||
unit ** uo = &u->next;
|
|
||||||
while (*uo && (!fval((*uo), FL_OWNER) || (*uo)->ship!=sh)) {
|
|
||||||
uo=&(*uo)->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*uo && (*uo)->ship==sh) {
|
|
||||||
/* if successful, move *uo to the top */
|
|
||||||
*up = *uo;
|
|
||||||
*uo = (*uo)->next;
|
|
||||||
(*up)->next = u;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(stderr, "WARNING: Das Schiff %s hatte keinen Besitzer. Setze %s\n", shipname(sh), unitname(u));
|
|
||||||
fset(u, FL_OWNER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
up = &u->next;
|
up = &u->next;
|
||||||
|
} else useek=&u->next;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
for (sh = r->ships;sh;sh=sh->next) {
|
||||||
|
unit ** ubegin = up;
|
||||||
|
unit ** uend = up;
|
||||||
|
|
||||||
|
useek = up;
|
||||||
|
while (*useek) {
|
||||||
|
unit * u = *useek;
|
||||||
|
if (u->ship==sh) {
|
||||||
|
unit ** insert;
|
||||||
|
if (fval(u, FL_OWNER)) insert=ubegin;
|
||||||
|
else insert = uend;
|
||||||
|
if (insert!=up) {
|
||||||
|
*useek = u->next; /* raus aus der liste */
|
||||||
|
u->next = *insert;
|
||||||
|
*insert = u;
|
||||||
|
}
|
||||||
|
if (insert==uend) uend=&u->next;
|
||||||
|
}
|
||||||
|
if (*useek==u) useek = &u->next;
|
||||||
|
}
|
||||||
|
up = uend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
reorder_owners(region * r)
|
reorder_owners(region * r)
|
||||||
{
|
{
|
||||||
|
@ -2227,6 +2237,7 @@ reorder_owners(region * r)
|
||||||
}
|
}
|
||||||
*ui = NULL;
|
*ui = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static attrib_type at_number = {
|
static attrib_type at_number = {
|
||||||
"faction_renum",
|
"faction_renum",
|
||||||
|
|
Loading…
Reference in New Issue