change tournament leave function to prevent players from leaving if the tournament is started

This commit is contained in:
2024-11-14 14:36:10 +01:00
parent da5d244449
commit 1549b7134b

View File

@ -6,7 +6,7 @@
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/10/04 17:17:07 by tomoron #+# #+# #
# Updated: 2024/11/14 13:46:45 by tomoron ### ########.fr #
# Updated: 2024/11/14 14:35:32 by tomoron ### ########.fr #
# #
# **************************************************************************** #
@ -69,12 +69,12 @@ class Tournament:
return(-1)
def leave(self, socket):
if(self.started):
return;
index = self.playerFromSocket(socket)
if(index == -1):
return;
socket.tournament = None
if(self.started):
return;
self.players.pop(index)
self.broadcast({"action":2,"id":index})