Project

General

Profile

Feature #1065 ยป 0054-savegame-Save-vision_site-original-owner.patch

Marko Lindqvist, 11/08/2024 05:47 PM

View differences:

server/savegame/savecompat.c
secfile_entry_ignore(loading->file, "research.r%d.techs", i);
}
}
player_slots_iterate(pslot) {
int plrno = player_slot_index(pslot);
int ncities;
int cnro;
if (secfile_section_lookup(loading->file, "player%d", plrno) == nullptr) {
continue;
}
ncities = secfile_lookup_int_default(loading->file, 0,
"player%d.dc_total", plrno);
for (cnro = 0; cnro < ncities; cnro++) {
secfile_insert_int(loading->file, -1, "player%d.dc%d.original",
plrno, cnro);
}
} player_slots_iterate_end;
}
/************************************************************************//**
......
free(savemod);
}
}
player_slots_iterate(pslot) {
int plrno = player_slot_index(pslot);
int ncities;
int cnro;
if (secfile_section_lookup(loading->file, "player%d", plrno) == nullptr) {
continue;
}
ncities = secfile_lookup_int_default(loading->file, 0,
"player%d.dc_total", plrno);
for (cnro = 0; cnro < ncities; cnro++) {
if (!secfile_entry_lookup(loading->file, "player%d.dc%d.original",
plrno, cnro)) {
secfile_insert_int(loading->file, -1, "player%d.dc%d.original",
plrno, cnro);
}
}
} player_slots_iterate_end;
} /* Version < 3.2.93 */
#endif /* FREECIV_DEV_SAVE_COMPAT_3_3 */
server/savegame/savegame3.c
sg_warn_ret_val(NULL != pdcity->owner, FALSE,
"%s has invalid owner (%d); skipping.", citystr, id);
sg_warn_ret_val(secfile_lookup_int(loading->file, &id, "%s.original",
citystr),
FALSE, "%s", secfile_error());
if (id >= 0) {
pdcity->original = player_by_number(id);
sg_warn_ret_val(NULL != pdcity->original, FALSE,
"%s has invalid original owner (%d); skipping.", citystr, id);
} else {
pdcity->original = nullptr;
}
sg_warn_ret_val(secfile_lookup_int(loading->file, &pdcity->identity,
"%s.id", citystr),
FALSE, "%s", secfile_error());
......
secfile_insert_int(saving->file, pdcity->identity, "%s.id", buf);
secfile_insert_int(saving->file, player_number(vision_site_owner(pdcity)),
"%s.owner", buf);
if (pdcity->original != nullptr) {
secfile_insert_int(saving->file, player_number(pdcity->original),
"%s.original", buf);
} else {
secfile_insert_int(saving->file, -1, "%s.original", buf);
}
secfile_insert_int(saving->file, vision_site_size_get(pdcity),
"%s.size", buf);
    (1-1/1)