Skip to content

Commit bd933d5

Browse files
committed
Use the outcome field if it has recorded the result
1 parent 7654702 commit bd933d5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sc2reader/processors.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,18 @@ def process(self, replay):
163163

164164
class ResultsProcessor(Processor):
165165
def process(self, replay):
166+
# Check if replay file has recorded the winner
167+
remaining = set()
168+
for player in replay.players:
169+
if player.outcome == 1:
170+
replay.results[player.team] = "Won"
171+
elif player.outcome == 2:
172+
replay.results[player.team] = "Lost"
173+
else:
174+
remaining.add(player.team)
175+
if len(remaining) == 0:
176+
return replay
177+
166178
#Remove players from the teams as they drop out of the game
167179
print replay.teams
168180
print replay.players

0 commit comments

Comments
 (0)