Bugfix: Wrong counting of GetMapCount and typo in CHalfLifeMultiplay::ProcessMapVote

This commit is contained in:
s1lentq 2016-06-04 17:43:52 +06:00
parent c406141e47
commit 6115723666

View File

@ -4483,22 +4483,22 @@ void CHalfLifeMultiplay::ResetAllMapVotes()
int GetMapCount() int GetMapCount()
{ {
static mapcycle_t mapcycle2; static mapcycle_t mapcycle;
char *mapcfile = (char *)CVAR_GET_STRING("mapcyclefile"); char *mapcfile = (char *)CVAR_GET_STRING("mapcyclefile");
DestroyMapCycle(&mapcycle2); DestroyMapCycle(&mapcycle);
ReloadMapCycleFile(mapcfile, &mapcycle2); ReloadMapCycleFile(mapcfile, &mapcycle);
int iCount = 0, iDone = 0; int nCount = 0;
for (mapcycle_item_s *item = mapcycle2.next_item; item != NULL && iDone != 1; item = item->next) auto item = mapcycle.next_item;
do
{ {
if (item == mapcycle2.next_item) ++nCount;
iDone = 1; item = item->next;
} while (item != mapcycle.next_item);
++iCount; return nCount;
}
return iCount;
} }
void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *player, int iVote) void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *player, int iVote)
@ -4561,7 +4561,6 @@ void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *player, int iVote)
void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *player, int iVote) void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *player, int iVote)
{ {
CBaseEntity *pTempEntity = NULL; CBaseEntity *pTempEntity = NULL;
int iValidVotes = 0, iNumPlayers = 0; int iValidVotes = 0, iNumPlayers = 0;
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")) != NULL) while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")) != NULL)
@ -4575,7 +4574,7 @@ void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *player, int iVote)
{ {
++iNumPlayers; ++iNumPlayers;
if (pTempPlayer->m_iMapVote = iVote) if (pTempPlayer->m_iMapVote == iVote)
++iValidVotes; ++iValidVotes;
} }
} }