summaryrefslogtreecommitdiff
path: root/src/game/g_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/g_utils.c')
-rw-r--r--src/game/g_utils.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/game/g_utils.c b/src/game/g_utils.c
index a3b2cb42..f125f085 100644
--- a/src/game/g_utils.c
+++ b/src/game/g_utils.c
@@ -639,6 +639,19 @@ void G_AddEvent( gentity_t *ent, int event, int eventParm )
return;
}
+ // eventParm is converted to int8_t in msg.c, so prevent rollover since
+ // this would never be the intent of game code
+ if( eventParm > 255 )
+ {
+ eventParm = 255;
+ G_Printf( S_COLOR_YELLOW "WARNING: G_AddEvent: eventParm overflow\n" );
+ }
+ else if( eventParm < -255 )
+ {
+ eventParm = -255;
+ G_Printf( S_COLOR_YELLOW "WARNING: G_AddEvent: eventParm underrun\n" );
+ }
+
// clients need to add the event in playerState_t instead of entityState_t
if( ent->client )
{