diff --git a/src/guard.c b/src/guard.c index adacd1bf6..ee26e467b 100644 --- a/src/guard.c +++ b/src/guard.c @@ -24,7 +24,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "monster.h" #include -#include #include #include #include diff --git a/src/kernel/save.c b/src/kernel/save.c index 4a1b7897e..80b8becc9 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -670,36 +670,6 @@ writeorder(struct gamedata *data, const struct order *ord, WRITE_STR(data->store, obuf); } -int read_attribs(gamedata *data, attrib **alist, void *owner) { - int result; - if (data->version < ATHASH_VERSION) { - result = a_read_orig(data, alist, owner); - } - else { - result = a_read(data, alist, owner); - } - if (result == AT_READ_DEPR) { - /* handle deprecated attributes */ - attrib *a = *alist; - while (a) { - if (a->type->upgrade) { - a->type->upgrade(alist, a); - } - a = a->nexttype; - } - } - return result; -} - -void write_attribs(storage *store, attrib *alist, const void *owner) -{ -#if RELEASE_VERSION < ATHASH_VERSION - a_write_orig(store, alist, owner); -#else - a_write(store, alist, owner); -#endif -} - unit *read_unit(struct gamedata *data) { unit *u; diff --git a/src/kernel/save.h b/src/kernel/save.h index aa11ac1ad..883df6ea8 100644 --- a/src/kernel/save.h +++ b/src/kernel/save.h @@ -56,9 +56,6 @@ extern "C" { void read_spellbook(struct spellbook **bookp, struct gamedata *data, int(*get_level)(const struct spell * sp, void *), void * cbdata); void write_spellbook(const struct spellbook *book, struct storage *store); - void write_attribs(struct storage *store, struct attrib *alist, const void *owner); - int read_attribs(struct gamedata *store, struct attrib **alist, void *owner); - void write_unit(struct gamedata *data, const struct unit *u); struct unit *read_unit(struct gamedata *data); diff --git a/src/util/attrib.c b/src/util/attrib.c index 5e158f263..6b39b56ae 100644 --- a/src/util/attrib.c +++ b/src/util/attrib.c @@ -29,6 +29,36 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +int read_attribs(gamedata *data, attrib **alist, void *owner) { + int result; + if (data->version < ATHASH_VERSION) { + result = a_read_orig(data, alist, owner); + } + else { + result = a_read(data, alist, owner); + } + if (result == AT_READ_DEPR) { + /* handle deprecated attributes */ + attrib *a = *alist; + while (a) { + if (a->type->upgrade) { + a->type->upgrade(alist, a); + } + a = a->nexttype; + } + } + return result; +} + +void write_attribs(storage *store, attrib *alist, const void *owner) +{ +#if RELEASE_VERSION < ATHASH_VERSION + a_write_orig(store, alist, owner); +#else + a_write(store, alist, owner); +#endif +} + int a_readint(attrib * a, void *owner, struct gamedata *data) { int n; diff --git a/src/util/attrib.h b/src/util/attrib.h index 8b7a00e6a..d93ce1240 100644 --- a/src/util/attrib.h +++ b/src/util/attrib.h @@ -66,6 +66,9 @@ extern "C" { extern void at_register(attrib_type * at); extern void at_deprecate(const char * name, int(*reader)(attrib *, void *, struct gamedata *)); + void write_attribs(struct storage *store, struct attrib *alist, const void *owner); + int read_attribs(struct gamedata *store, struct attrib **alist, void *owner); + extern attrib *a_select(attrib * a, const void *data, bool(*compare) (const attrib *, const void *)); extern attrib *a_find(attrib * a, const attrib_type * at);