Skip to content

Rewrite loading of techs to support adding new techs#144

Closed
nthykier wants to merge 3 commits intosingularity:masterfrom
nthykier:save-avoid-crash-on-new-techs
Closed

Rewrite loading of techs to support adding new techs#144
nthykier wants to merge 3 commits intosingularity:masterfrom
nthykier:save-avoid-crash-on-new-techs

Conversation

@nthykier
Copy link
Member

@nthykier nthykier commented Feb 4, 2019

Previously, when we load a savegame, the program would assume that the
savegame contained all the current technologies. However, this
assumption fails every time a new technology is added to singularity
and then singularity simply crashes.

This patch solves this by pulling all techs from the data files and
then merging the few relevant bits ("done" and "cost_paid" from the
savegame) into the existing saves. Obsolete techs (i.e. techs prevent
in the savegame but not in the data files) are ignored to avoid
crashing on them. In the case, where a technology is renamed, we can
preserve it by correcting it's "id" in the convert_from method.

With this patch, a save game made on commit b161349 can still be
successfully loaded in 03b0bd5, where a new tech is introduced.

Signed-off-by: Niels Thykier [email protected]

@Xenega Xenega mentioned this pull request Feb 10, 2019
8 tasks
@nthykier nthykier force-pushed the save-avoid-crash-on-new-techs branch 2 times, most recently from 1c3c9be to 6a2c3ca Compare July 27, 2019 14:12
nthykier added 3 commits July 27, 2019 14:25
Previously, when we load a savegame, the program would assume that the
savegame contained all the *current* technologies.  However, this
assumption fails every time a new technology is added to singularity
and then singularity simply crashes.

This patch solves this by pulling all techs from the data files and
then merging the few relevant bits ("done" and "cost_paid" from the
savegame) into the existing saves. Obsolete techs (i.e. techs prevent
in the savegame but not in the data files) are ignored to avoid
crashing on them.  In the case, where a technology is renamed, we can
preserve it by correcting it's "id" in the convert_from method.

With this patch, a save game made on commit b161349 can still be
successfully loaded in 03b0bd5, where a new tech is introduced.

Signed-off-by: Niels Thykier <[email protected]>
@nthykier nthykier force-pushed the save-avoid-crash-on-new-techs branch from 6a2c3ca to 811daec Compare July 27, 2019 14:31
@nthykier
Copy link
Member Author

nthykier commented Aug 6, 2019

Retracted in favour of #168

@nthykier nthykier closed this Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant