mapchooser_extended: Fix bug with full nomination when addmap and removemap. Add nominate_removemap menu.

This commit is contained in:
BotoX
2019-12-22 14:10:01 +01:00
parent d21b81a2b8
commit bd1c3bb24d
2 changed files with 129 additions and 50 deletions
@@ -53,7 +53,7 @@
#pragma semicolon 1
#pragma newdecls required
#define MCE_VERSION "1.3.0"
#define MCE_VERSION "1.3.1"
enum RoundCounting
{
@@ -1719,7 +1719,7 @@ NominateResult InternalNominateMap(char[] map, bool force, int owner)
}
/* Too many nominated maps. */
if(g_NominateCount >= GetVoteSize() && !force)
if(g_NominateCount >= GetVoteSize(0) && !force)
{
return Nominate_VoteFull;
}
@@ -1783,9 +1783,14 @@ bool InternalRemoveNominationByMap(char[] map)
Call_PushCell(GetArrayCell(g_NominateOwners, i));
Call_Finish();
int owner = GetArrayCell(g_NominateOwners, i);
if(owner)
g_NominateCount--;
else
g_NominateReservedCount--;
RemoveFromArray(g_NominateList, i);
RemoveFromArray(g_NominateOwners, i);
g_NominateCount--;
return true;
}
@@ -2376,19 +2381,17 @@ stock void AddExtendToMenu(Handle menu, MapChange when)
// 0 = IncludeMaps, 1 = Reserved, 2 = IncludeMaps+Reserved
stock int GetVoteSize(int what=0)
{
int voteSize = 0;
int includeMaps = GetConVarInt(g_Cvar_IncludeMaps);
int includeMapsReserved = GetConVarInt(g_Cvar_IncludeMapsReserved);
if(what == 0 || what == 2)
voteSize += includeMaps;
if(what == 1 || what == 2)
voteSize += includeMapsReserved;
if(what == 0)
return includeMaps;
else if(what == 1)
return includeMapsReserved;
else if(what == 2)
return includeMaps + includeMapsReserved;
if(what == 1)
return voteSize - includeMaps;
return voteSize;
return 0;
}
stock int InternalGetMapCooldown(const char[] map)
@@ -2431,6 +2434,9 @@ void CheckMapRestrictions(bool time = false, bool players = false)
for(int i = 0; i < GetArraySize(g_NominateList); i++)
{
int client = GetArrayCell(g_NominateOwners, i);
if(!client)
continue;
if(CheckCommandAccess(client, "sm_nominate_ignore", ADMFLAG_CHEATS, true))
continue;