Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Commit

Permalink
Remove pulling out sim_mods key to json
Browse files Browse the repository at this point in the history
Turns out it only happens client-side, legacy replay server doesn't do
that. For the sake of not touching the format, let's not add this key.

Fixes #2.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@gmail.com>
  • Loading branch information
Igor Kotrasinski committed Nov 23, 2018
1 parent b0e0d72 commit 57120cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
7 changes: 0 additions & 7 deletions replayserver/bookkeeping/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ async def _get_replay_info(self, game_id, header):
result['uid'] = game_id
result['complete'] = True
result['state'] = 'PLAYING'
try:
result['sim_mods'] = {
mod['uid']: mod['version']
for mod in header.get('mods', {}).values()
}
except KeyError: # TODO - validate elsewhere?
raise BookkeepingError("Replay header has invalid sim_mods")

game_stats = await self._database.get_game_stats(game_id)
teams = await self._database.get_teams_in_game(game_id)
Expand Down
6 changes: 4 additions & 2 deletions replayserver/struct/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ def read_header(gen):
result["map_name"] = map_name
yield from read_exactly(gen, 4) # skip

yield from read_value(gen, "I", 4) # Mod (data?) size
result["mods"] = yield from read_lua_value(gen)
# We don't need to parse mods
ssize = yield from read_value(gen, "I", 4) # Mod (data?) size
yield from read_exactly(gen, ssize)
# result["mods"] = yield from read_lua_value(gen)

# We don't need to parse scenario info
ssize = yield from read_value(gen, "I", 4) # Scenario (data?) size
Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests/struct/test_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ def test_lua_dict_prevent_huge_recursion():
},
'cheats_enabled': 0,
'map_name': '/maps/SCMP_016/SCMP_016.scmap',
'mods': {},
'random_seed': 65637294,
'remaining_timeouts': {
'MazorNoob': 3,
Expand Down

0 comments on commit 57120cd

Please sign in to comment.