2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-04 02:55:50 +03:00

Fix a typo in the checking of bounds of the index for pointer of model.

This commit is contained in:
s1lentq 2016-12-13 04:51:49 +07:00
parent 4fc947807f
commit 076219bcd1
2 changed files with 24 additions and 29 deletions

View File

@ -1898,7 +1898,7 @@ NOXREF void Mod_ChangeGame(void)
model_t *Mod_Handle(int modelindex) model_t *Mod_Handle(int modelindex)
{ {
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
if (modelindex <= 0 || modelindex >= MAX_MODELS) { if (modelindex < 0 || modelindex > MAX_MODELS - 1) {
Sys_Error(__FUNCTION__ ": bad modelindex #%i\n", modelindex); Sys_Error(__FUNCTION__ ": bad modelindex #%i\n", modelindex);
} }
#endif #endif

View File

@ -831,11 +831,8 @@ void EXT_FUNC PF_stuffcmd_I(edict_t *pEdict, char *szFmt, ...)
szOut[1023] = 0; szOut[1023] = 0;
if (entnum < 1 || entnum > g_psvs.maxclients) if (entnum < 1 || entnum > g_psvs.maxclients)
{ {
Con_Printf( Con_Printf("\n!!!\n\nStuffCmd: Some entity tried to stuff '%s' to console "
"\n!!!\n\nStuffCmd: Some entity tried to stuff '%s' to console buffer of entity %i when maxclients was set to %i, ignoring\n\n", "buffer of entity %i when maxclients was set to %i, ignoring\n\n", szOut, entnum, g_psvs.maxclients);
szOut,
entnum,
g_psvs.maxclients);
} }
else else
{ {
@ -1052,8 +1049,8 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
return i; return i;
} }
Host_Error( Host_Error(__FUNCTION__ ": Sound '%s' failed to precache because the item count is over the %d limit.\n"
__FUNCTION__ ": Sound '%s' failed to precache because the item count is over the %d limit.\nReduce the number of brush models and/or regular models in the map to correct this.", "Reduce the number of brush models and/or regular models in the map to correct this.",
s, MAX_SOUNDS); s, MAX_SOUNDS);
} }
else else
@ -1438,8 +1435,8 @@ int EXT_FUNC PF_precache_model_I(const char *s)
return i; return i;
#endif #endif
} }
Host_Error( Host_Error(__FUNCTION__ ": Model '%s' failed to precache because the item count is over the %d limit.\n"
__FUNCTION__ ": Model '%s' failed to precache because the item count is over the %d limit.\nReduce the number of brush models and/or regular models in the map to correct this.", "Reduce the number of brush models and/or regular models in the map to correct this.",
s, MAX_MODELS); s, MAX_MODELS);
} }
else else
@ -1497,9 +1494,8 @@ int EXT_FUNC PF_precache_generic_I(char *s)
if (resCount >= ARRAYSIZE(g_rehlds_sv.precachedGenericResourceNames)) if (resCount >= ARRAYSIZE(g_rehlds_sv.precachedGenericResourceNames))
{ {
Host_Error( Host_Error(__FUNCTION__ ": Generic item '%s' failed to precache because the item count is over the %d limit.\n"
__FUNCTION__ ": Generic item '%s' failed to precache because the item count is over the %d limit.\n\ "Reduce the number of brush models and/or regular models in the map to correct this.",
Reduce the number of brush models and/or regular models in the map to correct this.",
resName, ARRAYSIZE(g_rehlds_sv.precachedGenericResourceNames)); resName, ARRAYSIZE(g_rehlds_sv.precachedGenericResourceNames));
} }
@ -1532,10 +1528,9 @@ int EXT_FUNC PF_precache_generic_I(char *s)
if (!Q_stricmp(g_psv.generic_precache[i], s)) if (!Q_stricmp(g_psv.generic_precache[i], s))
return i; return i;
} }
Host_Error( Host_Error(__FUNCTION__ ": Generic item '%s' failed to precache because the item count is over the %d limit.\n"
__FUNCTION__ ": Generic item '%s' failed to precache because the item count is over the %d limit.\nReduce the number of brush models and/or regular models in the map to correct this.", "Reduce the number of brush models and/or regular models in the map to correct this.",
s, MAX_GENERIC s, MAX_GENERIC);
);
} }
else else
{ {
@ -2243,56 +2238,56 @@ void EXT_FUNC PF_MessageEnd_I(void)
void EXT_FUNC PF_WriteByte_I(int iValue) void EXT_FUNC PF_WriteByte_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error("WRITE_BYTE called with no active message\n"); Sys_Error(__FUNCTION__ " called with no active message\n");
MSG_WriteByte(&gMsgBuffer, iValue); MSG_WriteByte(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteChar_I(int iValue) void EXT_FUNC PF_WriteChar_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error("WRITE_CHAR called with no active message\n"); Sys_Error(__FUNCTION__ " called with no active message\n");
MSG_WriteChar(&gMsgBuffer, iValue); MSG_WriteChar(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteShort_I(int iValue) void EXT_FUNC PF_WriteShort_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error("WRITE_SHORT called with no active message\n"); Sys_Error(__FUNCTION__ " called with no active message\n");
MSG_WriteShort(&gMsgBuffer, iValue); MSG_WriteShort(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteLong_I(int iValue) void EXT_FUNC PF_WriteLong_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error("PF_WriteLong_I called with no active message\n"); Sys_Error(__FUNCTION__ " called with no active message\n");
MSG_WriteLong(&gMsgBuffer, iValue); MSG_WriteLong(&gMsgBuffer, iValue);
} }
void EXT_FUNC PF_WriteAngle_I(float flValue) void EXT_FUNC PF_WriteAngle_I(float flValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error("PF_WriteAngle_I called with no active message\n"); Sys_Error(__FUNCTION__ " called with no active message\n");
MSG_WriteAngle(&gMsgBuffer, flValue); MSG_WriteAngle(&gMsgBuffer, flValue);
} }
void EXT_FUNC PF_WriteCoord_I(float flValue) void EXT_FUNC PF_WriteCoord_I(float flValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error("PF_WriteCoord_I called with no active message\n"); Sys_Error(__FUNCTION__ " called with no active message\n");
MSG_WriteShort(&gMsgBuffer, (int)(flValue * 8.0)); MSG_WriteShort(&gMsgBuffer, (int)(flValue * 8.0));
} }
void EXT_FUNC PF_WriteString_I(const char *sz) void EXT_FUNC PF_WriteString_I(const char *sz)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error("PF_WriteString_I called with no active message\n"); Sys_Error(__FUNCTION__ " called with no active message\n");
MSG_WriteString(&gMsgBuffer, sz); MSG_WriteString(&gMsgBuffer, sz);
} }
void EXT_FUNC PF_WriteEntity_I(int iValue) void EXT_FUNC PF_WriteEntity_I(int iValue)
{ {
if (!gMsgStarted) if (!gMsgStarted)
Sys_Error("PF_WriteEntity_I called with no active message\n"); Sys_Error(__FUNCTION__ " called with no active message\n");
MSG_WriteShort(&gMsgBuffer, iValue); MSG_WriteShort(&gMsgBuffer, iValue);
} }
@ -2657,10 +2652,10 @@ void EXT_FUNC PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, cons
int i; int i;
if (!filename) if (!filename)
Host_Error("PF_ForceUnmodified: NULL pointer"); Host_Error(__FUNCTION__ ": NULL pointer");
if (PR_IsEmptyString(filename)) if (PR_IsEmptyString(filename))
Host_Error("PF_ForceUnmodified: Bad string '%s'", filename); Host_Error(__FUNCTION__ ": Bad string '%s'", filename);
if (g_psv.state == ss_loading) if (g_psv.state == ss_loading)
{ {
@ -2675,7 +2670,7 @@ void EXT_FUNC PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, cons
++i; ++i;
if (i >= 512) if (i >= 512)
Host_Error("ForceUnmodified: '%s' overflow", filename); Host_Error(__FUNCTION__ ": '%s' overflow", filename);
} }
cnode->check_type = type; cnode->check_type = type;
@ -2702,7 +2697,7 @@ void EXT_FUNC PF_ForceUnmodified(FORCE_TYPE type, float *mins, float *maxs, cons
++cnode; ++cnode;
++i; ++i;
if (i >= 512) if (i >= 512)
Host_Error("ForceUnmodified: '%s' Precache can only be done in spawn functions", filename); Host_Error(__FUNCTION__ ": '%s' Precache can only be done in spawn functions", filename);
} }
} }
} }