amb1919 - HasEndOfMapVote finished should be separate from determining if the vote will run at all.

amb1915 - Mapchooser should disable round end changes if forced to change early.
amb1901 - Timer errors with mapchooser

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402439
This commit is contained in:
Matt Woodrow 2008-08-08 00:06:14 +00:00
parent 2b0cc7b4ea
commit eee77228e6
3 changed files with 22 additions and 11 deletions

View File

@ -57,9 +57,18 @@ native InitiateMapChooserVote(MapChange:when, Handle:inputarray=INVALID_HANDLE);
/** /**
* Checks if MapChooser's end of map vote has completed. * Checks if MapChooser's end of map vote has completed.
*
* @return True if complete, false otherwise.
*/ */
native bool:HasEndOfMapVoteFinished(); native bool:HasEndOfMapVoteFinished();
/**
* Checks if MapChooser is set to run an end of map vote.
*
* @return True if enabled, false otherwise.
*/
native bool:EndOfMapVoteEnabled();
/** /**
* Called when mapchooser removes a nomination from its list. * Called when mapchooser removes a nomination from its list.
* Nominations cleared on map start will not trigger this forward * Nominations cleared on map start will not trigger this forward

View File

@ -166,6 +166,7 @@ public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
CreateNative("CanMapChooserStartVote", Native_CanVoteStart); CreateNative("CanMapChooserStartVote", Native_CanVoteStart);
CreateNative("HasEndOfMapVoteFinished", Native_CheckVoteDone); CreateNative("HasEndOfMapVoteFinished", Native_CheckVoteDone);
CreateNative("GetExcludeMapList", Native_GetExcludeMapList); CreateNative("GetExcludeMapList", Native_GetExcludeMapList);
CreateNative("EndOfMapVoteEnabled", Native_EndOfMapVoteEnabled);
return true; return true;
} }
@ -218,6 +219,7 @@ public OnMapEnd()
{ {
g_HasVoteStarted = false; g_HasVoteStarted = false;
g_WaitingForVote = false; g_WaitingForVote = false;
g_ChangeMapAtRoundEnd = false;
g_VoteTimer = INVALID_HANDLE; g_VoteTimer = INVALID_HANDLE;
g_RetryTimer = INVALID_HANDLE; g_RetryTimer = INVALID_HANDLE;
@ -312,11 +314,6 @@ SetupTimeleftTimer()
public Action:Timer_StartMapVote(Handle:timer) public Action:Timer_StartMapVote(Handle:timer)
{ {
if (!GetArraySize(g_MapList) || !GetConVarBool(g_Cvar_EndOfMapVote) || g_MapVoteCompleted || g_HasVoteStarted)
{
return Plugin_Stop;
}
if (timer == g_RetryTimer) if (timer == g_RetryTimer)
{ {
g_RetryTimer = INVALID_HANDLE; g_RetryTimer = INVALID_HANDLE;
@ -326,6 +323,11 @@ public Action:Timer_StartMapVote(Handle:timer)
g_VoteTimer = INVALID_HANDLE; g_VoteTimer = INVALID_HANDLE;
} }
if (!GetArraySize(g_MapList) || !GetConVarBool(g_Cvar_EndOfMapVote) || g_MapVoteCompleted || g_HasVoteStarted)
{
return Plugin_Stop;
}
InitiateVote(MapChange_MapEnd, INVALID_HANDLE); InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
return Plugin_Stop; return Plugin_Stop;
@ -931,14 +933,14 @@ public Native_CanVoteStart(Handle:plugin, numParams)
public Native_CheckVoteDone(Handle:plugin, numParams) public Native_CheckVoteDone(Handle:plugin, numParams)
{ {
if (GetConVarBool(g_Cvar_EndOfMapVote) == false)
{
return true;
}
return g_MapVoteCompleted; return g_MapVoteCompleted;
} }
public Native_EndOfMapVoteEnabled(Handle:plugin, numParams)
{
return GetConVarBool(g_Cvar_EndOfMapVote);
}
public Native_GetExcludeMapList(Handle:plugin, numParams) public Native_GetExcludeMapList(Handle:plugin, numParams)
{ {
new Handle:array = Handle:GetNativeCell(1); new Handle:array = Handle:GetNativeCell(1);

View File

@ -250,7 +250,7 @@ StartRTV()
return; return;
} }
if (HasEndOfMapVoteFinished()) if (EndOfMapVoteEnabled() && HasEndOfMapVoteFinished())
{ {
/* Change right now then */ /* Change right now then */
new String:map[65]; new String:map[65];