Follow-up Comment #4, patch #1541 (project freeciv):
About loading / saving different versions of savegames:
* keep one function to load the current version
* small functions between releases for savegame changes (2.2.0 -> 2.2.1;
2.2.0 => 2.3.0) which change the secfile data (add / modify / remove data)
* compile option to deactivate this code path
pseud code (based on this patch):
void sg_load_player_version202000(struct loaddata *loading);
{
...
#ifdef FC_COMPAT_SAVEGAME
sg_load_player_compat(struct loaddata *loading);
#endif
sg_load_player(loading);
...
}
#ifdef FC_COMPAT_SAVEGAME
void sg_load_player_compat(struct loaddata *loading)
{
/* get savegame version and load corresponding function, i.e */
sg_load_player_version201000(loading);
}
void sg_load_player_version201000(struct loaddata *loading)
{
/* modify secfile; all changes between versions */
int data = secfile_secfile_lookup_int_default(loading->file, default_value,
"old.secfile.position");
secfile_delete("old.secfile.position");
secfile_insert_int(loading->file, data, "new.secfile.definition");
}
#endif
void sg_load_player(struct loaddata *loading)
{
/* loads the 2.3.0 development version of the savegame */
}
This could use the internal definitions if the game is resetted before the
main (current) loading routine is started.
_______________________________________________________
Reply to this item at:
<http://gna.org/patch/?1541>
_______________________________________________
Nachricht geschickt von/durch Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev