Skip to content

Commit

Permalink
new tooltip format, version 1.5.11
Browse files Browse the repository at this point in the history
  • Loading branch information
surepy committed Oct 13, 2023
1 parent 4bfe7b4 commit a92cf5b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<p align="center">
<s>Automatically detects and votekicks cheaters/bots in TF2 casual.</s>
<br />
Attempts to improve the gameplay experience of playing in casual valve matchmaking servers.
A handy little tool to gather and keep track of bots and bad actors in Team Fortress 2.
<br />
<i>sleepy's personal build.</i>
<!-- commented until there is documentation at the wiki
Expand Down
2 changes: 1 addition & 1 deletion cmake/init-preproject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ cmake_policy(SET CMP0091 NEW) # Enable [CMAKE_]MSVC_RUNTIME_LIBRARY

set(TF2BD_VERSION_MAJOR 1 CACHE STRING "TF2BD major version." FORCE)
set(TF2BD_VERSION_MINOR 5 CACHE STRING "TF2BD minor version." FORCE)
set(TF2BD_VERSION_PATCH 10 CACHE STRING "TF2BD patch version." FORCE)
set(TF2BD_VERSION_PATCH 11 CACHE STRING "TF2BD patch version." FORCE)
2 changes: 1 addition & 1 deletion tf2_bot_detector/Config/PlayerListJSON.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ struct mh::formatter<tf2_bot_detector::PlayerAttributesList, CharT>
if (printed)
it = mh::format_to(it, MH_FMT_STRING(", "));

it = mh::format_to(it, MH_FMT_STRING("{}"), mh::enum_fmt(thisAttr));
it = mh::format_to(it, MH_FMT_STRING("{:v}"), mh::enum_fmt(thisAttr));
printed = true;
}

Expand Down
9 changes: 6 additions & 3 deletions tf2_bot_detector/UI/MainWindow.Scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,16 @@ static void PrintPlayerSourceBans(const IPlayer& player)
}

for (const auto& [server, ban] : banState) {
ImGui::TextFmt(" {} (as {}) : Ban State = ", server, ban.m_UserName);
ImGui::TextFmt(" {} (as {}) = ", server, ban.m_UserName);
ImGui::SameLineNoPad();

const ImVec4 banStateColor = ban.m_BanState >= tf2_bot_detector::SteamHistoryAPI::Current ? COLOR_YELLOW : ImVec4{ 1, 1, 1, 1 };
ImGui::TextFmt(banStateColor, "{:v}", mh::enum_fmt(ban.m_BanState));
ImGui::TextFmt(banStateColor, "{:v} ", mh::enum_fmt(ban.m_BanState));
ImGui::SameLineNoPad();

ImGui::TextFmt("[{} ago]", HumanDuration(tfbd_clock_t::now() - ban.m_BanTimestamp));

ImGui::TextFmt(" - {} / reason: {}", ban.m_BanTimestamp, ban.m_BanReason);
ImGui::TextFmt(" - reason: {}", ban.m_BanReason);
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions tf2_bot_detector/UI/SettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ void tf2_bot_detector::SettingsWindow::OnDrawMiscSettings()

// this code has some flaws,
// 1. it doesn't check if the port given is even a valid port
// 2. it doesnt check if that port is available
// however, we can blame the user for using this option so lol
// 2. it doesn't check if that port is available
// however, we can just blame the user for using this option so lol
if (ImGui::InputText("port", &port, ImGuiInputTextFlags_CharsDecimal)) {
for (size_t i = 0; i < port.size(); ++i) {
if (!isdigit(port.at(i))) {
Expand Down
5 changes: 5 additions & 0 deletions tf2_bot_detector/WorldState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ const IPlayer* WorldState::FindPlayer(const SteamID& id) const
return nullptr;
}

const IPlayer* tf2_bot_detector::WorldState::LocalPlayer() const
{
return FindPlayer(m_Settings.GetLocalSteamID());
}

size_t WorldState::GetApproxLobbyMemberCount() const
{
return m_CurrentLobbyMembers.size() + m_PendingLobbyMembers.size();
Expand Down
2 changes: 2 additions & 0 deletions tf2_bot_detector/WorldState.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ namespace tf2_bot_detector

virtual const IPlayer* FindPlayer(const SteamID& id) const = 0;
IPlayer* FindPlayer(const SteamID& id) { return const_cast<IPlayer*>(std::as_const(*this).FindPlayer(id)); }
virtual const IPlayer* LocalPlayer() const = 0;

virtual size_t GetApproxLobbyMemberCount() const = 0;
virtual mh::generator<const IPlayer&> GetLobbyMembers() const = 0;
Expand Down Expand Up @@ -168,6 +169,7 @@ namespace tf2_bot_detector

using IWorldState::FindPlayer;
const IPlayer* FindPlayer(const SteamID& id) const override;
const IPlayer* LocalPlayer() const override;

mh::generator<const IPlayer&> GetLobbyMembers() const;
mh::generator<const IPlayer&> GetPlayers() const;
Expand Down

0 comments on commit a92cf5b

Please sign in to comment.