Skip to content

Commit

Permalink
Fixed potential crash when whispering via friendlistwindow
Browse files Browse the repository at this point in the history
Added relative speed figure to info window
  • Loading branch information
Jon committed Mar 14, 2021
1 parent 9734895 commit fba1176
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions GWToolboxdll/Windows/FriendListWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ void FriendListWindow::OnOutgoingWhisper(GW::HookStatus *, int channel, wchar_t
if (instance.is_redirecting_whisper || static_cast<GW::Chat::Channel>(channel) != GW::Chat::CHANNEL_WHISPER)
return;
wchar_t* separator_pos = wcschr(message, ',');
if (!separator_pos)
return;
instance.pending_whisper.reset(std::wstring(message, separator_pos), std::wstring(&separator_pos[1]));
}

Expand Down
3 changes: 2 additions & 1 deletion GWToolboxdll/Windows/InfoWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ void InfoWindow::DrawAgentInfo(GW::Agent* agent) {
ImGui::ShowHelp("Agent ID is unique for each agent in the instance,\nIt's generated on spawn and will change in different instances.");
InfoField("X pos", "%.2f", agent->pos.x);
InfoField("Y pos", "%.2f", agent->pos.y);
InfoField("Speed", "%.3f", sqrtf(agent->move_x * agent->move_x + agent->move_y * agent->move_y));
float speed = sqrtf(agent->move_x * agent->move_x + agent->move_y * agent->move_y);
InfoField("Speed (Relative)", "%.2f (%.2f) ", speed, speed > 0.f ? speed / 288.0f : 0.f);
if (living) {
InfoField(living->IsPlayer() ? "Player ID" : "Model ID", "%d", living->player_number);
ImGui::ShowHelp("Model ID is unique for each kind of agent.\n"
Expand Down

0 comments on commit fba1176

Please sign in to comment.