Skip to content

Commit

Permalink
Fixed a bug where a winner was declared in the tournament, even thoug…
Browse files Browse the repository at this point in the history
…h the match was a draw.
  • Loading branch information
josef-stips committed Oct 16, 2024
1 parent 0823f3d commit 7d1f86c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/script/public/App/social_stuff/tournaments.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class TournamentHandler {
OpenedPopUp_WhereAlertPopUpNeeded = true;
AlertText.textContent = `The tournament hasn't started yet`;
DisplayPopUp_PopAnimation(alertPopUp, 'flex', true);
return;
// return;
};

socket.emit('tournament_match_lobby_exists', await generateTournamentLobbyHash(), cb => {
Expand Down
5 changes: 4 additions & 1 deletion src/script/public/Game/processWinner.js
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,9 @@ function PlayerWon_UpdateHisData(Player1_won, player2_won, WinCombination) {

// this code block is just for tournament win case
const tournament_win = async(player1_won, player2_won) => {
// in case nobody won
if (player1_won && player2_won) return;

let tour_data = tournament_handler.clicked_tournament[1];
let current_round_idx = findCurrentRoundByPlayerID(tour_data.current_state.rounds, localStorage.getItem('PlayerID'));
let current_round = tour_data.current_state.rounds[current_round_idx];
Expand Down Expand Up @@ -1359,7 +1362,7 @@ const tournament_win = async(player1_won, player2_won) => {
// this message recieve all clients
socket.on('global_UltimateWin', async(player1_won, player2_won, WinCombination, player1_score, player2_score, gameSeconds) => {
setTimeout(async() => {
if (!player1_score && !player2_score) {
if (!player1_score && !player2_score && (player1_won != player2_won)) {
if (player1_won) {
player1_score = Infinity;
player2_score = -Infinity;
Expand Down

0 comments on commit 7d1f86c

Please sign in to comment.