forked from github/server
commit
a313d87c00
|
@ -585,12 +585,24 @@ writeorder(struct gamedata *data, const struct order *ord,
|
|||
}
|
||||
|
||||
int read_attribs(gamedata *data, attrib **alist, void *owner) {
|
||||
int result;
|
||||
if (data->version < ATHASH_VERSION) {
|
||||
return a_read_orig(data, alist, owner);
|
||||
result = a_read_orig(data, alist, owner);
|
||||
}
|
||||
else {
|
||||
return a_read(data, alist, owner);
|
||||
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)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/save.h>
|
||||
#include <kernel/terrain.h>
|
||||
#include <kernel/terrainid.h>
|
||||
#include <kernel/unit.h>
|
||||
|
@ -48,7 +49,7 @@
|
|||
static int read_permissions(attrib * a, void *owner, struct gamedata *data)
|
||||
{
|
||||
assert(!a);
|
||||
a_read(data, &a, owner);
|
||||
read_attribs(data, &a, owner);
|
||||
a_remove(&a, a);
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
|
|
@ -350,17 +350,7 @@ int a_read(gamedata *data, attrib ** attribs, void *owner) {
|
|||
}
|
||||
READ_INT(store, &key);
|
||||
}
|
||||
if (retval == AT_READ_DEPR) {
|
||||
/* handle deprecated attributes */
|
||||
attrib *a = *attribs;
|
||||
while (a) {
|
||||
if (a->type->upgrade) {
|
||||
a->type->upgrade(attribs, a);
|
||||
}
|
||||
a = a->nexttype;
|
||||
}
|
||||
}
|
||||
return AT_READ_OK;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int a_read_orig(gamedata *data, attrib ** attribs, void *owner)
|
||||
|
|
Loading…
Reference in New Issue