Skip to content

Commit

Permalink
Discard 0.31pre log entries on load
Browse files Browse the repository at this point in the history
Closes: #198
Signed-off-by: Niels Thykier <niels@thykier.net>
  • Loading branch information
nthykier committed Dec 11, 2019
1 parent aa04fcc commit bde10b5
Show file tree
Hide file tree
Showing 3 changed files with 5,870 additions and 1 deletion.
8 changes: 7 additions & 1 deletion singularity/code/savegame.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def _find_attribute(obj, options, **kwargs):
# Now we have enough information to reconstruct the Player object
player.Player.deserialize_obj(difficulty_id, saved_player.raw_sec, pl_obj_data, load_version)

new_log = [_convert_log_entry(x) for x in player_log]
new_log = list(filter(None, (_convert_log_entry(x) for x in player_log)))
g.pl.log.clear()
g.pl.log.extend(new_log)

Expand Down Expand Up @@ -655,7 +655,13 @@ def _convert_log_entry(entry):
if log_name == 'log_event':
entry = logmessage.LogEmittedEvent(time_raw, log_data[0])
else:
if type(log_data) == tuple and len(log_data) != 4:
# 0.31pre saves used 3 values tuple. We cannot
# restore those so we simply discard them as we
# need the "reason" field as well.
return None
reason, base_name, base_type_id, location_id = log_data

if reason == 'maint':
entry = logmessage.LogBaseLostMaintenance(time_raw, base_name, base_type_id, location_id)
else:
Expand Down

0 comments on commit bde10b5

Please sign in to comment.