mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-02 22:41:38 +00:00
Command_Kick() - Allow removal of non-consoleplayer/secondaryviewplayer player instances (e.g. player bots)
This commit is contained in:
parent
edc312066d
commit
079fe9ba7e
1 changed files with 34 additions and 32 deletions
|
@ -1595,7 +1595,9 @@ static void CL_ReloadReceivedSavegame(void)
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
LUA_InvalidatePlayer(&players[i]);
|
LUA_InvalidatePlayer(&players[i]);
|
||||||
|
#endif
|
||||||
sprintf(player_names[i], "Player %d", i + 1);
|
sprintf(player_names[i], "Player %d", i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2258,15 +2260,11 @@ void D_SaveBan(void)
|
||||||
size_t i;
|
size_t i;
|
||||||
banreason_t *reasonlist = reasonhead;
|
banreason_t *reasonlist = reasonhead;
|
||||||
const char *address, *mask;
|
const char *address, *mask;
|
||||||
const char *path = va("%s"PATHSEP"%s", srb2home, "ban.txt");
|
|
||||||
|
|
||||||
if (!reasonhead)
|
if (!reasonhead)
|
||||||
{
|
|
||||||
remove(path);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
f = fopen(path, "w");
|
f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "w");
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
|
@ -2310,14 +2308,16 @@ static void Ban_Add(const char *reason)
|
||||||
reasontail = reasonlist;
|
reasontail = reasonlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Ban_Clear(void)
|
static void Command_ClearBans(void)
|
||||||
{
|
{
|
||||||
banreason_t *temp;
|
banreason_t *temp;
|
||||||
|
|
||||||
|
if (!I_ClearBans)
|
||||||
|
return;
|
||||||
|
|
||||||
I_ClearBans();
|
I_ClearBans();
|
||||||
|
D_SaveBan();
|
||||||
reasontail = NULL;
|
reasontail = NULL;
|
||||||
|
|
||||||
while (reasonhead)
|
while (reasonhead)
|
||||||
{
|
{
|
||||||
temp = reasonhead->next;
|
temp = reasonhead->next;
|
||||||
|
@ -2327,15 +2327,6 @@ static void Ban_Clear(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Command_ClearBans(void)
|
|
||||||
{
|
|
||||||
if (!I_ClearBans)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Ban_Clear();
|
|
||||||
D_SaveBan();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Ban_Load_File(boolean warning)
|
static void Ban_Load_File(boolean warning)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -2343,9 +2334,6 @@ static void Ban_Load_File(boolean warning)
|
||||||
const char *address, *mask;
|
const char *address, *mask;
|
||||||
char buffer[MAX_WADPATH];
|
char buffer[MAX_WADPATH];
|
||||||
|
|
||||||
if (!I_ClearBans)
|
|
||||||
return;
|
|
||||||
|
|
||||||
f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "r");
|
f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "r");
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
|
@ -2355,7 +2343,13 @@ static void Ban_Load_File(boolean warning)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ban_Clear();
|
if (I_ClearBans)
|
||||||
|
Command_ClearBans();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fclose(f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0; fgets(buffer, (int)sizeof(buffer), f); i++)
|
for (i=0; fgets(buffer, (int)sizeof(buffer), f); i++)
|
||||||
{
|
{
|
||||||
|
@ -2815,11 +2809,11 @@ static void Command_Kick(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!netgame) // Don't kick Tails in splitscreen!
|
//if (!netgame) // Don't kick Tails in splitscreen!
|
||||||
{
|
//{
|
||||||
CONS_Printf(M_GetText("This only works in a netgame.\n"));
|
// CONS_Printf(M_GetText("This only works in a netgame.\n"));
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (server || IsPlayerAdmin(consoleplayer))
|
if (server || IsPlayerAdmin(consoleplayer))
|
||||||
{
|
{
|
||||||
|
@ -2827,6 +2821,11 @@ static void Command_Kick(void)
|
||||||
UINT8 *p = buf;
|
UINT8 *p = buf;
|
||||||
const SINT8 pn = nametonum(COM_Argv(1));
|
const SINT8 pn = nametonum(COM_Argv(1));
|
||||||
|
|
||||||
|
if (splitscreen && (pn == 0 || pn == 1))
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("Splitscreen players cannot be kicked.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (pn == -1 || pn == 0)
|
if (pn == -1 || pn == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -3032,7 +3031,8 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
|
|
||||||
if (pnum == consoleplayer)
|
if (pnum == consoleplayer)
|
||||||
{
|
{
|
||||||
LUAh_GameQuit(false);
|
if (Playing())
|
||||||
|
LUAh_GameQuit();
|
||||||
#ifdef DUMPCONSISTENCY
|
#ifdef DUMPCONSISTENCY
|
||||||
if (msg == KICK_MSG_CON_FAIL) SV_SavedGame();
|
if (msg == KICK_MSG_CON_FAIL) SV_SavedGame();
|
||||||
#endif
|
#endif
|
||||||
|
@ -3732,7 +3732,8 @@ static void HandleConnect(SINT8 node)
|
||||||
static void HandleShutdown(SINT8 node)
|
static void HandleShutdown(SINT8 node)
|
||||||
{
|
{
|
||||||
(void)node;
|
(void)node;
|
||||||
LUAh_GameQuit(false);
|
if (Playing())
|
||||||
|
LUAh_GameQuit();
|
||||||
D_QuitNetGame();
|
D_QuitNetGame();
|
||||||
CL_Reset();
|
CL_Reset();
|
||||||
D_StartTitle();
|
D_StartTitle();
|
||||||
|
@ -3747,7 +3748,8 @@ static void HandleShutdown(SINT8 node)
|
||||||
static void HandleTimeout(SINT8 node)
|
static void HandleTimeout(SINT8 node)
|
||||||
{
|
{
|
||||||
(void)node;
|
(void)node;
|
||||||
LUAh_GameQuit(false);
|
if (Playing())
|
||||||
|
LUAh_GameQuit();
|
||||||
D_QuitNetGame();
|
D_QuitNetGame();
|
||||||
CL_Reset();
|
CL_Reset();
|
||||||
D_StartTitle();
|
D_StartTitle();
|
||||||
|
@ -4850,14 +4852,14 @@ void TryRunTics(tic_t realtics)
|
||||||
{
|
{
|
||||||
DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic));
|
DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic));
|
||||||
|
|
||||||
ps_tictime = I_GetPreciseTime();
|
ps_tictime = I_GetTimeMicros();
|
||||||
|
|
||||||
G_Ticker((gametic % NEWTICRATERATIO) == 0);
|
G_Ticker((gametic % NEWTICRATERATIO) == 0);
|
||||||
ExtraDataTicker();
|
ExtraDataTicker();
|
||||||
gametic++;
|
gametic++;
|
||||||
consistancy[gametic%BACKUPTICS] = Consistancy();
|
consistancy[gametic%BACKUPTICS] = Consistancy();
|
||||||
|
|
||||||
ps_tictime = I_GetPreciseTime() - ps_tictime;
|
ps_tictime = I_GetTimeMicros() - ps_tictime;
|
||||||
|
|
||||||
// Leave a certain amount of tics present in the net buffer as long as we've ran at least one tic this frame.
|
// Leave a certain amount of tics present in the net buffer as long as we've ran at least one tic this frame.
|
||||||
if (client && gamestate == GS_LEVEL && leveltime > 3 && neededtic <= gametic + cv_netticbuffer.value)
|
if (client && gamestate == GS_LEVEL && leveltime > 3 && neededtic <= gametic + cv_netticbuffer.value)
|
||||||
|
|
Loading…
Reference in a new issue