mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Properly check for duplicate recent IP
Clean up M_AddToJoinedIPs a bit
This commit is contained in:
parent
e1c8f8095b
commit
08cd0393c0
1 changed files with 5 additions and 7 deletions
12
src/m_misc.c
12
src/m_misc.c
|
|
@ -197,24 +197,22 @@ void M_InitJoinedIPArray(void)
|
||||||
// This adds an entry to the above array
|
// This adds an entry to the above array
|
||||||
void M_AddToJoinedIPs(char *address, char *servname)
|
void M_AddToJoinedIPs(char *address, char *servname)
|
||||||
{
|
{
|
||||||
|
|
||||||
UINT8 i = 0;
|
UINT8 i = 0;
|
||||||
UINT8 dupeindex = 0;
|
|
||||||
|
|
||||||
// Check for dupes...
|
// Check for dupes...
|
||||||
for (; i < NUMLOGIP && !dupeindex; i++)
|
for (i = 0; i < NUMLOGIP; i++)
|
||||||
{
|
{
|
||||||
// I don't care about the server name (this is broken anyway...) but definitely check the addresses
|
// I don't care about the server name (this is broken anyway...) but definitely check the addresses
|
||||||
if (strcmp(joinedIPlist[i][0], address) == 0)
|
if (strcmp(joinedIPlist[i][0], address) == 0)
|
||||||
dupeindex = i;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CONS_Printf("Adding %s (%s) to list of manually joined IPs\n", servname, address);
|
CONS_Printf("Adding %s (%s) to list of manually joined IPs\n", servname, address);
|
||||||
|
|
||||||
// Start by moving every IP up 1 slot (dropping the last IP in the table)
|
// Start by moving every IP up 1 slot (dropping the last IP in the table)
|
||||||
// If we found duplicates, start here instead and pull the rest up.
|
for (i = NUMLOGIP; i; i--)
|
||||||
i = dupeindex ? dupeindex : NUMLOGIP;
|
|
||||||
for (; i; i--)
|
|
||||||
{
|
{
|
||||||
strcpy(joinedIPlist[i][0], joinedIPlist[i-1][0]);
|
strcpy(joinedIPlist[i][0], joinedIPlist[i-1][0]);
|
||||||
strcpy(joinedIPlist[i][1], joinedIPlist[i-1][1]);
|
strcpy(joinedIPlist[i][1], joinedIPlist[i-1][1]);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue