Skip to content

Commit 2d26fd5

Browse files
committed
Change out the Person.type enum for a is_human flag.
1 parent 911d7ac commit 2d26fd5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

sc2reader/objects.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,15 @@ def __init__(self, pid, name):
106106
self.is_observer = None
107107
self.messages = list()
108108
self.events = list()
109+
self.is_human = bool()
110+
self.result = "Unknown"
109111
self.recorder = False # Actual recorder will be determined using the replay.message.events file
110112

111113
class Observer(Person):
112114
def __init__(self, pid, name):
113115
super(Observer,self).__init__(pid, name)
114116
self.is_observer = True
115-
self.type = 'Human'
117+
self.is_human = True
116118

117119
class Player(Person):
118120

sc2reader/replay.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ def load_players(self):
155155
player.pick_race = attributes['Race']
156156
player.play_race = LOCALIZED_RACES.get(pdata.race, pdata.race)
157157
player.difficulty = attributes['Difficulty']
158-
player.type = attributes['Player Type']
158+
player.is_human = (attributes['Player Type'] == 'Human')
159159
player.uid = pdata.bnet.uid
160160
player.subregion = pdata.bnet.subregion
161161
player.handicap = pdata.handicap
162162

163163
# We need initData for the gateway portion of the url!
164164
if 'replay.initData' in self.raw_data and self.gateway:
165165
player.gateway = self.gateway
166-
if player.type == 'Human' and player.subregion:
166+
if player.is_human and player.subregion:
167167
player.region = REGIONS[self.gateway][player.subregion]
168168
default_region = player.region
169169

0 commit comments

Comments
 (0)