Commit c7060aa5 by Latapostrophe

Remove mute boolean from playermsg hook, fix username stuff still being there,…

Remove mute boolean from playermsg hook, fix username stuff still being there, potential memory leaks, and added back the ip message.
parent 619dd9d0
......@@ -582,7 +582,6 @@ void D_RegisterServerCommands(void)
*/
void D_RegisterClientCommands(void)
{
const char *username;
INT32 i;
for (i = 0; i < MAXSKINCOLORS; i++)
......@@ -639,8 +638,6 @@ void D_RegisterClientCommands(void)
#endif
// register these so it is saved to config
if ((username = I_GetUserName()))
cv_playername.defaultvalue = username;
CV_RegisterVar(&cv_playername);
CV_RegisterVar(&cv_playercolor);
CV_RegisterVar(&cv_skin); // r_things.c (skin NAME)
......
......@@ -465,11 +465,8 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
{
// check if nodenum[1] is a space
if (nodenum[1] == ' ')
{
spc = 0;
free(nodenum); // don't need this anymore.
// let it slide
}
else
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
......@@ -664,7 +661,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
#ifdef HAVE_BLUA
if (LUAh_PlayerMsg(playernum, target, flags, msg, spam_eatmsg))
if (LUAh_PlayerMsg(playernum, target, flags, msg))
return;
#endif
......@@ -989,11 +986,8 @@ static void HU_queueChatChar(char c)
{
// check if nodenum[1] is a space
if (nodenum[1] == ' ')
{
spc = 0;
free(nodenum);
// let it slide
}
else
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
......
......@@ -75,7 +75,7 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Ho
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute); // Hook for chat messages
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
......
......@@ -952,10 +952,8 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
return hooked;
}
// Hook for player chat
// Added the "mute" field. It's set to true if the message was supposed to be eaten by spam protection.
// But for netgame consistency purposes, this hook is ran first reguardless, so this boolean allows for modders to adapt if they so desire.
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute)
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg)
{
hook_p hookp;
boolean hooked = false;
......@@ -984,19 +982,14 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute)
LUA_PushUserdata(gL, &players[target-1], META_PLAYER); // target
}
lua_pushstring(gL, msg); // msg
if (mute)
lua_pushboolean(gL, true); // the message was supposed to be eaten by spamprotecc.
else
lua_pushboolean(gL, false);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
lua_pushvalue(gL, -6);
if (lua_pcall(gL, 5, 1, 0)) {
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
lua_pushvalue(gL, -5);
if (lua_pcall(gL, 4, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1);
......
......@@ -6346,7 +6346,10 @@ static void M_ConnectIP(INT32 choice)
(void)choice;
if (*setupm_ip == 0)
{
M_StartMessage("You must specify an IP address.\n", NULL, MM_NOTHING);
return;
}
COM_BufAddText(va("connect \"%s\"\n", setupm_ip));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment