add var.GRAVEYARD_LOCK check in chk_win, add more checks for game ending in those

This commit is contained in:
jacob1 2014-12-06 14:01:22 -05:00
parent 6aeb149241
commit 1519ba3765

View File

@ -1318,6 +1318,10 @@ def chk_win(cli, end_game = True):
return True
return False
with var.GRAVEYARD_LOCK:
if var.PHASE not in ("day", "night"):
return False #some other thread already ended game probably
lwolves = len(var.list_players(var.WOLFCHAT_ROLES))
cubs = len(var.ROLES["wolf cub"]) if "wolf cub" in var.ROLES else 0
lrealwolves = len(var.list_players(var.WOLF_ROLES)) - cubs
@ -1724,8 +1728,8 @@ def reaper(cli, gameid):
while gameid == var.GAME_ID:
with var.GRAVEYARD_LOCK:
# Terminate reaper when experiencing disk lag
if var.PHASE == "writing files":
# Terminate reaper when game ends
if var.PHASE not in ("day", "night"):
return
if var.WARN_IDLE_TIME or var.PM_WARN_IDLE_TIME or var.KILL_IDLE_TIME: # only if enabled
to_warn = []