From dc8a22a76a03810cd0ad005f8bb10e884e1c03df Mon Sep 17 00:00:00 2001 From: V <40791562+TheByKotik@users.noreply.github.com> Date: Fri, 25 Feb 2022 14:39:45 +0500 Subject: [PATCH] Inline one-expression single-use functions (#1700) --- plugins/basevotes.sp | 14 ++------------ plugins/funvotes.sp | 14 ++------------ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/plugins/basevotes.sp b/plugins/basevotes.sp index 4337e13e..c09f16d9 100644 --- a/plugins/basevotes.sp +++ b/plugins/basevotes.sp @@ -235,7 +235,7 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa { if (action == MenuAction_End) { - VoteMenuClose(); + delete g_hVoteMenu; } 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. } - percent = GetVotePercent(votes, totalVotes); + percent = float(votes) / float(totalVotes); 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) { int delay = CheckVoteDelay(); diff --git a/plugins/funvotes.sp b/plugins/funvotes.sp index 4587dfbf..7aaabc95 100644 --- a/plugins/funvotes.sp +++ b/plugins/funvotes.sp @@ -167,7 +167,7 @@ public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int pa { if (action == MenuAction_End) { - VoteMenuClose(); + delete g_hVoteMenu; } 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. } - percent = GetVotePercent(votes, totalVotes); + percent = float(votes) / float(totalVotes); 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) { int delay = CheckVoteDelay();