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