From 120e296a74b0317f29d7f516d904bdc70f71b006 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Sun, 14 Apr 2013 18:33:25 +0200 Subject: [PATCH] fix some OOB enumerator usages (should be no-op with usual compiler workings) --- code/q3_ui/ui_players.c | 14 +++++++------- code/qcommon/files.c | 2 +- code/qcommon/qcommon.h | 2 +- code/ui/ui_main.c | 4 ++-- code/ui/ui_players.c | 14 +++++++------- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/code/q3_ui/ui_players.c b/code/q3_ui/ui_players.c index d132f5c9..fbb87b6d 100644 --- a/code/q3_ui/ui_players.c +++ b/code/q3_ui/ui_players.c @@ -708,10 +708,10 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti dp_realtime = time; - if ( pi->pendingWeapon != -1 && dp_realtime > pi->weaponTimer ) { + if ( pi->pendingWeapon != WP_NUM_WEAPONS && dp_realtime > pi->weaponTimer ) { pi->weapon = pi->pendingWeapon; pi->lastWeapon = pi->pendingWeapon; - pi->pendingWeapon = -1; + pi->pendingWeapon = WP_NUM_WEAPONS; pi->weaponTimer = 0; if( pi->currentWeapon != pi->weapon ) { trap_S_StartLocalSound( weaponChangeSound, CHAN_LOCAL ); @@ -1136,7 +1136,7 @@ void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model ) { pi->weapon = WP_MACHINEGUN; pi->currentWeapon = pi->weapon; pi->lastWeapon = pi->weapon; - pi->pendingWeapon = -1; + pi->pendingWeapon = WP_NUM_WEAPONS; pi->weaponTimer = 0; pi->chat = qfalse; pi->newModel = qtrue; @@ -1202,11 +1202,11 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_ pi->torso.yawAngle = viewAngles[YAW]; pi->torso.yawing = qfalse; - if ( weaponNumber != -1 ) { + if ( weaponNumber != WP_NUM_WEAPONS ) { pi->weapon = weaponNumber; pi->currentWeapon = weaponNumber; pi->lastWeapon = weaponNumber; - pi->pendingWeapon = -1; + pi->pendingWeapon = WP_NUM_WEAPONS; pi->weaponTimer = 0; UI_PlayerInfo_SetWeapon( pi, pi->weapon ); } @@ -1215,8 +1215,8 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_ } // weapon - if ( weaponNumber == -1 ) { - pi->pendingWeapon = -1; + if ( weaponNumber == WP_NUM_WEAPONS ) { + pi->pendingWeapon = WP_NUM_WEAPONS; pi->weaponTimer = 0; } else if ( weaponNumber != WP_NONE ) { diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 724175c4..20808f0b 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -1398,7 +1398,7 @@ Return the searchpath in "startSearch". ================= */ -vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, int enableDll) +int FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, int enableDll) { searchpath_t *search, *lastSearch; directory_t *dir; diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h index 349953db..65271464 100644 --- a/code/qcommon/qcommon.h +++ b/code/qcommon/qcommon.h @@ -624,7 +624,7 @@ qboolean FS_FileExists( const char *file ); qboolean FS_CreatePath (char *OSPath); -vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, int enableDll); +int FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, int enableDll); char *FS_BuildOSPath( const char *base, const char *game, const char *qpath ); qboolean FS_CompareZipChecksum(const char *zipfile); diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index 602957d9..21423cd2 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -118,7 +118,7 @@ static void UI_StartServerRefresh(qboolean full); static void UI_StopServerRefresh( void ); static void UI_DoServerRefresh( void ); static void UI_FeederSelection(float feederID, int index); -static void UI_BuildServerDisplayList(qboolean force); +static void UI_BuildServerDisplayList(int force); static void UI_BuildServerStatus(qboolean force); static void UI_BuildFindPlayerList(qboolean force); static int QDECL UI_ServersQsortCompare( const void *arg1, const void *arg2 ); @@ -3762,7 +3762,7 @@ static void UI_BinaryServerInsertion(int num) { UI_BuildServerDisplayList ================== */ -static void UI_BuildServerDisplayList(qboolean force) { +static void UI_BuildServerDisplayList(int force) { int i, count, clients, maxClients, ping, game, len, visible; char info[MAX_STRING_CHARS]; // qboolean startRefresh = qtrue; TTimo: unused diff --git a/code/ui/ui_players.c b/code/ui/ui_players.c index 409ff689..2b74d0e1 100644 --- a/code/ui/ui_players.c +++ b/code/ui/ui_players.c @@ -714,10 +714,10 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti dp_realtime = time; - if ( pi->pendingWeapon != -1 && dp_realtime > pi->weaponTimer ) { + if ( pi->pendingWeapon != WP_NUM_WEAPONS && dp_realtime > pi->weaponTimer ) { pi->weapon = pi->pendingWeapon; pi->lastWeapon = pi->pendingWeapon; - pi->pendingWeapon = -1; + pi->pendingWeapon = WP_NUM_WEAPONS; pi->weaponTimer = 0; if( pi->currentWeapon != pi->weapon ) { trap_S_StartLocalSound( weaponChangeSound, CHAN_LOCAL ); @@ -1254,7 +1254,7 @@ void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model, const char *he pi->weapon = WP_MACHINEGUN; pi->currentWeapon = pi->weapon; pi->lastWeapon = pi->weapon; - pi->pendingWeapon = -1; + pi->pendingWeapon = WP_NUM_WEAPONS; pi->weaponTimer = 0; pi->chat = qfalse; pi->newModel = qtrue; @@ -1293,11 +1293,11 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_ pi->torso.yawAngle = viewAngles[YAW]; pi->torso.yawing = qfalse; - if ( weaponNumber != -1 ) { + if ( weaponNumber != WP_NUM_WEAPONS ) { pi->weapon = weaponNumber; pi->currentWeapon = weaponNumber; pi->lastWeapon = weaponNumber; - pi->pendingWeapon = -1; + pi->pendingWeapon = WP_NUM_WEAPONS; pi->weaponTimer = 0; UI_PlayerInfo_SetWeapon( pi, pi->weapon ); } @@ -1306,8 +1306,8 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_ } // weapon - if ( weaponNumber == -1 ) { - pi->pendingWeapon = -1; + if ( weaponNumber == WP_NUM_WEAPONS ) { + pi->pendingWeapon = WP_NUM_WEAPONS; pi->weaponTimer = 0; } else if ( weaponNumber != WP_NONE ) {