diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 10 | ||||
-rw-r--r-- | src/game/g_admin.c | 2 | ||||
-rw-r--r-- | src/game/g_admin.h | 8 | ||||
-rw-r--r-- | src/game/g_buildable.c | 16 | ||||
-rw-r--r-- | src/game/g_cmds.c | 4 | ||||
-rw-r--r-- | src/game/g_combat.c | 2 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_main.c | 2 | ||||
-rw-r--r-- | src/game/g_spawn.c | 17 | ||||
-rw-r--r-- | src/game/g_svcmds.c | 6 | ||||
-rw-r--r-- | src/game/g_syscalls.c | 2 |
11 files changed, 22 insertions, 48 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 83b35ebb..c6412327 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -563,7 +563,7 @@ static const buildableAttributes_t bg_buildableList[ ] = } }; -int bg_numBuildables = sizeof( bg_buildableList ) / sizeof( bg_buildableList[ 0 ] ); +size_t bg_numBuildables = ARRAY_LEN( bg_buildableList ); static const buildableAttributes_t nullBuildable = { 0 }; @@ -1210,7 +1210,7 @@ static const classAttributes_t bg_classList[ ] = } }; -int bg_numClasses = sizeof( bg_classList ) / sizeof( bg_classList[ 0 ] ); +size_t bg_numClasses = ARRAY_LEN( bg_classList ); static const classAttributes_t nullClass = { 0 }; @@ -2365,7 +2365,7 @@ static const weaponAttributes_t bg_weapons[ ] = } }; -int bg_numWeapons = sizeof( bg_weapons ) / sizeof( bg_weapons[ 0 ] ); +size_t bg_numWeapons = ARRAY_LEN( bg_weapons ); static const weaponAttributes_t nullWeapon = { 0 }; @@ -2531,7 +2531,7 @@ static const upgradeAttributes_t bg_upgrades[ ] = } }; -int bg_numUpgrades = sizeof( bg_upgrades ) / sizeof( bg_upgrades[ 0 ] ); +size_t bg_numUpgrades = ARRAY_LEN( bg_upgrades ); static const upgradeAttributes_t nullUpgrade = { 0 }; @@ -2803,7 +2803,7 @@ BG_EventName */ const char *BG_EventName( int num ) { - if( num < 0 || num >= sizeof( eventnames ) / sizeof( char * ) ) + if( num < 0 || num >= ARRAY_LEN( eventnames ) ) return "UNKNOWN"; return eventnames[ num ]; diff --git a/src/game/g_admin.c b/src/game/g_admin.c index eef4f1ad..085b394c 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -209,7 +209,7 @@ g_admin_cmd_t g_admin_cmds[ ] = } }; -static size_t adminNumCmds = sizeof( g_admin_cmds ) / sizeof( g_admin_cmds[ 0 ] ); +static size_t adminNumCmds = ARRAY_LEN( g_admin_cmds ); static int admin_level_maxname = 0; g_admin_level_t *g_admin_levels = NULL; diff --git a/src/game/g_admin.h b/src/game/g_admin.h index fe057939..c684ae1e 100644 --- a/src/game/g_admin.h +++ b/src/game/g_admin.h @@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * CANIPBAN - allows banning not-necessarily-connected players with CIDR notation * ACTIVITY - inactivity rules do not apply to them * IMMUTABLE - admin commands cannot be used on them - * INCOGNITO - does not show up as an admin in !listplayers + * INCOGNITO - does not show up as an admin in /listplayers * ALLFLAGS - all flags (including command flags) apply to this player * ADMINCHAT - receieves and can send /a admin messages */ @@ -70,16 +70,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_ADMIN_LISTITEMS 20 #define MAX_ADMIN_SHOWBANS 10 -// important note: QVM does not seem to allow a single char to be a -// member of a struct at init time. flag has been converted to char* typedef struct { char *keyword; qboolean ( * handler ) ( gentity_t *ent ); qboolean silent; char *flag; - char *function; // used for !help - char *syntax; // used for !help + char *function; // used in /adminhelp + char *syntax; // used in /adminhelp } g_admin_cmd_t; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 0f7ec7e6..f1bb1c12 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -172,17 +172,13 @@ qboolean G_FindPower( gentity_t *self, qboolean searchUnspawned ) // Scan the buildables in the reactor zone for( j = MAX_CLIENTS, ent2 = g_entities + j; j < level.num_entities; j++, ent2++ ) { - gentity_t *powerEntity; - if( ent2->s.eType != ET_BUILDABLE ) continue; if( ent2 == self ) continue; - powerEntity = ent2->parentNode; - - if( powerEntity && powerEntity->s.modelindex == BA_H_REACTOR && ( powerEntity == ent ) ) + if( ent2->parentNode == ent ) { buildPoints -= BG_Buildable( ent2->s.modelindex )->buildPoints; } @@ -224,20 +220,14 @@ qboolean G_FindPower( gentity_t *self, qboolean searchUnspawned ) // Scan the buildables in the repeater zone for( j = MAX_CLIENTS, ent2 = g_entities + j; j < level.num_entities; j++, ent2++ ) { - gentity_t *powerEntity; - if( ent2->s.eType != ET_BUILDABLE ) continue; if( ent2 == self ) continue; - powerEntity = ent2->parentNode; - - if( powerEntity && powerEntity->s.modelindex == BA_H_REPEATER && ( powerEntity == ent ) ) - { + if( ent2->parentNode == ent ) buildPoints -= BG_Buildable( ent2->s.modelindex )->buildPoints; - } } if( ent->usesBuildPointZone && level.buildPointZones[ ent->buildPointZone ].active ) @@ -2956,7 +2946,7 @@ static int G_CompareBuildablesForRemoval( const void *a, const void *b ) } // Resort to preference list - for( i = 0; i < sizeof( precedence ) / sizeof( precedence[ 0 ] ); i++ ) + for( i = 0; i < ARRAY_LEN( precedence ); i++ ) { if( buildableA->s.modelindex == precedence[ i ] ) aPrecedence = i; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 7b2b9948..664df9fa 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -279,7 +279,7 @@ void ScoreboardMessage( gentity_t *ent ) j = strlen( entry ); - if( stringlength + j >= 1024 ) + if( stringlength + j >= sizeof( string ) ) break; strcpy( string + stringlength, entry ); @@ -3138,7 +3138,7 @@ commands_t cmds[ ] = { { "vsay_team", CMD_MESSAGE|CMD_INTERMISSION, Cmd_VSay_f }, { "where", 0, Cmd_Where_f } }; -static size_t numCmds = sizeof( cmds ) / sizeof( cmds[ 0 ] ); +static size_t numCmds = ARRAY_LEN( cmds ); /* ================= diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 46657322..fcdc2ee2 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -263,7 +263,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int killerName = "<world>"; } - if( meansOfDeath < 0 || meansOfDeath >= sizeof( modNames ) / sizeof( modNames[0] ) ) + if( meansOfDeath < 0 || meansOfDeath >= ARRAY_LEN( modNames ) ) // fall back on the number obit = va( "%d", meansOfDeath ); else diff --git a/src/game/g_local.h b/src/game/g_local.h index 727c280b..81700620 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -924,7 +924,6 @@ void G_Checktrigger_stages( team_t team, stage_t stage ); // g_misc.c // void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles ); -void ShineTorch( gentity_t *self ); // // g_weapon.c diff --git a/src/game/g_main.c b/src/game/g_main.c index fda51ebd..2380a334 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -274,7 +274,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_tag, "g_tag", "main", CVAR_INIT, 0, qfalse } }; -static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] ); +static size_t gameCvarTableSize = ARRAY_LEN( gameCvarTable ); void G_InitGame( int levelTime, int randomSeed, int restart ); diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 1ebc04d0..5cbc643f 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -110,7 +110,7 @@ typedef enum typedef struct { char *name; - int ofs; + size_t ofs; fieldtype_t type; int flags; } field_t; @@ -159,11 +159,6 @@ void SP_info_player_intermission( gentity_t *ent ); void SP_info_alien_intermission( gentity_t *ent ); void SP_info_human_intermission( gentity_t *ent ); -void SP_info_firstplace( gentity_t *ent ); -void SP_info_secondplace( gentity_t *ent ); -void SP_info_thirdplace( gentity_t *ent ); -void SP_info_podium( gentity_t *ent ); - void SP_func_plat( gentity_t *ent ); void SP_func_static( gentity_t *ent ); void SP_func_rotating( gentity_t *ent ); @@ -193,7 +188,6 @@ void SP_trigger_ammo( gentity_t *ent ); void SP_target_delay( gentity_t *ent ); void SP_target_speaker( gentity_t *ent ); void SP_target_print( gentity_t *ent ); -void SP_target_character( gentity_t *ent ); void SP_target_score( gentity_t *ent ); void SP_target_teleporter( gentity_t *ent ); void SP_target_relay( gentity_t *ent ); @@ -209,7 +203,6 @@ void SP_target_hurt( gentity_t *ent ); void SP_light( gentity_t *self ); void SP_info_null( gentity_t *self ); void SP_info_notnull( gentity_t *self ); -void SP_info_camp( gentity_t *self ); void SP_path_corner( gentity_t *self ); void SP_misc_teleporter_dest( gentity_t *self ); @@ -217,10 +210,6 @@ void SP_misc_model( gentity_t *ent ); void SP_misc_portal_camera( gentity_t *ent ); void SP_misc_portal_surface( gentity_t *ent ); -void SP_shooter_rocket( gentity_t *ent ); -void SP_shooter_plasma( gentity_t *ent ); -void SP_shooter_grenade( gentity_t *ent ); - void SP_misc_particle_system( gentity_t *ent ); void SP_misc_anim_model( gentity_t *ent ); void SP_misc_light_flare( gentity_t *ent ); @@ -334,7 +323,7 @@ qboolean G_CallSpawn( gentity_t *ent ) } // check normal spawn functions - s = bsearch( ent->classname, spawns, sizeof( spawns ) / sizeof( spawn_t ), + s = bsearch( ent->classname, spawns, ARRAY_LEN( spawns ), sizeof( spawn_t ), cmdcmp ); if( s ) { @@ -403,7 +392,7 @@ void G_ParseField( const char *key, const char *value, gentity_t *ent ) vec3_t vec; vec4_t vec4; - f = bsearch( key, fields, sizeof( fields ) / sizeof( field_t ), + f = bsearch( key, fields, ARRAY_LEN( fields ), sizeof( field_t ), cmdcmp ); if( !f ) return; diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c index 9211033b..db14a917 100644 --- a/src/game/g_svcmds.c +++ b/src/game/g_svcmds.c @@ -588,7 +588,7 @@ qboolean ConsoleCommand( void ) trap_Argv( 0, cmd, sizeof( cmd ) ); - command = bsearch( cmd, svcmds, sizeof( svcmds ) / sizeof( struct svcmd ), + command = bsearch( cmd, svcmds, ARRAY_LEN( svcmds ), sizeof( struct svcmd ), cmdcmp ); if( !command ) @@ -614,7 +614,7 @@ void G_RegisterCommands( void ) { int i; - for( i = 0; i < sizeof( svcmds ) / sizeof( svcmds[ 0 ] ); i++ ) + for( i = 0; i < ARRAY_LEN( svcmds ); i++ ) { if( svcmds[ i ].dedicated && !g_dedicated.integer ) continue; @@ -628,7 +628,7 @@ void G_UnregisterCommands( void ) { int i; - for( i = 0; i < sizeof( svcmds ) / sizeof( svcmds[ 0 ] ); i++ ) + for( i = 0; i < ARRAY_LEN( svcmds ); i++ ) { if( svcmds[ i ].dedicated && !g_dedicated.integer ) continue; diff --git a/src/game/g_syscalls.c b/src/game/g_syscalls.c index 38e52039..0566ef86 100644 --- a/src/game/g_syscalls.c +++ b/src/game/g_syscalls.c @@ -253,13 +253,11 @@ int trap_RealTime( qtime_t *qtime ) void trap_SnapVector( float *v ) { syscall( G_SNAPVECTOR, v ); - return; } void trap_SendGameStat( const char *data ) { syscall( G_SEND_GAMESTAT, data ); - return; } int trap_Parse_AddGlobalDefine( char *define ) |