Skip to content

Commit

Permalink
[Shared] misc loop overrun fixes (#1201)
Browse files Browse the repository at this point in the history
* misc loop overrun fixes

* revert RT_BEAM changes

the extra iteration is intentional to seal the tri strip

* revert inadvertent whitespace changes
  • Loading branch information
Razish authored Feb 19, 2024
1 parent 7412f62 commit 6a8a880
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion code/game/wp_saberLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static void Saber_ParseSaberType( saberInfo_t *saber, const char **p ) {
if ( COM_ParseString( p, &value ) )
return;
saberType = GetIDForString( SaberTable, value );
if ( saberType >= SABER_SINGLE && saberType <= NUM_SABERS )
if ( saberType >= SABER_SINGLE && saberType < NUM_SABERS )
saber->type = (saberType_t)saberType;
}
static void Saber_ParseSaberModel( saberInfo_t *saber, const char **p ) {
Expand Down
2 changes: 1 addition & 1 deletion codemp/cgame/cg_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -3978,7 +3978,7 @@ static float CG_DrawTeamOverlay( float y, qboolean right, qboolean upper ) {
} else {
xx = x + w - TINYCHAR_WIDTH;
}
for (j = 0; j <= PW_NUM_POWERUPS; j++) {
for (j = 0; j < PW_NUM_POWERUPS; j++) {
if (ci->powerups & (1 << j)) {

item = BG_FindItemForPowerup( j );
Expand Down
2 changes: 1 addition & 1 deletion codemp/cgame/cg_newDraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ void CG_DrawNewTeamInfo(rectDef_t *rect, float text_x, float text_y, float scale
if ( ci->infoValid && ci->team == cg.snap->ps.persistant[PERS_TEAM]) {

xx = rect->x + 1;
for (j = 0; j <= PW_NUM_POWERUPS; j++) {
for (j = 0; j < PW_NUM_POWERUPS; j++) {
if (ci->powerups & (1 << j)) {

item = BG_FindItemForPowerup( j );
Expand Down
2 changes: 1 addition & 1 deletion codemp/game/NPC_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -2554,7 +2554,7 @@ qboolean NPC_ParseParms( const char *NPCName, gentity_t *NPC )
}
//FIXME: need to precache the weapon, too? (in above func)
weap = GetIDForString( WPTable, value );
if ( weap >= WP_NONE && weap <= WP_NUM_WEAPONS )///*WP_BLASTER_PISTOL*/WP_SABER ) //?!
if ( weap >= WP_NONE && weap < WP_NUM_WEAPONS )///*WP_BLASTER_PISTOL*/WP_SABER ) //?!
{
NPC->client->ps.weapon = weap;
NPC->client->ps.stats[STAT_WEAPONS] |= ( 1 << NPC->client->ps.weapon );
Expand Down
2 changes: 1 addition & 1 deletion codemp/game/bg_saberLoad.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ static void Saber_ParseSaberType( saberInfo_t *saber, const char **p ) {
if ( COM_ParseString( p, &value ) )
return;
saberType = GetIDForString( saberTable, value );
if ( saberType >= SABER_SINGLE && saberType <= NUM_SABERS )
if ( saberType >= SABER_SINGLE && saberType < NUM_SABERS )
saber->type = (saberType_t)saberType;
}
static void Saber_ParseSaberModel( saberInfo_t *saber, const char **p ) {
Expand Down

0 comments on commit 6a8a880

Please sign in to comment.