[quake3-commits] r1910 - in trunk/code: botlib cgame game q3_ui qcommon renderer sdl server ui
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Mar 5 14:20:38 EST 2011
Author: thilo
Date: 2011-03-05 14:20:37 -0500 (Sat, 05 Mar 2011)
New Revision: 1910
Modified:
trunk/code/botlib/be_aas_reach.c
trunk/code/cgame/cg_consolecmds.c
trunk/code/cgame/cg_main.c
trunk/code/cgame/cg_servercmds.c
trunk/code/game/bg_misc.c
trunk/code/game/g_active.c
trunk/code/game/g_cmds.c
trunk/code/game/g_combat.c
trunk/code/game/g_main.c
trunk/code/game/g_public.h
trunk/code/q3_ui/ui_main.c
trunk/code/q3_ui/ui_video.c
trunk/code/qcommon/files.c
trunk/code/qcommon/msg.c
trunk/code/qcommon/q_shared.h
trunk/code/qcommon/vm.c
trunk/code/qcommon/vm_powerpc.c
trunk/code/qcommon/vm_powerpc_asm.c
trunk/code/qcommon/vm_sparc.c
trunk/code/qcommon/vm_x86_64_assembler.c
trunk/code/renderer/tr_init.c
trunk/code/renderer/tr_local.h
trunk/code/renderer/tr_shader.c
trunk/code/sdl/sdl_input.c
trunk/code/sdl/sdl_snd.c
trunk/code/server/sv_ccmds.c
trunk/code/server/sv_client.c
trunk/code/server/sv_game.c
trunk/code/ui/ui_local.h
trunk/code/ui/ui_main.c
trunk/code/ui/ui_shared.c
Log:
Refactoring patch by DevHC
Modified: trunk/code/botlib/be_aas_reach.c
===================================================================
--- trunk/code/botlib/be_aas_reach.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/botlib/be_aas_reach.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -1556,7 +1556,7 @@
if (AAS_PointAreaNum(trace.endpos) == area2num)
{
//if not going through a cluster portal
- numareas = AAS_TraceAreas(start, end, areas, NULL, sizeof(areas) / sizeof(int));
+ numareas = AAS_TraceAreas(start, end, areas, NULL, ARRAY_LEN(areas));
for (i = 0; i < numareas; i++)
if (AAS_AreaClusterPortal(areas[i]))
break;
@@ -2311,7 +2311,7 @@
//because the predicted jump could have rushed through the area
VectorMA(move.endpos, -64, dir, teststart);
teststart[2] += 1;
- numareas = AAS_TraceAreas(move.endpos, teststart, areas, NULL, sizeof(areas) / sizeof(int));
+ numareas = AAS_TraceAreas(move.endpos, teststart, areas, NULL, ARRAY_LEN(areas));
for (j = 0; j < numareas; j++)
{
if (areas[j] == area2num)
@@ -4254,7 +4254,7 @@
break;
} //end if
//if not going through a cluster portal
- numareas = AAS_TraceAreas(mid, testend, areas, NULL, sizeof(areas) / sizeof(int));
+ numareas = AAS_TraceAreas(mid, testend, areas, NULL, ARRAY_LEN(areas));
for (p = 0; p < numareas; p++)
if (AAS_AreaClusterPortal(areas[p]))
break;
Modified: trunk/code/cgame/cg_consolecmds.c
===================================================================
--- trunk/code/cgame/cg_consolecmds.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/cgame/cg_consolecmds.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -518,7 +518,7 @@
cmd = CG_Argv(0);
- for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) {
+ for ( i = 0 ; i < ARRAY_LEN( commands ) ; i++ ) {
if ( !Q_stricmp( cmd, commands[i].cmd ) ) {
commands[i].function();
return qtrue;
@@ -540,7 +540,7 @@
void CG_InitConsoleCommands( void ) {
int i;
- for ( i = 0 ; i < sizeof( commands ) / sizeof( commands[0] ) ; i++ ) {
+ for ( i = 0 ; i < ARRAY_LEN( commands ) ; i++ ) {
trap_AddCommand( commands[i].cmd );
}
Modified: trunk/code/cgame/cg_main.c
===================================================================
--- trunk/code/cgame/cg_main.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/cgame/cg_main.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -316,7 +316,7 @@
// { &cg_pmove_fixed, "cg_pmove_fixed", "0", CVAR_USERINFO | CVAR_ARCHIVE }
};
-static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] );
+static int cvarTableSize = ARRAY_LEN( cvarTable );
/*
=================
Modified: trunk/code/cgame/cg_servercmds.c
===================================================================
--- trunk/code/cgame/cg_servercmds.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/cgame/cg_servercmds.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -44,7 +44,7 @@
{ VOICECHAT_FOLLOWFLAGCARRIER, TEAMTASK_ESCORT }
};
-static const int numValidOrders = sizeof(validOrders) / sizeof(orderTask_t);
+static const int numValidOrders = ARRAY_LEN(validOrders);
#ifdef MISSIONPACK
static int CG_ValidOrder(const char *p) {
Modified: trunk/code/game/bg_misc.c
===================================================================
--- trunk/code/game/bg_misc.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/game/bg_misc.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -920,7 +920,7 @@
{NULL}
};
-int bg_numItems = sizeof(bg_itemlist) / sizeof(bg_itemlist[0]) - 1;
+int bg_numItems = ARRAY_LEN( bg_itemlist ) - 1;
/*
Modified: trunk/code/game/g_active.c
===================================================================
--- trunk/code/game/g_active.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/game/g_active.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -469,7 +469,7 @@
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];
Modified: trunk/code/game/g_cmds.c
===================================================================
--- trunk/code/game/g_cmds.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/game/g_cmds.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -1158,7 +1158,7 @@
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] );
Modified: trunk/code/game/g_combat.c
===================================================================
--- trunk/code/game/g_combat.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/game/g_combat.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -486,7 +486,7 @@
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];
Modified: trunk/code/game/g_main.c
===================================================================
--- trunk/code/game/g_main.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/game/g_main.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -181,7 +181,7 @@
};
-static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[0] );
+static int gameCvarTableSize = ARRAY_LEN( gameCvarTable );
void G_InitGame( int levelTime, int randomSeed, int restart );
Modified: trunk/code/game/g_public.h
===================================================================
--- trunk/code/game/g_public.h 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/game/g_public.h 2011-03-05 19:20:37 UTC (rev 1910)
@@ -54,7 +54,8 @@
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 @@
// 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;
Modified: trunk/code/q3_ui/ui_main.c
===================================================================
--- trunk/code/q3_ui/ui_main.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/q3_ui/ui_main.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -217,7 +217,7 @@
{ &ui_ioq3, "ui_ioq3", "1", CVAR_ROM }
};
-static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]);
+static int cvarTableSize = ARRAY_LEN( cvarTable );
/*
Modified: trunk/code/q3_ui/ui_video.c
===================================================================
--- trunk/code/q3_ui/ui_video.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/q3_ui/ui_video.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -318,7 +318,7 @@
}
};
-#define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) )
+#define NUM_IVO_TEMPLATES ( ARRAY_LEN( s_ivo_templates ) )
static const char *builtinResolutions[ ] =
{
@@ -496,7 +496,7 @@
{
char* s = resbuf;
unsigned int i = 0;
- while( s && i < sizeof(detectedResolutions)/sizeof(detectedResolutions[0])-1)
+ while( s && i < ARRAY_LEN(detectedResolutions)-1 )
{
detectedResolutions[i++] = s;
s = strchr(s, ' ');
@@ -662,7 +662,7 @@
// search for builtin mode that matches the detected mode
int mode;
if ( s_graphicsoptions.mode.curvalue == -1
- || s_graphicsoptions.mode.curvalue >= sizeof(detectedResolutions)/sizeof(detectedResolutions[0]) )
+ || s_graphicsoptions.mode.curvalue >= ARRAY_LEN( detectedResolutions ) )
s_graphicsoptions.mode.curvalue = 0;
mode = GraphicsOptions_FindBuiltinResolution( s_graphicsoptions.mode.curvalue );
Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/qcommon/files.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -3459,7 +3459,7 @@
fs_serverReferencedPaks[i] = atoi( Cmd_Argv( i ) );
}
- for (i = 0 ; i < sizeof(fs_serverReferencedPakNames) / sizeof(*fs_serverReferencedPakNames); i++)
+ for (i = 0 ; i < ARRAY_LEN(fs_serverReferencedPakNames); i++)
{
if(fs_serverReferencedPakNames[i])
Z_Free(fs_serverReferencedPakNames[i]);
Modified: trunk/code/qcommon/msg.c
===================================================================
--- trunk/code/qcommon/msg.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/qcommon/msg.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -895,7 +895,7 @@
float fullFloat;
int *fromF, *toF;
- numFields = sizeof(entityStateFields)/sizeof(entityStateFields[0]);
+ numFields = ARRAY_LEN( entityStateFields );
// all fields should be 32 bits to avoid any compiler packing issues
// the "number" field is not part of the field list
@@ -1040,7 +1040,7 @@
return;
}
- numFields = sizeof(entityStateFields)/sizeof(entityStateFields[0]);
+ numFields = ARRAY_LEN( entityStateFields );
lc = MSG_ReadByte(msg);
if ( lc > numFields || lc < 0 ) {
@@ -1210,7 +1210,7 @@
c = msg->cursize;
- numFields = sizeof( playerStateFields ) / sizeof( playerStateFields[0] );
+ numFields = ARRAY_LEN( playerStateFields );
lc = 0;
for ( i = 0, field = playerStateFields ; i < numFields ; i++, field++ ) {
@@ -1377,7 +1377,7 @@
print = 0;
}
- numFields = sizeof( playerStateFields ) / sizeof( playerStateFields[0] );
+ numFields = ARRAY_LEN( playerStateFields );
lc = MSG_ReadByte(msg);
if ( lc > numFields || lc < 0 ) {
Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/qcommon/q_shared.h 2011-03-05 19:20:37 UTC (rev 1910)
@@ -194,7 +194,7 @@
#define MAX_QINT 0x7fffffff
#define MIN_QINT (-MAX_QINT-1)
-#define ARRAY_LEN(x) (sizeof(x) / sizeof(*x))
+#define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x)))
// angle indexes
Modified: trunk/code/qcommon/vm.c
===================================================================
--- trunk/code/qcommon/vm.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/qcommon/vm.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -346,7 +346,7 @@
args[0] = arg;
va_start(ap, arg);
- for (i = 1; i < sizeof (args) / sizeof (args[i]); i++)
+ for (i = 1; i < ARRAY_LEN (args); i++)
args[i] = va_arg(ap, intptr_t);
va_end(ap);
@@ -756,7 +756,7 @@
int args[10];
va_list ap;
va_start(ap, callnum);
- for (i = 0; i < sizeof (args) / sizeof (args[i]); i++) {
+ for (i = 0; i < ARRAY_LEN(args); i++) {
args[i] = va_arg(ap, int);
}
va_end(ap);
@@ -781,7 +781,7 @@
a.callnum = callnum;
va_start(ap, callnum);
- for (i = 0; i < sizeof (a.args) / sizeof (a.args[0]); i++) {
+ for (i = 0; i < ARRAY_LEN(a.args); i++) {
a.args[i] = va_arg(ap, int);
}
va_end(ap);
Modified: trunk/code/qcommon/vm_powerpc.c
===================================================================
--- trunk/code/qcommon/vm_powerpc.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/qcommon/vm_powerpc.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -690,7 +690,7 @@
r7, r8, r9, r10,
};
static const long int gpr_vstart = 8; /* position of first volatile register */
-static const long int gpr_total = sizeof( gpr_list ) / sizeof( gpr_list[0] );
+static const long int gpr_total = ARRAY_LEN( gpr_list );
static const long int fpr_list[] = {
/* static registers, normally none is used */
@@ -704,7 +704,7 @@
f12, f13,
};
static const long int fpr_vstart = 8;
-static const long int fpr_total = sizeof( fpr_list ) / sizeof( fpr_list[0] );
+static const long int fpr_total = ARRAY_LEN( fpr_list );
/*
* prepare some dummy structures and emit init code
Modified: trunk/code/qcommon/vm_powerpc_asm.c
===================================================================
--- trunk/code/qcommon/vm_powerpc_asm.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/qcommon/vm_powerpc_asm.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -389,8 +389,7 @@
};
-static const unsigned int num_powerpc_operands =
- (sizeof (powerpc_operands) / sizeof (powerpc_operands[0]));
+static const unsigned int num_powerpc_operands = ARRAY_LEN (powerpc_operands);
/* The functions used to insert and extract complicated operands. */
@@ -1004,6 +1003,3 @@
{ "fsub", A(63,20,0), AFRC_MASK, PPCCOM, { FRT, FRA, FRB } },
{ "fneg", XRC(63,40,0), XRA_MASK, COM, { FRT, FRB } },
};
-
-static const int powerpc_num_opcodes =
- sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]);
Modified: trunk/code/qcommon/vm_sparc.c
===================================================================
--- trunk/code/qcommon/vm_sparc.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/qcommon/vm_sparc.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -259,7 +259,7 @@
{ "fbg", BFCC(0,6), { ARG_DISP22 }, },
{ "fble", BFCC(0,13), { ARG_DISP22 }, },
};
-#define SPARC_NUM_OPCODES (sizeof(sparc_opcodes) / sizeof(sparc_opcodes[0]))
+#define SPARC_NUM_OPCODES (ARRAY_LEN(sparc_opcodes))
#define RS1(X) (((X) & 0x1f) << 14)
#define RS2(X) (((X) & 0x1f) << 0)
@@ -320,7 +320,7 @@
#define IN(inst, args...) \
({ const int argv[] = { args }; \
- const int argc = sizeof(argv) / sizeof(argv[0]); \
+ const int argc = ARRAY_LEN(argv); \
sparc_assemble(inst, argc, argv); \
})
Modified: trunk/code/qcommon/vm_x86_64_assembler.c
===================================================================
--- trunk/code/qcommon/vm_x86_64_assembler.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/qcommon/vm_x86_64_assembler.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -243,7 +243,7 @@
unsigned i = hashkey(label, -1U);
int labellen;
- i %= sizeof(labelhash)/sizeof(labelhash[0]);
+ i %= ARRAY_LEN(labelhash);
h = Z_Malloc(sizeof(struct hashentry));
labellen = strlen(label) + 1;
@@ -259,7 +259,7 @@
{
struct hashentry* h;
unsigned i = hashkey(label, -1U);
- i %= sizeof(labelhash)/sizeof(labelhash[0]);
+ i %= ARRAY_LEN(labelhash);
for(h = labelhash[i]; h; h = h->next )
{
if(!strcmp(h->label, label))
@@ -275,7 +275,7 @@
struct hashentry* h;
unsigned i;
unsigned z = 0, min = -1U, max = 0, t = 0;
- for ( i = 0; i < sizeof(labelhash)/sizeof(labelhash[0]); ++i)
+ for ( i = 0; i < ARRAY_LEN(labelhash); ++i)
{
unsigned n = 0;
h = labelhash[i];
@@ -293,7 +293,7 @@
min = MIN(min, n);
max = MAX(max, n);
}
- printf("total %u, hsize %"PRIu64", zero %u, min %u, max %u\n", t, sizeof(labelhash)/sizeof(labelhash[0]), z, min, max);
+ printf("total %u, hsize %"PRIu64", zero %u, min %u, max %u\n", t, ARRAY_LEN(labelhash), z, min, max);
memset(labelhash, 0, sizeof(labelhash));
}
@@ -1015,7 +1015,7 @@
#else
unsigned m, t, b;
int r;
- t = sizeof(ops)/sizeof(ops[0])-1;
+ t = ARRAY_LEN(ops)-1;
b = 0;
while(b <= t)
@@ -1306,7 +1306,7 @@
if(!ops_sorted)
{
ops_sorted = 1;
- qsort(ops, sizeof(ops)/sizeof(ops[0])-1, sizeof(ops[0]), opsort);
+ qsort(ops, ARRAY_LEN(ops)-1, sizeof(ops[0]), opsort);
}
}
Modified: trunk/code/renderer/tr_init.c
===================================================================
--- trunk/code/renderer/tr_init.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/renderer/tr_init.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -286,7 +286,7 @@
{ "Mode 10: 2048x1536", 2048, 1536, 1 },
{ "Mode 11: 856x480 (wide)",856, 480, 1 }
};
-static int s_numVidModes = ( sizeof( r_vidModes ) / sizeof( r_vidModes[0] ) );
+static int s_numVidModes = ARRAY_LEN( r_vidModes );
qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode ) {
vidmode_t *vm;
Modified: trunk/code/renderer/tr_local.h
===================================================================
--- trunk/code/renderer/tr_local.h 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/renderer/tr_local.h 2011-03-05 19:20:37 UTC (rev 1910)
@@ -1062,7 +1062,6 @@
extern cvar_t *r_picmip; // controls picmip values
extern cvar_t *r_finish;
extern cvar_t *r_drawBuffer;
-extern cvar_t *r_glDriver;
extern cvar_t *r_swapInterval;
extern cvar_t *r_textureMode;
extern cvar_t *r_offsetFactor;
@@ -1115,8 +1114,6 @@
extern cvar_t *r_marksOnTriangleMeshes;
-extern cvar_t *r_GLlibCoolDownMsec;
-
//====================================================================
float R_NoiseGet4f( float x, float y, float z, float t );
Modified: trunk/code/renderer/tr_shader.c
===================================================================
--- trunk/code/renderer/tr_shader.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/renderer/tr_shader.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -30,7 +30,6 @@
static shaderStage_t stages[MAX_SHADER_STAGES];
static shader_t shader;
static texModInfo_t texMods[MAX_SHADER_STAGES][TR_MAX_TEXMODS];
-static qboolean deferLoad;
#define FILE_HASH_SIZE 1024
static shader_t* hashTable[FILE_HASH_SIZE];
@@ -1371,7 +1370,7 @@
*/
static void ParseSurfaceParm( char **text ) {
char *token;
- int numInfoParms = sizeof(infoParms) / sizeof(infoParms[0]);
+ int numInfoParms = ARRAY_LEN( infoParms );
int i;
token = COM_ParseExt( text, qfalse );
@@ -3070,8 +3069,6 @@
Com_Memset(hashTable, 0, sizeof(hashTable));
- deferLoad = qfalse;
-
CreateInternalShaders();
ScanAndLoadShaderFiles();
Modified: trunk/code/sdl/sdl_input.c
===================================================================
--- trunk/code/sdl/sdl_input.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/sdl/sdl_input.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -34,8 +34,6 @@
#include "../client/client.h"
#include "../sys/sys_local.h"
-#define ARRAYLEN(x) (sizeof(x)/sizeof(x[0]))
-
#ifdef MACOS_X
// Mouse acceleration needs to be disabled
#define MACOS_X_ACCELERATION_HACK
@@ -648,7 +646,7 @@
*/
static void IN_JoyMove( void )
{
- qboolean joy_pressed[ARRAYLEN(joy_keys)];
+ qboolean joy_pressed[ARRAY_LEN(joy_keys)];
unsigned int axes = 0;
unsigned int hats = 0;
int total = 0;
@@ -691,8 +689,8 @@
total = SDL_JoystickNumButtons(stick);
if (total > 0)
{
- if (total > ARRAYLEN(stick_state.buttons))
- total = ARRAYLEN(stick_state.buttons);
+ if (total > ARRAY_LEN(stick_state.buttons))
+ total = ARRAY_LEN(stick_state.buttons);
for (i = 0; i < total; i++)
{
qboolean pressed = (SDL_JoystickGetButton(stick, i) != 0);
Modified: trunk/code/sdl/sdl_snd.c
===================================================================
--- trunk/code/sdl/sdl_snd.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/sdl/sdl_snd.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -99,8 +99,7 @@
{ AUDIO_S16MSB, "AUDIO_S16MSB" }
};
-static int formatToStringTableSize =
- sizeof( formatToStringTable ) / sizeof( formatToStringTable[ 0 ] );
+static int formatToStringTableSize = ARRAY_LEN( formatToStringTable );
/*
===============
Modified: trunk/code/server/sv_ccmds.c
===================================================================
--- trunk/code/server/sv_ccmds.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/server/sv_ccmds.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -660,7 +660,7 @@
{
if(index == serverBansCount - 1)
serverBansCount--;
- else if(index < sizeof(serverBans) / sizeof(*serverBans) - 1)
+ else if(index < ARRAY_LEN(serverBans) - 1)
{
memmove(serverBans + index, serverBans + index + 1, (serverBansCount - index - 1) * sizeof(*serverBans));
serverBansCount--;
@@ -740,7 +740,7 @@
return;
}
- if(serverBansCount > sizeof(serverBans) / sizeof(*serverBans))
+ if(serverBansCount > ARRAY_LEN(serverBans))
{
Com_Printf ("Error: Maximum number of bans/exceptions exceeded.\n");
return;
Modified: trunk/code/server/sv_client.c
===================================================================
--- trunk/code/server/sv_client.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/server/sv_client.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -1782,7 +1782,7 @@
// Transmit this packet to the client.
// !!! FIXME: I don't like this queueing system.
- if (client->queuedVoipPackets >= (sizeof (client->voipPacket) / sizeof (client->voipPacket[0]))) {
+ if (client->queuedVoipPackets >= ARRAY_LEN(client->voipPacket)) {
Com_Printf("Too many VoIP packets queued for client #%d\n", i);
continue; // no room for another packet right now.
}
Modified: trunk/code/server/sv_game.c
===================================================================
--- trunk/code/server/sv_game.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/server/sv_game.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -219,7 +219,7 @@
/*
==================
-SV_GameAreaEntities
+SV_EntityContact
==================
*/
qboolean SV_EntityContact( vec3_t mins, vec3_t maxs, const sharedEntity_t *gEnt, int capsule ) {
Modified: trunk/code/ui/ui_local.h
===================================================================
--- trunk/code/ui/ui_local.h 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/ui/ui_local.h 2011-03-05 19:20:37 UTC (rev 1910)
@@ -61,7 +61,6 @@
extern vmCvar_t ui_browserMaster;
extern vmCvar_t ui_browserGameType;
-extern vmCvar_t ui_browserSortKey;
extern vmCvar_t ui_browserShowFull;
extern vmCvar_t ui_browserShowEmpty;
Modified: trunk/code/ui/ui_main.c
===================================================================
--- trunk/code/ui/ui_main.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/ui/ui_main.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -51,7 +51,7 @@
"Nightmare"
};
-static const int numSkillLevels = sizeof(skillLevels) / sizeof(const char*);
+static const int numSkillLevels = ARRAY_LEN( skillLevels );
static const char *netSources[] = {
@@ -60,7 +60,7 @@
"Internet",
"Favorites"
};
-static const int numNetSources = sizeof(netSources) / sizeof(const char*);
+static const int numNetSources = ARRAY_LEN( netSources );
static const serverFilter_t serverFilters[] = {
{"All", "" },
@@ -72,6 +72,9 @@
{"OSP", "osp" },
};
+static const int numServerFilters = ARRAY_LEN( serverFilters );
+
+
static const char *teamArenaGameTypes[] = {
"FFA",
"TOURNAMENT",
@@ -84,35 +87,9 @@
"TEAMTOURNAMENT"
};
-static int const numTeamArenaGameTypes = sizeof(teamArenaGameTypes) / sizeof(const char*);
+static int const numTeamArenaGameTypes = ARRAY_LEN( teamArenaGameTypes );
-static const char *teamArenaGameNames[] = {
- "Free For All",
- "Tournament",
- "Single Player",
- "Team Deathmatch",
- "Capture the Flag",
- "One Flag CTF",
- "Overload",
- "Harvester",
- "Team Tournament",
-};
-
-static int const numTeamArenaGameNames = sizeof(teamArenaGameNames) / sizeof(const char*);
-
-
-static const int numServerFilters = sizeof(serverFilters) / sizeof(serverFilter_t);
-
-static const char *sortKeys[] = {
- "Server Name",
- "Map Name",
- "Open Player Spots",
- "Game Type",
- "Ping Time"
-};
-static const int numSortKeys = sizeof(sortKeys) / sizeof(const char*);
-
static char* netnames[] = {
"???",
"UDP",
@@ -1007,7 +984,7 @@
static const char *handicapValues[] = {"None","95","90","85","80","75","70","65","60","55","50","45","40","35","30","25","20","15","10","5",NULL};
#ifndef MISSIONPACK
-static int numHandicaps = sizeof(handicapValues) / sizeof(const char*);
+static int numHandicaps = ARRAY_LEN(handicapValues);
#endif
static void UI_DrawHandicap(rectDef_t *rect, float scale, vec4_t color, int textStyle) {
@@ -5609,7 +5586,6 @@
vmCvar_t ui_browserMaster;
vmCvar_t ui_browserGameType;
-vmCvar_t ui_browserSortKey;
vmCvar_t ui_browserShowFull;
vmCvar_t ui_browserShowEmpty;
@@ -5728,7 +5704,6 @@
{ &ui_browserMaster, "ui_browserMaster", "0", CVAR_ARCHIVE },
{ &ui_browserGameType, "ui_browserGameType", "0", CVAR_ARCHIVE },
- { &ui_browserSortKey, "ui_browserSortKey", "4", CVAR_ARCHIVE },
{ &ui_browserShowFull, "ui_browserShowFull", "1", CVAR_ARCHIVE },
{ &ui_browserShowEmpty, "ui_browserShowEmpty", "1", CVAR_ARCHIVE },
@@ -5820,7 +5795,7 @@
};
-static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]);
+static int cvarTableSize = ARRAY_LEN( cvarTable );
/*
Modified: trunk/code/ui/ui_shared.c
===================================================================
--- trunk/code/ui/ui_shared.c 2011-03-05 19:11:56 UTC (rev 1909)
+++ trunk/code/ui/ui_shared.c 2011-03-05 19:20:37 UTC (rev 1910)
@@ -1258,7 +1258,7 @@
{"orbit", &Script_Orbit} // group/name
};
-int scriptCommandCount = sizeof(commandList) / sizeof(commandDef_t);
+int scriptCommandCount = ARRAY_LEN(commandList);
void Item_RunScript(itemDef_t *item, const char *s) {
@@ -3192,7 +3192,7 @@
};
-static const int g_bindCount = sizeof(g_bindings) / sizeof(bind_t);
+static const int g_bindCount = ARRAY_LEN(g_bindings);
#ifndef MISSIONPACK
static configcvar_t g_configcvars[] =
More information about the quake3-commits
mailing list