Skip to content

Commit

Permalink
Fixed: load/save also works again. And now also in resource-based games!
Browse files Browse the repository at this point in the history
  • Loading branch information
schaul committed Sep 19, 2013
1 parent 9464db4 commit 0f04c07
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vgdl/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,6 @@ def getFullState(self):
'rect',
'alternate_keys',
'res_type',
'res_limit',
'res_color',
'stype',
'ammo',
'draw_arrow',
Expand All @@ -364,7 +362,7 @@ def getFullState(self):
while pos in ss:
# two objects of the same type in the same location, we need to disambiguate
pos = (pos, None)
ss[str(pos)] = attrs
ss[pos] = attrs
for a, val in s.__dict__.items():
if a not in ignoredattributes:
attrs[a] = val
Expand All @@ -387,8 +385,11 @@ def setFullState(self, fs):
for pos, attrs in ss.items():
s = self._createSprite([key], pos)[0]
for a, val in attrs.items():
assert a != 'resources', 'Resource load/save not yet supported...'
s.__setattr__(a, val)
if a == 'resources':
for r, v in val.items():
s.resources[r] = v
else:
s.__setattr__(a, val)

def _clearAll(self, onscreen=True):
for s in set(self.kill_list):
Expand Down

0 comments on commit 0f04c07

Please sign in to comment.