From 1aa165348e37f4e02a8f0ababa832d4a2dce1280 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 21 Sep 2024 18:19:57 +0200 Subject: [PATCH 1/2] fix typo --- GWToolboxdll/Windows/ObjectiveTimerWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp b/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp index 3e32dd3b5..85e61f883 100644 --- a/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp +++ b/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp @@ -223,7 +223,7 @@ void ObjectiveTimerWindow::Initialize() // NB: Server may not send packets in the order we want them // e.g. InstanceLoadInfo comes in before ExamplePlugin which means the run start is whacked out - // keep track of the packets and only trigger relevent events when the needed packets are in. + // keep track of the packets and only trigger relevant events when the needed packets are in. GW::StoC::RegisterPostPacketCallback( &InstanceLoadInfo_Entry, [this](GW::HookStatus*, const GW::Packet::StoC::InstanceLoadInfo* packet) { From 77806eb2fad61b1b551ca3223dbe85b9416492d7 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Sat, 21 Sep 2024 18:52:01 +0200 Subject: [PATCH 2/2] formatting --- GWToolboxdll/Windows/ObjectiveTimerWindow.cpp | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp b/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp index 85e61f883..d97232309 100644 --- a/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp +++ b/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp @@ -284,21 +284,23 @@ void ObjectiveTimerWindow::Initialize() map_load_pending = true; }, -5); // packet hooks that trigger events: - GW::StoC::RegisterPacketCallback(&MessageServer_Entry, - [this](GW::HookStatus*, GW::Packet::StoC::MessageServer*) { - const GW::Array* buff = &GW::GetGameContext()->world->message_buff; - if (!buff || !buff->valid() || !buff->size()) { - return; // Message buffer empty!? - } - const wchar_t* msg = buff->begin(); - // NB: buff->size() includes null terminating char. All GW strings are null terminated, use wcslen instead - Event(EventType::ServerMessage, wcslen(msg), msg); - }); - GW::StoC::RegisterPacketCallback(&DisplayDialogue_Entry, - [this](GW::HookStatus*, const GW::Packet::StoC::DisplayDialogue* packet) { - // NB: All GW strings are null terminated, use wcslen to avoid having to check all 122 chars - Event(EventType::DisplayDialogue, wcslen(packet->message), packet->message); - }); + GW::StoC::RegisterPacketCallback( + &MessageServer_Entry, + [this](GW::HookStatus*, GW::Packet::StoC::MessageServer*) { + const GW::Array* buff = &GW::GetGameContext()->world->message_buff; + if (!buff || !buff->valid() || !buff->size()) { + return; // Message buffer empty!? + } + const wchar_t* msg = buff->begin(); + // NB: buff->size() includes null terminating char. All GW strings are null terminated, use wcslen instead + Event(EventType::ServerMessage, wcslen(msg), msg); + }); + GW::StoC::RegisterPacketCallback( + &DisplayDialogue_Entry, + [this](GW::HookStatus*, const GW::Packet::StoC::DisplayDialogue* packet) { + // NB: All GW strings are null terminated, use wcslen to avoid having to check all 122 chars + Event(EventType::DisplayDialogue, wcslen(packet->message), packet->message); + }); GW::StoC::RegisterPacketCallback( &ManipulateMapObject_Entry, [this](GW::HookStatus*, const GW::Packet::StoC::ManipulateMapObject* packet) { if (GW::Map::GetInstanceType() == GW::Constants::InstanceType::Explorable) {