Clear the IP Ban list when you start to host the game, instead of when you shut down warzone.

Reset numBans back to 0 on list creation.

2.3:r10543

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10582 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2010-04-15 03:12:51 +00:00 committed by Git SVN Gateway
parent 321bcc3505
commit 71a9f27b40
1 changed files with 8 additions and 2 deletions

View File

@ -2440,7 +2440,12 @@ BOOL NEThostGame(const char* SessionName, const char* PlayerName,
}
NetPlay.isHost = true;
NETlogEntry("Hosting game", SYNC_FLAG, 0);
NETlogEntry("Hosting game, resetting ban list.", SYNC_FLAG, 0);
if (IPlist)
{
free(IPlist);
IPlist = NULL;
}
sstrcpy(gamestruct.name, SessionName);
memset(&gamestruct.desc, 0, sizeof(gamestruct.desc));
gamestruct.desc.dwSize = sizeof(gamestruct.desc);
@ -2875,7 +2880,7 @@ static bool onBanList(const char *ip)
if (!IPlist) return false; //if no bans are added, then don't check.
for(i = 0; i < MAX_BANS ; i++)
{
if (strcmp(ip, IPlist[i].IPAddress)==0)
if (strcmp(ip, IPlist[i].IPAddress) == 0)
{
return true;
}
@ -2900,6 +2905,7 @@ static void addToBanList(const char *ip, const char *name)
debug(LOG_FATAL, "Out of memory!");
abort();
}
numBans = 0;
}
memset(IPlist, 0x0, sizeof(PLAYER_IP) * MAX_BANS);
sstrcpy(IPlist[numBans].IPAddress, ip);