Fix some "> MAX_*" to be ">= MAX_*".

This commit is contained in:
Zack Middleton 2012-11-18 19:09:54 +00:00
parent d635193e19
commit 82f83cd092
5 changed files with 8 additions and 8 deletions

View File

@ -522,7 +522,7 @@ void BotSetBrushModelTypes(void)
if (model[0]) modelnum = atoi(model+1);
else modelnum = 0;
if (modelnum < 0 || modelnum > MAX_MODELS)
if (modelnum < 0 || modelnum >= MAX_MODELS)
{
botimport.Print(PRT_MESSAGE, "entity %s model number out of range\n", classname);
continue;

View File

@ -529,7 +529,7 @@ static void S_Base_StartSoundEx( vec3_t origin, int entityNum, int entchannel, s
return;
}
if ( !origin && ( entityNum < 0 || entityNum > MAX_GENTITIES ) ) {
if ( !origin && ( entityNum < 0 || entityNum >= MAX_GENTITIES ) ) {
Com_Error( ERR_DROP, "S_StartSound: bad entitynum %i", entityNum );
}
@ -1092,7 +1092,7 @@ let the sound system know where an entity currently is
======================
*/
void S_Base_UpdateEntityPosition( int entityNum, const vec3_t origin ) {
if ( entityNum < 0 || entityNum > MAX_GENTITIES ) {
if ( entityNum < 0 || entityNum >= MAX_GENTITIES ) {
Com_Error( ERR_DROP, "S_UpdateEntityPosition: bad entitynum %i", entityNum );
}
VectorCopy( origin, loopSounds[entityNum].origin );

View File

@ -1121,7 +1121,7 @@ void S_AL_UpdateEntityPosition( int entityNum, const vec3_t origin )
VectorCopy( origin, sanOrigin );
S_AL_SanitiseVector( sanOrigin );
if ( entityNum < 0 || entityNum > MAX_GENTITIES )
if ( entityNum < 0 || entityNum >= MAX_GENTITIES )
Com_Error( ERR_DROP, "S_UpdateEntityPosition: bad entitynum %i", entityNum );
VectorCopy( sanOrigin, entityList[entityNum].origin );
}
@ -1135,7 +1135,7 @@ Necessary for i.g. Western Quake3 mod which is buggy.
*/
static qboolean S_AL_CheckInput(int entityNum, sfxHandle_t sfx)
{
if (entityNum < 0 || entityNum > MAX_GENTITIES)
if (entityNum < 0 || entityNum >= MAX_GENTITIES)
Com_Error(ERR_DROP, "ERROR: S_AL_CheckInput: bad entitynum %i", entityNum);
if (sfx < 0 || sfx >= numSfx)

View File

@ -4838,7 +4838,7 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) {
}
case EV_GLOBAL_SOUND:
{
if (state->eventParm < 0 || state->eventParm > MAX_SOUNDS) {
if (state->eventParm < 0 || state->eventParm >= MAX_SOUNDS) {
BotAI_Print(PRT_ERROR, "EV_GLOBAL_SOUND: eventParm (%d) out of range\n", state->eventParm);
break;
}
@ -4948,7 +4948,7 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) {
{
//if this sound is played on the bot
if (state->number == bs->client) {
if (state->eventParm < 0 || state->eventParm > MAX_SOUNDS) {
if (state->eventParm < 0 || state->eventParm >= MAX_SOUNDS) {
BotAI_Print(PRT_ERROR, "EV_GENERAL_SOUND: eventParm (%d) out of range\n", state->eventParm);
break;
}

View File

@ -395,7 +395,7 @@ static fileHandle_t FS_HandleForFile(void) {
}
static FILE *FS_FileForHandle( fileHandle_t f ) {
if ( f < 1 || f > MAX_FILE_HANDLES ) {
if ( f < 1 || f >= MAX_FILE_HANDLES ) {
Com_Error( ERR_DROP, "FS_FileForHandle: out of range" );
}
if (fsh[f].zipFile == qtrue) {