Refactoring patch by DevHC

This commit is contained in:
Thilo Schulz 2011-03-05 19:20:37 +00:00
parent 21668c0616
commit fef4d12d68
31 changed files with 60 additions and 98 deletions

View file

@ -920,7 +920,7 @@ Only in One Flag CTF games
{NULL}
};
int bg_numItems = sizeof(bg_itemlist) / sizeof(bg_itemlist[0]) - 1;
int bg_numItems = ARRAY_LEN( bg_itemlist ) - 1;
/*

View file

@ -469,7 +469,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) {
if( bg_itemlist[client->ps.stats[STAT_PERSISTANT_POWERUP]].giTag == PW_AMMOREGEN ) {
int w, max, inc, t, i;
int weapList[]={WP_MACHINEGUN,WP_SHOTGUN,WP_GRENADE_LAUNCHER,WP_ROCKET_LAUNCHER,WP_LIGHTNING,WP_RAILGUN,WP_PLASMAGUN,WP_BFG,WP_NAILGUN,WP_PROX_LAUNCHER,WP_CHAINGUN};
int weapCount = sizeof(weapList) / sizeof(int);
int weapCount = ARRAY_LEN( weapList );
//
for (i = 0; i < weapCount; i++) {
w = weapList[i];

View file

@ -1158,7 +1158,7 @@ void Cmd_GameCommand_f( gentity_t *ent ) {
if ( player < 0 || player >= MAX_CLIENTS ) {
return;
}
if ( order < 0 || order > sizeof(gc_orders)/sizeof(char *) ) {
if ( order < 0 || order > ARRAY_LEN( gc_orders ) ) {
return;
}
G_Say( ent, &g_entities[player], SAY_TELL, gc_orders[order] );

View file

@ -486,7 +486,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 ) ) {
obit = "<bad obituary>";
} else {
obit = modNames[meansOfDeath];

View file

@ -181,7 +181,7 @@ static cvarTable_t gameCvarTable[] = {
};
static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[0] );
static int gameCvarTableSize = ARRAY_LEN( gameCvarTable );
void G_InitGame( int levelTime, int randomSeed, int restart );

View file

@ -54,7 +54,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
typedef struct {
entityState_t s; // communicated by server to clients
entityState_t unused; // apparently this field was put here accidentally
// (and is kept only for compatibility, as a struct pad)
qboolean linked; // qfalse if not in any good cluster
int linkcount;
@ -83,8 +84,8 @@ typedef struct {
// when a trace call is made and passEntityNum != ENTITYNUM_NONE,
// an ent will be excluded from testing if:
// ent->s.number == passEntityNum (don't interact with self)
// ent->s.ownerNum = passEntityNum (don't interact with your own missiles)
// entity[ent->s.ownerNum].ownerNum = passEntityNum (don't interact with other missiles from owner)
// ent->r.ownerNum == passEntityNum (don't interact with your own missiles)
// entity[ent->r.ownerNum].r.ownerNum == passEntityNum (don't interact with other missiles from owner)
int ownerNum;
} entityShared_t;