Skip to content

Commit 46ee995

Browse files
committed
Added winner field to replay object. Field is set when the winner_known flag is set
1 parent b641a6b commit 46ee995

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sc2reader/replay.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ class Replay(object):
8888
#: A flag indicating whether all the results are known or not
8989
winner_known = bool()
9090

91+
#: If the winner_known flag is set this will contain the winning team
92+
winner = object()
93+
9194
def __init__(self, replay_file, **options):
9295
self.opt = utils.AttributeDict(options)
9396
self.datapack = None
@@ -231,6 +234,7 @@ def load_players(self):
231234
if pdata.result == 1:
232235
player.team.result = "Win"
233236
self.winner_known = True
237+
self.winner = player.team
234238
elif pdata.result == 2:
235239
player.team.result = "Loss"
236240

0 commit comments

Comments
 (0)