savegame compat

This commit is contained in:
Enno Rehling 2009-10-03 01:52:55 +00:00
parent e429e9304d
commit da3a56efe2
1 changed files with 14 additions and 5 deletions

View File

@ -545,21 +545,30 @@ read_items(struct storage * store, item **ilist)
static void static void
read_alliances(struct storage * store) read_alliances(struct storage * store)
{ {
int id; char pbuf[8];
int id, terminator = 0;
if (store->version<SAVEALLIANCE_VERSION) { if (store->version<SAVEALLIANCE_VERSION) {
if (!AllianceRestricted() && !AllianceAuto()) return; if (!AllianceRestricted() && !AllianceAuto()) return;
} }
if (store->version<ALLIANCELEADER_VERSION) {
id = store->r_id(store); terminator = atoi36("end");
while (id!=0) { store->r_str_buf(store, pbuf, sizeof(pbuf));
id = atoi36(pbuf);
} else {
id = store->r_id(store);
}
while (id!=terminator) {
char aname[128]; char aname[128];
alliance * al; alliance * al;
store->r_str_buf(store, aname, sizeof(aname)); store->r_str_buf(store, aname, sizeof(aname));
al = makealliance(id, aname); al = makealliance(id, aname);
if (store->version>=ALLIANCELEADER_VERSION) { if (store->version>=ALLIANCELEADER_VERSION) {
read_reference(&al->leader, store, read_faction_reference, resolve_faction); read_reference(&al->leader, store, read_faction_reference, resolve_faction);
id = store->r_id(store);
} else{
store->r_str_buf(store, pbuf, sizeof(pbuf));
id = atoi36(pbuf);
} }
id = store->r_id(store);
} }
} }