From 85637a976c8518bc6e344064c5db4708434fda9b Mon Sep 17 00:00:00 2001 From: Deji Date: Wed, 14 Feb 2024 15:10:06 +0000 Subject: [PATCH] Reset stats on loaded game --- src/Enums.h | 1 + src/Events.h | 7 +++++++ src/Stealthometer.cpp | 3 +++ 3 files changed, 11 insertions(+) diff --git a/src/Enums.h b/src/Enums.h index a367514..f88a10d 100644 --- a/src/Enums.h +++ b/src/Enums.h @@ -34,6 +34,7 @@ enum class Events { BodyHidden, BrokenDisguiseCleared, ContractStart, + ContractLoad, ContractEnd, CrowdNPC_Died, Dart_Hit, diff --git a/src/Events.h b/src/Events.h index bb2af9d..eb8bc7c 100644 --- a/src/Events.h +++ b/src/Events.h @@ -255,6 +255,13 @@ struct Event { }; }; +template<> +struct Event +{ + static auto constexpr Name = "ContractLoad"; + using EventValue = VoidEventValue; +}; + template<> struct Event { static auto constexpr Name = "ContractEnd"; diff --git a/src/Stealthometer.cpp b/src/Stealthometer.cpp index 3e657a9..c9f29f6 100644 --- a/src/Stealthometer.cpp +++ b/src/Stealthometer.cpp @@ -660,6 +660,9 @@ auto Stealthometer::SetupEvents() -> void { events.listen([this](auto& ev) { this->NewContract(); }); + events.listen([this](auto& ev) { + this->NewContract(); + }); events.listen([this](const ServerEvent& ev) { if (this->IsContractEnded()) return; this->missionEndTime = ev.Timestamp;