Skip to content

Commit 17d94f1

Browse files
committed
Fix parsing for 1.0.x version replays.
1 parent 4b36343 commit 17d94f1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

sc2reader/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def load_context(self, replay):
176176
for player in replay.players:
177177
self.logger.error("\t"+str(player))
178178

179-
self.logger.error("{0}\t{1}\tMissing ability {2} from {3}".format(self.frame, self.player.name, hex(self.ability_code), replay.datapack.__class__.__name__))
179+
self.logger.error("{0}\t{1}\tMissing ability {2} from {3}".format(self.frame, self.player.name, hex(self.ability_code) if self.ability_code!=None else None, replay.datapack.__class__.__name__))
180180

181181
else:
182182
self.ability = replay.datapack.abilities[self.ability_code]

sc2reader/readers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class GameEventsReader_Base(object):
206206
PLAYER_ABILITY_FLAGS = 17
207207
ABILITY_TEAM_FLAG = False
208208
UNIT_INDEX_BITS = 8
209+
HOTKEY_OVERLAY = 0
209210

210211
def __call__(self, data, replay):
211212
EVENT_DISPATCH = {
@@ -325,7 +326,11 @@ def player_selection_event(self, data, fstamp, pid, event_type):
325326
def player_hotkey_event(self, data, fstamp, pid, event_type):
326327
hotkey = data.read_bits(4)
327328
action = data.read_bits(2)
328-
overlay = self._parse_selection_update(data)
329+
330+
if self.HOTKEY_OVERLAY:
331+
overlay = self._parse_selection_update(data)
332+
else:
333+
overlay = (1,0)
329334

330335
if action == 0:
331336
return SetToHotkeyEvent(fstamp, pid, event_type, hotkey, overlay)
@@ -380,6 +385,8 @@ def camera_event(self, data, fstamp, pid, event_type):
380385

381386

382387
class GameEventsReader_16561(GameEventsReader_16117):
388+
HOTKEY_OVERLAY = 1
389+
383390
# Don't want to do this more than once
384391
SINGLE_BIT_MASKS = [0x1 << i for i in range(2**9)]
385392

0 commit comments

Comments
 (0)