mirror of
https://github.com/rehlds/ReHLDS.git
synced 2025-09-05 21:23:20 +03:00
Minor cleanup
This commit is contained in:
parent
82a3d1d084
commit
a761efa75d
4 changed files with 17 additions and 4 deletions
rehlds
|
@ -29,6 +29,9 @@
|
|||
|
||||
typedef int BOOL;
|
||||
|
||||
// The maximum user messages
|
||||
#define MAX_USERMESSAGES 256
|
||||
|
||||
// user message
|
||||
#define MAX_USER_MSG_DATA 192
|
||||
|
||||
|
|
|
@ -2124,7 +2124,7 @@ void EXT_FUNC PF_MessageBegin_I(int msg_dest, int msg_type, const float *pOrigin
|
|||
if (msg_type == 0)
|
||||
Sys_Error("%s: Tried to create a message with a bogus message type ( 0 )", __func__);
|
||||
|
||||
gMsgStarted = 1;
|
||||
gMsgStarted = TRUE;
|
||||
gMsgType = msg_type;
|
||||
gMsgEntity = ed;
|
||||
gMsgDest = msg_dest;
|
||||
|
@ -2151,7 +2151,7 @@ void EXT_FUNC PF_MessageEnd_I(void)
|
|||
qboolean MsgIsVarLength = 0;
|
||||
if (!gMsgStarted)
|
||||
Sys_Error("%s: called with no active message\n", __func__);
|
||||
gMsgStarted = 0;
|
||||
gMsgStarted = FALSE;
|
||||
|
||||
if (gMsgEntity && (gMsgEntity->v.flags & FL_FAKECLIENT))
|
||||
return;
|
||||
|
@ -2275,6 +2275,7 @@ void EXT_FUNC PF_WriteByte_I(int iValue)
|
|||
{
|
||||
if (!gMsgStarted)
|
||||
Sys_Error("%s: called with no active message\n", __func__);
|
||||
|
||||
MSG_WriteByte(&gMsgBuffer, iValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -6568,7 +6568,13 @@ void SV_ClearEntities(void)
|
|||
}
|
||||
int EXT_FUNC RegUserMsg(const char *pszName, int iSize)
|
||||
{
|
||||
if (giNextUserMsg > 255 || !pszName || Q_strlen(pszName) > 11 || iSize > 192)
|
||||
if (giNextUserMsg >= MAX_USERMESSAGES)
|
||||
return 0;
|
||||
|
||||
if (iSize > MAX_USER_MSG_DATA)
|
||||
return 0;
|
||||
|
||||
if (!pszName || Q_strlen(pszName) >= MAX_USERMESSAGES_LENGTH - 1)
|
||||
return 0;
|
||||
|
||||
UserMsg *pUserMsgs = sv_gpUserMsgs;
|
||||
|
|
|
@ -31,11 +31,14 @@
|
|||
#include "maintypes.h"
|
||||
#include "quakedef.h"
|
||||
|
||||
// The maximum length of a usermessage name in a network transmission
|
||||
#define MAX_USERMESSAGES_LENGTH 16
|
||||
|
||||
typedef struct _UserMsg
|
||||
{
|
||||
int iMsg;
|
||||
int iSize;
|
||||
char szName[16];
|
||||
char szName[MAX_USERMESSAGES_LENGTH];
|
||||
struct _UserMsg *next;
|
||||
pfnUserMsgHook pfn;
|
||||
} UserMsg;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue