From e32df416fe91dcb3bfc2dfc3c017a8a707057a54 Mon Sep 17 00:00:00 2001 From: GameChaos Date: Sun, 17 Nov 2024 21:00:36 +0200 Subject: [PATCH] Fix timer zones being shared by all courses (#276) --- src/kz/mappingapi/kz_mappingapi.cpp | 10 ++++++++++ src/kz/timer/kz_timer.cpp | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/kz/mappingapi/kz_mappingapi.cpp b/src/kz/mappingapi/kz_mappingapi.cpp index 1c84ff0e..5c296777 100644 --- a/src/kz/mappingapi/kz_mappingapi.cpp +++ b/src/kz/mappingapi/kz_mappingapi.cpp @@ -627,6 +627,16 @@ void KZ::mapapi::OnRoundStart() FOR_EACH_VEC(g_mappingApi.triggers, i) { KzTrigger *trigger = &g_mappingApi.triggers[i]; + if (!KZ::mapapi::IsTimerTrigger(trigger->type)) + { + continue; + } + + if (!KZ_STREQ(trigger->zone.courseDescriptor, courseDescriptor->entityTargetname)) + { + continue; + } + switch (trigger->type) { case KZTRIGGER_ZONE_SPLIT: diff --git a/src/kz/timer/kz_timer.cpp b/src/kz/timer/kz_timer.cpp index 5f2ffb48..0e070ed3 100644 --- a/src/kz/timer/kz_timer.cpp +++ b/src/kz/timer/kz_timer.cpp @@ -105,7 +105,7 @@ void KZTimerService::StartZoneEndTouch(const KZCourseDescriptor *course) void KZTimerService::SplitZoneStartTouch(const KZCourseDescriptor *course, i32 splitNumber) { - if (!this->GetTimerRunning()) + if (!this->timerRunning || course->course->guid != this->currentCourseGUID) { return; } @@ -123,7 +123,7 @@ void KZTimerService::SplitZoneStartTouch(const KZCourseDescriptor *course, i32 s void KZTimerService::CheckpointZoneStartTouch(const KZCourseDescriptor *course, i32 cpNumber) { - if (!this->GetTimerRunning()) + if (!this->timerRunning || course->course->guid != this->currentCourseGUID) { return; } @@ -142,7 +142,7 @@ void KZTimerService::CheckpointZoneStartTouch(const KZCourseDescriptor *course, void KZTimerService::StageZoneStartTouch(const KZCourseDescriptor *course, i32 stageNumber) { - if (!this->GetTimerRunning()) + if (!this->timerRunning || course->course->guid != this->currentCourseGUID) { return; }