Skip to content

Commit

Permalink
ChaosMod/Voting: Fix warning & small cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
pongo1231 committed Jan 30, 2025
1 parent d2a44e1 commit 0322a5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 9 additions & 9 deletions ChaosMod/Components/Voting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ bool Voting::Init()
CloseHandle(mutex);
}

m_SecsBeforeVoting = g_OptionsManager.GetVotingValue({ "VotingSecsBeforeVoting", "TwitchVotingSecsBeforeVoting" },
OPTION_DEFAULT_TWITCH_SECS_BEFORE_VOTING);
m_SecsBeforeVoting = g_OptionsManager.GetVotingValue({ "VotingSecsBeforeVoting", "TwitchVotingSecsBeforeVoting" },
OPTION_DEFAULT_TWITCH_SECS_BEFORE_VOTING);

m_OverlayMode = g_OptionsManager.GetVotingValue({ "VotingOverlayMode", "TwitchVotingOverlayMode" },
static_cast<OverlayMode>(OPTION_DEFAULT_TWITCH_OVERLAY_MODE));
m_OverlayMode = g_OptionsManager.GetVotingValue({ "VotingOverlayMode", "TwitchVotingOverlayMode" },
static_cast<OverlayMode>(OPTION_DEFAULT_TWITCH_OVERLAY_MODE));

m_VotingMode = g_OptionsManager.GetVotingValue({ "VotingChanceSystem", "TwitchVotingChanceSystem" },
OPTION_DEFAULT_TWITCH_PROPORTIONAL_VOTING) ? VotingMode::Percentage : VotingMode::Majority;
m_VotingMode = g_OptionsManager.GetVotingValue({ "VotingChanceSystem", "TwitchVotingChanceSystem" },
OPTION_DEFAULT_TWITCH_PROPORTIONAL_VOTING)
? VotingMode::Percentage
: VotingMode::Majority;
m_EnableVotingChanceSystemRetainInitialChance =
g_OptionsManager.GetVotingValue({ "VotingChanceSystemRetainChance", "TwitchVotingChanceSystemRetainChance" },
OPTION_DEFAULT_TWITCH_PROPORTIONAL_VOTING_RETAIN_CHANCE);
Expand Down Expand Up @@ -291,11 +293,9 @@ void Voting::OnRun()
m_VotingModeOverride = newMode;

if (newMode == VotingMode::None)
{
newMode = m_VotingMode;
}

SendToPipe(std::string("votingmode"), { newMode.ToString() });
SendToPipe("votingmode", { std::string(newMode.ToString()) });
}
}

Expand Down
4 changes: 3 additions & 1 deletion ChaosMod/Util/VotingMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class VotingMode
return value != a.value;
}

std::string ToString()
std::string_view ToString() const
{
switch (value)
{
Expand All @@ -43,6 +43,8 @@ class VotingMode
case VotingMode::Antimajority:
return "ANTIMAJORITY";
}

return "UNKNOWN";
}

private:
Expand Down

0 comments on commit 0322a5e

Please sign in to comment.