Fix mother zombie infection cycle not saving picked alternative candidates at end of cycle.

This commit is contained in:
BotoX 2020-12-05 20:15:28 +01:00
parent 855e38cab2
commit e2e15972e2

View File

@ -594,9 +594,21 @@ public Action:InfectMotherZombie(Handle:timer)
RemoveFromArray(aCandidatesMain, i); RemoveFromArray(aCandidatesMain, i);
candidatesMain--; candidatesMain--;
} }
else
{
// No main candidates, reset the mother zombie cycle now before infecting anyone else.
if (!resetcycle)
{
resetcycle = true;
// Clear mother zombie round-robin cycle storage.
SteamidCacheReset(g_hInfectMotherCycle);
// Announce start of new cycle
TranslationPrintToChatAll(true, false, "Mother zombie infect cycle reset");
}
// Infect one of the alternate candidates. // Infect one of the alternate candidates.
else if (candidatesAlt) if (candidatesAlt)
{ {
// Get a random array index. // Get a random array index.
new i = Math_GetRandomInt(0, candidatesAlt - 1); new i = Math_GetRandomInt(0, candidatesAlt - 1);
@ -611,28 +623,12 @@ public Action:InfectMotherZombie(Handle:timer)
// Remove player from eligible client list. // Remove player from eligible client list.
RemoveFromArray(aCandidatesAlt, i); RemoveFromArray(aCandidatesAlt, i);
candidatesAlt--; candidatesAlt--;
// Enable the cycle reset.
resetcycle = true;
} }
else // We have no candidates at all, abort!
// We have no candidates at all, abort!
else
{ {
// Enable the cycle reset.
resetcycle = true;
break; break;
} }
} }
if (resetcycle)
{
// Restart the cycle.
// Clear mother zombie round-robin cycle storage.
SteamidCacheReset(g_hInfectMotherCycle);
// Announce start of new cycle
TranslationPrintToChatAll(true, false, "Mother zombie infect cycle reset");
} }
// Mother zombies have been infected. // Mother zombies have been infected.