forked from github/server
I believe that these are alsways non-zero.
This commit is contained in:
parent
5a8a1704e7
commit
5de2e790a3
1 changed files with 26 additions and 26 deletions
52
src/curses.c
52
src/curses.c
|
@ -48,7 +48,7 @@ void cw_write(const attrib * a, const void *target, storage * store)
|
||||||
store->w_int(store, b->id);
|
store->w_int(store, b->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct bresvole {
|
typedef struct bresolve {
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
curse *self;
|
curse *self;
|
||||||
} bresolve;
|
} bresolve;
|
||||||
|
@ -88,40 +88,40 @@ static int resolve_buddy(variant data, void *addr)
|
||||||
{
|
{
|
||||||
curse *result = NULL;
|
curse *result = NULL;
|
||||||
bresolve *br = (bresolve *) data.v;
|
bresolve *br = (bresolve *) data.v;
|
||||||
|
connection *b;
|
||||||
|
|
||||||
if (br->id >= 0) {
|
assert(br->id > 0);
|
||||||
connection *b = find_border(br->id);
|
b = find_border(br->id);
|
||||||
|
|
||||||
if (b && b->from && b->to) {
|
if (b && b->from && b->to) {
|
||||||
attrib *a = a_find(b->from->attribs, &at_cursewall);
|
attrib *a = a_find(b->from->attribs, &at_cursewall);
|
||||||
while (a && a->data.v != br->self) {
|
while (a && a->data.v != br->self) {
|
||||||
|
curse *c = (curse *) a->data.v;
|
||||||
|
wallcurse *wc = (wallcurse *) c->data.v;
|
||||||
|
if (wc->wall->id == br->id)
|
||||||
|
break;
|
||||||
|
a = a->next;
|
||||||
|
}
|
||||||
|
if (!a || a->type != &at_cursewall) {
|
||||||
|
a = a_find(b->to->attribs, &at_cursewall);
|
||||||
|
while (a && a->type == &at_cursewall && a->data.v != br->self) {
|
||||||
curse *c = (curse *) a->data.v;
|
curse *c = (curse *) a->data.v;
|
||||||
wallcurse *wc = (wallcurse *) c->data.v;
|
wallcurse *wc = (wallcurse *) c->data.v;
|
||||||
if (wc->wall->id == br->id)
|
if (wc->wall->id == br->id)
|
||||||
break;
|
break;
|
||||||
a = a->next;
|
a = a->next;
|
||||||
}
|
}
|
||||||
if (!a || a->type != &at_cursewall) {
|
|
||||||
a = a_find(b->to->attribs, &at_cursewall);
|
|
||||||
while (a && a->type == &at_cursewall && a->data.v != br->self) {
|
|
||||||
curse *c = (curse *) a->data.v;
|
|
||||||
wallcurse *wc = (wallcurse *) c->data.v;
|
|
||||||
if (wc->wall->id == br->id)
|
|
||||||
break;
|
|
||||||
a = a->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (a && a->type == &at_cursewall) {
|
|
||||||
curse *c = (curse *) a->data.v;
|
|
||||||
free(br);
|
|
||||||
result = c;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* fail, object does not exist (but if you're still loading then
|
|
||||||
* you may want to try again later) */
|
|
||||||
*(curse **) addr = NULL;
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
if (a && a->type == &at_cursewall) {
|
||||||
|
curse *c = (curse *) a->data.v;
|
||||||
|
free(br);
|
||||||
|
result = c;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* fail, object does not exist (but if you're still loading then
|
||||||
|
* you may want to try again later) */
|
||||||
|
*(curse **) addr = NULL;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
*(curse **) addr = result;
|
*(curse **) addr = result;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue