Inline one-expression single-use functions (#1700)

This commit is contained in:
V 2022-02-25 14:39:45 +05:00 committed by GitHub
parent 8579e873ca
commit dc8a22a76a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 24 deletions

View File

@ -235,7 +235,7 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
VoteMenuClose(); delete g_hVoteMenu;
} }
else if (action == MenuAction_Display) else if (action == MenuAction_Display)
{ {
@ -286,7 +286,7 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa
votes = totalVotes - votes; // Reverse the votes to be in relation to the Yes option. votes = totalVotes - votes; // Reverse the votes to be in relation to the Yes option.
} }
percent = GetVotePercent(votes, totalVotes); percent = float(votes) / float(totalVotes);
if (g_voteType != VoteType_Question) if (g_voteType != VoteType_Question)
{ {
@ -404,16 +404,6 @@ void VoteSelect(Menu menu, int param1, int param2 = 0)
} }
*/ */
void VoteMenuClose()
{
delete g_hVoteMenu;
}
float GetVotePercent(int votes, int totalVotes)
{
return float(votes) / float(totalVotes);
}
bool TestVoteDelay(int client) bool TestVoteDelay(int client)
{ {
int delay = CheckVoteDelay(); int delay = CheckVoteDelay();

View File

@ -167,7 +167,7 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa
{ {
if (action == MenuAction_End) if (action == MenuAction_End)
{ {
VoteMenuClose(); delete g_hVoteMenu;
} }
else if (action == MenuAction_Display) else if (action == MenuAction_Display)
{ {
@ -215,7 +215,7 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa
votes = totalVotes - votes; // Reverse the votes to be in relation to the Yes option. votes = totalVotes - votes; // Reverse the votes to be in relation to the Yes option.
} }
percent = GetVotePercent(votes, totalVotes); percent = float(votes) / float(totalVotes);
limit = g_Cvar_Limits[g_voteType].FloatValue; limit = g_Cvar_Limits[g_voteType].FloatValue;
@ -306,16 +306,6 @@ void VoteSelect(Menu menu, int param1, int param2 = 0)
} }
*/ */
void VoteMenuClose()
{
delete g_hVoteMenu;
}
float GetVotePercent(int votes, int totalVotes)
{
return float(votes) / float(totalVotes);
}
bool TestVoteDelay(int client) bool TestVoteDelay(int client)
{ {
int delay = CheckVoteDelay(); int delay = CheckVoteDelay();