From b7c5cb246730bbd75db549cfa75c397a6b565087 Mon Sep 17 00:00:00 2001 From: donnyjang Date: Wed, 14 Oct 2026 20:58:59 -0700 Subject: [PATCH] server: 0021-restart-clock-stops-at-start Fix for 0012: START stops the lobby clock (it shares the duel timer), so a reservation window still open after a rules restart no longer ends the duel at once on time limit up. Replayed from Tools/YGOLegacy/patches/0021-restart-clock-stops-at-start.patch in the Unity repo. Co-Authored-By: Claude Fable 5.1 --- server/gframe/single_duel.cpp | 5 +++++ server/gframe/tag_duel.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/server/gframe/single_duel.cpp b/server/gframe/single_duel.cpp index fc2bbd0..129fff2 100644 --- a/server/gframe/single_duel.cpp +++ b/server/gframe/single_duel.cpp @@ -1107,6 +1107,11 @@ void SingleDuel::StartDuel(DuelPlayer* dp) { if(restart_phase != 0) // YGOL rules restart: frozen until Commit or Abort return; ygol_started = true; // YGOL rules restart: no Prepare after the first accepted START + // YGOL restart clock: the lobby tick shares the duel timer; a reservation window still open at START + // would tick into the duel and end it at once on "time limit up" (an untimed duel has a limit of 0) + if(has_restart_plan) + ExpireReservations(); + NetServer::StopDuelTimer(); for(auto& state : seat_state) state = CTOS_SeatState{}; // YGOL seat state: nobody is picking once the duel starts #ifndef YGOPRO_SERVER_MODE diff --git a/server/gframe/tag_duel.cpp b/server/gframe/tag_duel.cpp index daf67a6..955a454 100644 --- a/server/gframe/tag_duel.cpp +++ b/server/gframe/tag_duel.cpp @@ -1089,6 +1089,11 @@ void TagDuel::StartDuel(DuelPlayer* dp) { if(restart_phase != 0) // YGOL rules restart: frozen until Commit or Abort return; ygol_started = true; // YGOL rules restart: no Prepare after the first accepted START + // YGOL restart clock: the lobby tick shares the duel timer; a reservation window still open at START + // would tick into the duel and end it at once on "time limit up" (an untimed duel has a limit of 0) + if(has_restart_plan) + ExpireReservations(); + NetServer::StopDuelTimer(); for(auto& state : seat_state) state = CTOS_SeatState{}; // YGOL seat state: nobody is picking once the duel starts #ifndef YGOPRO_SERVER_MODE