Skip to content

Commit e1fc7b4

Browse files
committed
Fixed another small bug
1 parent 4cfa522 commit e1fc7b4

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

sc2reader/objects.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ class Graph():
219219
values = list()
220220

221221
def __init__(self, x, y, xy_list=None):
222+
self.times = list()
223+
self.values = list()
224+
222225
if xy_list:
223226
for x, y in xy_list:
224227
self.times.append(x)
@@ -286,6 +289,9 @@ class PlayerSummary():
286289
stats = dict()
287290

288291
def __init__(self, pid):
292+
unknown2 = dict()
293+
stats = dict()
294+
289295
self.pid = pid
290296

291297
def __str__(self):

sc2reader/utils.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,21 @@ def parse_hash(hash_string):
736736
'hash' : ''.join([('%02x' % ord(x)) for x in hash]),
737737
'type' : hash_string[0:4]
738738
}
739+
def flip_int(num, b):
740+
"""
741+
Flips the b first bytes in num
742+
Example:
743+
(0x12345, 3) -> 0x452301
744+
(0x00112233, 4) -> 0x33221100
745+
"""
746+
o = 0
747+
for i in range(b/2):
748+
o |= ((num & (0xff << i*8)) << (b-(2*i+1))*8)
749+
o |= ((num & (0xff << (b-(i+1))*8)) >> (b-(2*i+1)) * 8)
750+
if b % 2 == 1:
751+
o |= (num & (0xff << (b/2)*8))
752+
return o
753+
739754

740755
class Length(timedelta):
741756
"""

0 commit comments

Comments
 (0)