Merge branch 'main' of github.com:Kum1ta/PTME_Transcendence

This commit is contained in:
Kum1ta
2024-11-14 15:18:31 +01:00
2 changed files with 5 additions and 4 deletions

View File

@ -6,7 +6,7 @@
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ # # By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2024/10/04 17:17:07 by tomoron #+# #+# # # Created: 2024/10/04 17:17:07 by tomoron #+# #+# #
# Updated: 2024/10/22 16:32:35 by tomoron ### ########.fr # # Updated: 2024/11/14 14:35:32 by tomoron ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -29,6 +29,7 @@ class Tournament:
self.history = [] self.history = []
self.nbBot = nbBot self.nbBot = nbBot
self.end = False self.end = False
self.started = False
self.genCode() self.genCode()
Tournament.currentTournaments[self.code] = self Tournament.currentTournaments[self.code] = self
self.join(socket, skin, goal) self.join(socket, skin, goal)
@ -73,8 +74,8 @@ class Tournament:
index = self.playerFromSocket(socket) index = self.playerFromSocket(socket)
if(index == -1): if(index == -1):
return; return;
self.players.pop(index)
socket.tournament = None socket.tournament = None
self.players.pop(index)
self.broadcast({"action":2,"id":index}) self.broadcast({"action":2,"id":index})
def join(self, socket, skin=0, goal=0, isBot=False): def join(self, socket, skin=0, goal=0, isBot=False):

View File

@ -6,7 +6,7 @@
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ # # By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2024/10/22 01:37:00 by tomoron #+# #+# # # Created: 2024/10/22 01:37:00 by tomoron #+# #+# #
# Updated: 2024/10/22 01:37:12 by tomoron ### ########.fr # # Updated: 2024/11/14 13:59:35 by tomoron ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -38,7 +38,7 @@ class TournamentGame:
print("waiting for player") print("waiting for player")
nbLoop += 1 nbLoop += 1
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
if(not l.socket.online or not r.socket.online): if(not l.socket.tournament == self.tournament or not r.socket.tournament == self.tournament):
print("player is not online, opponent is winner") print("player is not online, opponent is winner")
self.winner = l if l.socket.online else r self.winner = l if l.socket.online else r
return; return;