mirror of
https://github.com/FAUSheppy/skillbird
synced 2025-12-06 06:51:34 +01:00
add some sanity checks
This commit is contained in:
@@ -16,6 +16,9 @@ class Round:
|
||||
|
||||
def __init__(self, winnerTeam, loserTeam, _map, duration, startTime, winnerSide):
|
||||
|
||||
if duration <= 0:
|
||||
raise ValueError("Duration cannot be zero")
|
||||
|
||||
self.winners = winnerTeam
|
||||
self.losers = loserTeam
|
||||
self.winnerSide = winnerSide
|
||||
|
||||
@@ -170,6 +170,10 @@ class EventSeries():
|
||||
elif type(e) == MapInformationEvent:
|
||||
self.map = e.map
|
||||
|
||||
### check if there are players in both teams ###
|
||||
if not self.winnerTeam or not self.loserTeam:
|
||||
raise ValueError("One of the teams was empty")
|
||||
|
||||
### normalize teamchanges
|
||||
toBeRemovedFromLosers = [] # cannot change iteable during iteration
|
||||
toBeRemovedFromWinners = []
|
||||
|
||||
Reference in New Issue
Block a user