Skip to content

Commit 0b8590f

Browse files
committed
Store a unit -> location map instead.
1 parent 3bdf6df commit 0b8590f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

sc2reader/events/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
from base import *
33
from game import *
44
from message import *
5+
from tracker import *

sc2reader/events/tracker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,8 @@ def __init__(self, frames, data):
498498
#: An ordered list of unit/point data interpreted as below.
499499
self.items = data[1]
500500

501-
#: A list of units that had their position updated by this event
502-
self.units = list()
501+
#: A dict mapping of units that had their position updated to their positions
502+
self.units = dict()
503503

504504
#: A list of (unit_index, (x,y)) derived from the first_unit_index and items
505505
self.positions = list()
@@ -516,7 +516,7 @@ def load_context(self, replay):
516516
if unit_index in replay.active_units:
517517
unit = replay.active_units[unit_index]
518518
unit.location = (x,y)
519-
self.units.append(unit)
519+
self.units[unit] = unit.location
520520
else:
521521
print "Unit moved that doesn't exist!"
522522

0 commit comments

Comments
 (0)