Merge pull request #319 from KyleSanderson/20isntagoodnumber
Allow GetMapHistorySize to return numbers greater than 20 (r=Dr!fter).
This commit is contained in:
commit
9ebd4ad627
@ -66,6 +66,7 @@ extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelega
|
|||||||
ConCommand *changeLevelCmd = NULL;
|
ConCommand *changeLevelCmd = NULL;
|
||||||
|
|
||||||
ConVar sm_nextmap("sm_nextmap", "", FCVAR_NOTIFY);
|
ConVar sm_nextmap("sm_nextmap", "", FCVAR_NOTIFY);
|
||||||
|
ConVar sm_maphistory_size("sm_maphistory_size", "20");
|
||||||
|
|
||||||
bool g_forcedChange = false;
|
bool g_forcedChange = false;
|
||||||
|
|
||||||
@ -174,15 +175,18 @@ void NextMapManager::OnSourceModLevelChange( const char *mapName )
|
|||||||
m_mapHistory.push_back(new MapChangeData(lastMap, newReason, m_tempChangeInfo.startTime));
|
m_mapHistory.push_back(new MapChangeData(lastMap, newReason, m_tempChangeInfo.startTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Should this be customizable? */
|
int historydiff = sm_maphistory_size.GetInt();
|
||||||
if (m_mapHistory.size() > 20)
|
if (historydiff > 0)
|
||||||
{
|
{
|
||||||
SourceHook::List<MapChangeData *>::iterator iter;
|
historydiff -= m_mapHistory.size();
|
||||||
iter = m_mapHistory.begin();
|
} else if (historydiff < 0)
|
||||||
|
{
|
||||||
|
historydiff = (m_mapHistory.size() * -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SourceHook::List<MapChangeData *>::iterator iter = m_mapHistory.begin(); historydiff++ < 0; iter = m_mapHistory.erase(iter))
|
||||||
|
{
|
||||||
delete (MapChangeData *)*iter;
|
delete (MapChangeData *)*iter;
|
||||||
|
|
||||||
m_mapHistory.erase(iter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user