Skip to content

Commit

Permalink
fixed parsing of scenario matches
Browse files Browse the repository at this point in the history
  • Loading branch information
Void / aoe2insights.com committed Jul 7, 2023
1 parent fe6b020 commit 2a0ee9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mgz/fast/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ def parse_scenario(data, num_players, version, save):
"""Parse scenario section."""
data.read(4455)
if version is Version.DE:
data.read(128)
data.read(102)
aoc_string(data) # scenario filename
data.read(24)
instructions = aoc_string(data)
for _ in range(0, 9):
aoc_string(data)
Expand Down
Binary file added tests/recs/de-scenario.aoe2record
Binary file not shown.
15 changes: 15 additions & 0 deletions tests/test_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ def test_map(self):
self.assertEqual(self.data['lobby']['seed'], -1970180596)


class TestFastDEScenario(unittest.TestCase):

@classmethod
def setUpClass(cls):
with open('tests/recs/de-scenario.aoe2record', 'rb') as handle:
cls.data = parse(handle)

def test_version(self):
self.assertEqual(self.data['version'], Version.DE)

def test_players(self):
players = self.data.get('players')
self.assertEqual(len(players), 3)


class TestFastHD(unittest.TestCase):

@classmethod
Expand Down

0 comments on commit 2a0ee9a

Please sign in to comment.