mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 12:01:05 +00:00
Merge branch 'sync-rate-limit' into 'next'
Synchronize rate limit variables and limit PlayerMsg hook Closes #1289 See merge request STJr/SRB2!2512
This commit is contained in:
commit
ec9e95053b
3 changed files with 20 additions and 6 deletions
|
@ -587,8 +587,8 @@ static void Command_CSay_f(void)
|
|||
DoSayCommand(0, 1, HU_CSAY);
|
||||
}
|
||||
|
||||
static tic_t spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent.
|
||||
static tic_t spam_tics[MAXPLAYERS];
|
||||
UINT8 spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent.
|
||||
tic_t spam_tics[MAXPLAYERS];
|
||||
|
||||
/** Receives a message, processing an ::XD_SAY command.
|
||||
* \sa DoSayCommand
|
||||
|
@ -649,14 +649,12 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
|||
else
|
||||
spam_tokens[playernum] -= 1;
|
||||
|
||||
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
|
||||
if (spam_eatmsg)
|
||||
return; // don't proceed if we were supposed to eat the message.
|
||||
|
||||
if (LUA_HookPlayerMsg(playernum, target, flags, msg))
|
||||
return;
|
||||
|
||||
if (spam_eatmsg)
|
||||
return; // don't proceed if we were supposed to eat the message.
|
||||
|
||||
// If it's a CSAY, just CECHO and be done with it.
|
||||
if (flags & HU_CSAY)
|
||||
{
|
||||
|
|
|
@ -79,6 +79,9 @@ void HU_AddChatText(const char *text, boolean playsound);
|
|||
// set true when entering a chat message
|
||||
extern boolean chat_on;
|
||||
|
||||
extern UINT8 spam_tokens[MAXPLAYERS];
|
||||
extern tic_t spam_tics[MAXPLAYERS];
|
||||
|
||||
extern patch_t *emeraldpics[3][8];
|
||||
extern patch_t *rflagico;
|
||||
extern patch_t *bflagico;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "p_polyobj.h"
|
||||
#include "lua_script.h"
|
||||
#include "p_slopes.h"
|
||||
#include "hu_stuff.h"
|
||||
|
||||
savedata_t savedata;
|
||||
UINT8 *save_p;
|
||||
|
@ -4611,6 +4612,12 @@ static void P_NetArchiveMisc(boolean resending)
|
|||
WRITEUINT8(save_p, 0x2f);
|
||||
else
|
||||
WRITEUINT8(save_p, 0x2e);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
WRITEUINT8(save_p, spam_tokens[i]);
|
||||
WRITEUINT32(save_p, spam_tics[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static inline boolean P_NetUnArchiveMisc(boolean reloading)
|
||||
|
@ -4708,6 +4715,12 @@ static inline boolean P_NetUnArchiveMisc(boolean reloading)
|
|||
if (READUINT8(save_p) == 0x2f)
|
||||
paused = true;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
spam_tokens[i] = READUINT8(save_p);
|
||||
spam_tics[i] = READUINT32(save_p);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue