Skip to content

Commit

Permalink
Reset stats on loaded game
Browse files Browse the repository at this point in the history
  • Loading branch information
Deji69 committed Feb 14, 2024
1 parent 0e02049 commit 85637a9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum class Events {
BodyHidden,
BrokenDisguiseCleared,
ContractStart,
ContractLoad,
ContractEnd,
CrowdNPC_Died,
Dart_Hit,
Expand Down
7 changes: 7 additions & 0 deletions src/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ struct Event<Events::ContractStart> {
};
};

template<>
struct Event<Events::ContractLoad>
{
static auto constexpr Name = "ContractLoad";
using EventValue = VoidEventValue;
};

template<>
struct Event<Events::ContractEnd> {
static auto constexpr Name = "ContractEnd";
Expand Down
3 changes: 3 additions & 0 deletions src/Stealthometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@ auto Stealthometer::SetupEvents() -> void {
events.listen<Events::ContractStart>([this](auto& ev) {
this->NewContract();
});
events.listen<Events::ContractLoad>([this](auto& ev) {
this->NewContract();
});
events.listen<Events::ContractEnd>([this](const ServerEvent<Events::ContractEnd>& ev) {
if (this->IsContractEnded()) return;
this->missionEndTime = ev.Timestamp;
Expand Down

0 comments on commit 85637a9

Please sign in to comment.