summaryrefslogtreecommitdiff
path: root/src/cgame/cg_draw.c
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2011-02-25 17:46:55 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:18:02 +0000
commitf1085879e51d2fb79c06940fb9b218dc61726dc5 (patch)
treed8648d1dfb9977bc400fc6eba4ee1d3dfa758999 /src/cgame/cg_draw.c
parentbb05f256529f7df15e21168fd8fe79f439f22ca9 (diff)
* Make weapon registration error reporting less touchy and more informative
Diffstat (limited to 'src/cgame/cg_draw.c')
-rw-r--r--src/cgame/cg_draw.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 9797e779..f6950cae 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -2469,10 +2469,18 @@ void CG_DrawWeaponIcon( rectDef_t *rect, vec4_t color )
if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 )
return;
- if( weapon == 0 )
+ if( weapon <= WP_NONE || weapon >= WP_NUM_WEAPONS )
+ {
+ CG_Error( "CG_DrawWeaponIcon: weapon out of range: %d\n", weapon );
return;
+ }
- assert( cg_weapons[ weapon ].registered );
+ if( !cg_weapons[ weapon ].registered )
+ {
+ Com_Printf( S_COLOR_YELLOW "WARNING: CG_DrawWeaponIcon: weapon %d (%s) "
+ "is not registered\n", weapon, BG_Weapon( weapon )->name );
+ return;
+ }
if( ps->clips == 0 && !BG_Weapon( weapon )->infiniteAmmo )
{