Skip to content
Permalink
Browse files

[Shared] Explicitly sized some arrays to prevent future breakage

Fixed bad memset on cg_healthBarEnts
  • Loading branch information...
Razish committed Dec 28, 2017
1 parent e911615 commit 4cb9711a0f716d7807134474a4616feed73a58aa
@@ -2524,7 +2524,7 @@ void CG_ClearHealthBarEnts( void )
if ( cg_numHealthBarEnts )
{
cg_numHealthBarEnts = 0;
memset( &cg_healthBarEnts, 0, MAX_HEALTH_BAR_ENTS );
memset( &cg_healthBarEnts, 0, sizeof(cg_healthBarEnts) );
}
}
/*
@@ -451,7 +451,7 @@ typedef enum {
EV_DEBUG_LINE,
EV_KOTHOS_BEAM,


EV_NUM_ENTITY_EVENTS
} entity_event_t;

class animation_t
@@ -438,7 +438,7 @@ typedef enum {

EV_DEBUG_LINE,


EV_NUM_ENTITY_EVENTS
} entity_event_t;

class animation_t
@@ -658,7 +658,7 @@ void ScaleModelAxis(refEntity_t *ent)
Ghoul2 Insert End
*/

char *forceHolocronModels[] = {
char *forceHolocronModels[NUM_FORCE_POWERS] = {
"models/map_objects/mp/lt_heal.md3", //FP_HEAL,
"models/map_objects/mp/force_jump.md3", //FP_LEVITATION,
"models/map_objects/mp/force_speed.md3", //FP_SPEED,
@@ -298,7 +298,7 @@ void CG_ParseEntityFromSpawnVars( void ) {
int i;
char *classname;
char *p, *value, *gametypeName;
static char *gametypeNames [] = { "ffa", "holocron", "jedimaster", "duel", "powerduel", "single", "team", "siege", "ctf", "cty" };
static char *gametypeNames[GT_MAX_GAME_TYPE] = { "ffa", "holocron", "jedimaster", "duel", "powerduel", "single", "team", "siege", "ctf", "cty" };

// check for "notsingle" flag
if( cgs.gametype == GT_SINGLE_PLAYER ) {
@@ -40,12 +40,12 @@ void CG_RegisterWeapon( int weaponNum) {
vec3_t mins, maxs;
int i;

weaponInfo = &cg_weapons[weaponNum];

if ( weaponNum == 0 ) {
if ( weaponNum <= WP_NONE || weaponNum >= WP_NUM_WEAPONS ) {
return;
}

weaponInfo = &cg_weapons[weaponNum];

if ( weaponInfo->registered ) {
return;
}
@@ -2316,7 +2316,7 @@ void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t resu
}
}

const char *eventnames[] = {
const char *eventnames[EV_NUM_ENTITY_EVENTS] = {
"EV_NONE",

"EV_CLIENTJOIN",
@@ -1030,6 +1030,7 @@ typedef enum {

EV_SIEGESPEC,

EV_NUM_ENTITY_EVENTS
} entity_event_t; // There is a maximum of 256 events (8 bits transmission, 2 high bits for uniqueness)


@@ -1853,7 +1853,7 @@ void Cmd_Where_f( gentity_t *ent ) {
//trap->SendServerCommand( ent-g_entities, va("print \"%s\n\"", vtos( ent->s.origin ) ) );
}

static const char *gameNames[] = {
static const char *gameNames[GT_MAX_GAME_TYPE] = {
"Free For All",
"Holocron FFA",
"Jedi Master",
@@ -890,7 +890,7 @@ void G_SpawnGEntityFromSpawnVars( qboolean inSubBSP ) {
int i;
gentity_t *ent;
char *s, *value, *gametypeName;
static char *gametypeNames[] = {"ffa", "holocron", "jedimaster", "duel", "powerduel", "single", "team", "siege", "ctf", "cty"};
static char *gametypeNames[GT_MAX_GAME_TYPE] = {"ffa", "holocron", "jedimaster", "duel", "powerduel", "single", "team", "siege", "ctf", "cty"};

// get the next free entity
ent = G_Spawn();
@@ -500,7 +500,7 @@ static const char *skillLevels[] = {
};
static const size_t numSkillLevels = ARRAY_LEN( skillLevels );

static const char *gameTypes[] = {
static const char *gameTypes[GT_MAX_GAME_TYPE] = {
"FFA",
"Holocron",
"JediMaster",

0 comments on commit 4cb9711

Please sign in to comment.
You can’t perform that action at this time.