Complete BANFORMAT header implementation.

* Warn the user when an incompatible ban.txt is being loaded, and stop early.
* Don't inexplicably assign as a boolean, you bafooligan!
This commit is contained in:
toaster 2022-06-15 22:34:05 +01:00
parent 3ff5e3f8cd
commit 7c92a7efbb

View file

@ -2789,7 +2789,7 @@ void D_LoadBan(boolean warning)
char *username, *reason;
time_t unbanTime = NO_BAN_TIME;
char buffer[MAX_WADPATH];
boolean banmode = 0;
UINT8 banmode = 0;
if (!I_ClearBans)
return;
@ -2816,6 +2816,18 @@ void D_LoadBan(boolean warning)
if (i == 0 && !strncmp(address, "BANFORMAT", 9))
{
banmode = atoi(mask);
switch (banmode)
{
case BANFORMAT: // currently supported format
//case 0: -- permitted only when BANFORMAT string not present
break;
default:
{
fclose(f);
CONS_Alert(CONS_WARNING, "Could not load unknown ban.txt for ban list (BANFORMAT %d, expected %d)\n", banmode, BANFORMAT);
return;
}
}
continue;
}