Skip to content

Commit

Permalink
Fixed bug preventing current objective timer from stopping on char ch…
Browse files Browse the repository at this point in the history
…ange
  • Loading branch information
3vcloud committed Sep 19, 2024
1 parent f5c137f commit d197385
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions GWToolboxdll/Windows/ObjectiveTimerWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <GWToolbox.h>
#include <Utils/GuiUtils.h>
#include <Logger.h>
#include <GWCA/Context/CharContext.h>

constexpr uint32_t TIME_UNKNOWN = std::numeric_limits<uint32_t>::max();
unsigned int ObjectiveTimerWindow::ObjectiveSet::cur_ui_id = 0;
Expand Down Expand Up @@ -228,6 +229,8 @@ void ObjectiveTimerWindow::Initialize()
InstanceLoadInfo = new GW::Packet::StoC::InstanceLoadInfo;
memcpy(InstanceLoadInfo, packet, sizeof(GW::Packet::StoC::InstanceLoadInfo));
CheckIsMapLoaded();
if (current_objective_set && current_objective_set->character_name != GW::GetCharContext()->player_name)
StopObjectives();
});
GW::StoC::RegisterPostPacketCallback<GW::Packet::StoC::InstanceLoadFile>(
&InstanceLoadFile_Entry, [this](GW::HookStatus*, const GW::Packet::StoC::InstanceLoadFile* packet) {
Expand Down Expand Up @@ -1430,6 +1433,7 @@ ObjectiveTimerWindow::ObjectiveSet::ObjectiveSet()
system_time = static_cast<DWORD>(time(nullptr));
run_start_time_point = TimerWidget::Instance().GetStartPoint() != TIME_UNKNOWN ? TimerWidget::Instance().GetStartPoint() : time_point_ms();
duration = TIME_UNKNOWN;
character_name = GW::GetCharContext()->player_name;
}

ObjectiveTimerWindow::ObjectiveSet::~ObjectiveSet()
Expand Down
1 change: 1 addition & 0 deletions GWToolboxdll/Windows/ObjectiveTimerWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class ObjectiveTimerWindow : public ToolboxWindow {
DWORD run_start_time_point = 0;
DWORD duration = static_cast<DWORD>(-1);
DWORD GetDuration();
std::wstring character_name;
const char* GetDurationStr();
const char* GetStartTimeStr();

Expand Down

0 comments on commit d197385

Please sign in to comment.