/* vi: set ts=2: +-------------------+ Christian Schlittchen | | Enno Rehling | Eressea PBEM host | Katja Zedel | (c) 1998 - 2003 | Henning Peters | | Ingo Wilken +-------------------+ Stefan Reich This program may not be used, modified or distributed without prior permission by the authors of Eressea. */ #include #include #include "unguard.h" /* kernel includes */ #include #include #include #include /* util includes */ #include #include #include #include /* libc includes */ #include static int unguard_handle(trigger * t, void *data) { building *b = (building *) t->data.v; if (b) { fset(b, BLD_UNGUARDED); } else { log_error("could not perform unguard::handle()\n"); return -1; } unused_arg(data); return 0; } static void unguard_write(const trigger * t, struct storage *store) { write_building_reference((building *) t->data.v, store); } static int unguard_read(trigger * t, struct storage *store) { int rb = read_reference(&t->data.v, store, read_building_reference, resolve_building); if (rb == 0 && !t->data.v) { return AT_READ_FAIL; } return AT_READ_OK; } struct trigger_type tt_unguard = { "building", NULL, NULL, unguard_handle, unguard_write, unguard_read }; trigger *trigger_unguard(building * b) { trigger *t = t_new(&tt_unguard); t->data.v = (void *)b; return t; }