deprecate unused at_cursewall.

This commit is contained in:
Enno Rehling 2017-08-25 21:03:04 +02:00
parent 6d1fe2842a
commit faefaf2523
1 changed files with 6 additions and 92 deletions

View File

@ -28,46 +28,15 @@ typedef struct wallcurse {
connection *wall;
} wallcurse;
static void cw_init(attrib * a)
{
curse *c;
curse_init(a);
c = (curse *)a->data.v;
c->data.v = calloc(sizeof(wallcurse), 1);
}
static void cw_write(const attrib * a, const void *target, storage * store)
{
connection *b = ((wallcurse *)((curse *)a->data.v)->data.v)->wall;
curse_write(a, target, store);
WRITE_INT(store, b->id);
}
typedef struct bresolve {
int id;
curse *self;
} bresolve;
static int resolve_buddy(variant data, void *addr);
static int cw_read(attrib * a, void *target, gamedata *data)
static int cw_read_depr(attrib * a, void *target, gamedata *data)
{
storage *store = data->store;
bresolve *br = calloc(sizeof(bresolve), 1);
curse *c = (curse *)a->data.v;
wallcurse *wc = (wallcurse *)c->data.v;
variant var;
curse_init(a);
curse_read(a, store, target);
br->self = c;
READ_INT(store, &br->id);
var.i = br->id;
ur_add(var, &wc->wall, resolve_borderid);
var.v = br;
ur_add(var, &wc->buddy, resolve_buddy);
return AT_READ_OK;
curse_done(a);
READ_INT(store, NULL);
return AT_READ_DEPR;
}
/* ------------------------------------------------------------- */
@ -105,61 +74,6 @@ const curse_type ct_firewall = {
wall_vigour /* change_vigour */
};
static attrib_type at_cursewall = {
"cursewall",
cw_init,
curse_done,
curse_age,
cw_write,
cw_read,
NULL,
ATF_CURSE
};
static int resolve_buddy(variant data, void *addr)
{
curse *result = NULL;
bresolve *br = (bresolve *)data.v;
connection *b;
assert(br->id > 0);
b = find_border(br->id);
if (b && b->from && b->to) {
attrib *a = a_find(b->from->attribs, &at_cursewall);
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;
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;
}
*(curse **)addr = result;
return 0;
}
static void wall_init(connection * b)
{
wall_data *fd = (wall_data *)calloc(sizeof(wall_data), 1);
@ -287,7 +201,7 @@ border_type bt_wisps = { /* only here for reading old data */
void register_borders(void)
{
border_convert_cb = &convert_firewall_timeouts;
at_register(&at_cursewall);
at_deprecate("cursewall", cw_read_depr);
register_bordertype(&bt_firewall);
register_bordertype(&bt_wisps);