Mercurial > touhou
diff pytouhou/formats/t6rp.py @ 189:ba3297ab3bde
Fix handling for replay files not beginning with stage 1
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Thu, 27 Oct 2011 21:53:26 +0200 |
parents | 008f90ebfdc0 |
children | 9f58e2a6e950 |
line wrap: on
line diff
--- a/pytouhou/formats/t6rp.py +++ b/pytouhou/formats/t6rp.py @@ -41,7 +41,7 @@ class T6RP(object): self.character = 0 self.rank = 0 self.key = 0 - self.levels = [] + self.levels = [None] * 7 @classmethod @@ -77,14 +77,12 @@ class T6RP(object): stages_offsets = unpack('<7I', file.read(28)) - replay.levels = [] - - for offset in stages_offsets: + for i, offset in enumerate(stages_offsets): if offset == 0: continue level = Level() - replay.levels.append(level) + replay.levels[i] = level file.seek(offset) (level.score, level.random_seed, level.unknown1, level.power,