Skip to content

Commit

Permalink
[Shared] misc loop overrun fixes (JACoders#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

(cherry picked from commit 6a8a880)
  • Loading branch information
Razish authored and taysta committed Feb 23, 2024
1 parent 26949d8 commit 0af68dc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion codemp/cgame/cg_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -6045,7 +6045,7 @@ static float CG_DrawTeamOverlay( float y, qboolean right, qboolean upper ) {
} else {
xx = x + w - TINYCHAR_WIDTH*cgs.widthRatioCoef;
}
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 @@ -2556,7 +2556,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 @@ -554,7 +554,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 0af68dc

Please sign in to comment.