[iortcw] 102/152: All: Fix some clang warnings

Simon McVittie smcv at debian.org
Fri Sep 8 10:40:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.5a
in repository iortcw.

commit b8f5c614f73ea02e6a20eaf78bf217d4ac4365c5
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Sat Sep 10 04:57:06 2016 -0400

    All: Fix some clang warnings
---
 MP/code/cgame/cg_ents.c               |  2 +-
 MP/code/game/ai_cast_script_actions.c |  2 +-
 MP/code/game/ai_cast_think.c          |  4 ++--
 MP/code/qcommon/files.c               |  4 ++--
 MP/code/ui/ui_shared.c                |  4 ++--
 SP/code/cgame/cg_draw.c               |  8 +++-----
 SP/code/cgame/cg_ents.c               |  2 +-
 SP/code/cgame/cg_info.c               | 15 ---------------
 SP/code/cgame/cg_weapons.c            |  5 +++--
 SP/code/game/ai_cast_script_actions.c |  2 +-
 SP/code/game/ai_cast_think.c          |  4 ++--
 SP/code/ui/ui_shared.c                |  4 ++--
 12 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/MP/code/cgame/cg_ents.c b/MP/code/cgame/cg_ents.c
index 43651f3..7a27c2c 100644
--- a/MP/code/cgame/cg_ents.c
+++ b/MP/code/cgame/cg_ents.c
@@ -176,7 +176,7 @@ void CG_AddLightstyle( centity_t *cent ) {
 	int otime;
 	int lastch, nextch;
 
-	if ( !cent->dl_stylestring ) {
+	if ( cent->dl_stylestring[0] == '\0' ) {
 		return;
 	}
 
diff --git a/MP/code/game/ai_cast_script_actions.c b/MP/code/game/ai_cast_script_actions.c
index ecfb5ae..2afc6b2 100644
--- a/MP/code/game/ai_cast_script_actions.c
+++ b/MP/code/game/ai_cast_script_actions.c
@@ -1181,7 +1181,7 @@ qboolean AICast_ScriptAction_TakeWeapon( cast_state_t *cs, char *params ) {
 
 	}
 
-	if ( !g_entities[cs->entityNum].client->ps.weapons ) {
+	if ( !( g_entities[cs->entityNum].client->ps.weapons[0] ) && !( g_entities[cs->entityNum].client->ps.weapons[1] ) ) {
 		if ( cs->bs ) {
 			cs->bs->weaponnum = WP_NONE;
 		} else {
diff --git a/MP/code/game/ai_cast_think.c b/MP/code/game/ai_cast_think.c
index e583f00..a91dacc 100644
--- a/MP/code/game/ai_cast_think.c
+++ b/MP/code/game/ai_cast_think.c
@@ -1080,9 +1080,9 @@ done:
 	// hack, if we are above ground, chances are it's because we only did one frame, and gravity isn't applied until
 	// after the frame, so try and drop us down some
 	if ( pm.ps->groundEntityNum == ENTITYNUM_NONE ) {
-		VectorCopy( move->endpos, end );
+		VectorCopy( pm.ps->origin, end );
 		end[2] -= 32;
-		trap_Trace( &tr, move->endpos, pm.mins, pm.maxs, end, pm.ps->clientNum, pm.tracemask );
+		trap_Trace( &tr, pm.ps->origin, pm.mins, pm.maxs, end, pm.ps->clientNum, pm.tracemask );
 		if ( !tr.startsolid && !tr.allsolid && tr.fraction < 1 ) {
 			VectorCopy( tr.endpos, pm.ps->origin );
 			pm.ps->groundEntityNum = tr.entityNum;
diff --git a/MP/code/qcommon/files.c b/MP/code/qcommon/files.c
index 9011cb0..2ccbf32 100644
--- a/MP/code/qcommon/files.c
+++ b/MP/code/qcommon/files.c
@@ -1313,8 +1313,8 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
 						pak->referenced |= FS_UI_REF;
 
 					// DHM -- Nerve :: Don't allow singleplayer maps to be loaded from pak0
-					if(!FS_IsExt(filename, ".bsp", len) == 0 &&
-						Q_stricmp( pak->pakBasename, "pak0" ) == 0 ) {
+					if ( Q_stricmp( filename + len - 4, ".bsp" ) == 0 &&
+						 Q_stricmp( pak->pakBasename, "pak0" ) == 0 ) {
 
 						*file = 0;
 						return -1;
diff --git a/MP/code/ui/ui_shared.c b/MP/code/ui/ui_shared.c
index 31a9a2a..a7f4f31 100644
--- a/MP/code/ui/ui_shared.c
+++ b/MP/code/ui/ui_shared.c
@@ -1414,7 +1414,7 @@ void Script_NotebookShowpage( itemDef_t *item, char **args ) {
 						continue;
 					}
 
-					if ( pages & ( 1 << ( newpage - 1 ) ) ) {
+					if ( pages & ( 1 << ( abs( newpage - 1 ) ) ) ) {
 						dec++;
 //						if(dec == inc)
 //							break;
@@ -1432,7 +1432,7 @@ void Script_NotebookShowpage( itemDef_t *item, char **args ) {
 						newpage = newpage + NOTEBOOK_MAX_PAGES;
 					}
 
-					if ( pages & ( 1 << ( newpage - 1 ) ) ) {
+					if ( pages & ( 1 << ( abs( newpage - 1 ) ) ) ) {
 						break;
 					}
 				}
diff --git a/SP/code/cgame/cg_draw.c b/SP/code/cgame/cg_draw.c
index 48ce400..55d33aa 100644
--- a/SP/code/cgame/cg_draw.c
+++ b/SP/code/cgame/cg_draw.c
@@ -1216,12 +1216,12 @@ static void CG_DrawUpperRight(stereoFrame_t stereoFrame) {
 		y = CG_DrawFPS( y );
 	}
 	if ( cg_drawTimer.integer ) {
-		CG_DrawTimer( y );
+		y = CG_DrawTimer( y );
 	}
 // (SA) disabling drawattacker for the time being
 	if ( cg_oldWolfUI.integer ) {
 		if ( cg_drawAttacker.integer ) {
-			y = CG_DrawAttacker( y );
+			CG_DrawAttacker( y );
 		}
 	}
 //----(SA)	end
@@ -1249,9 +1249,7 @@ static float CG_DrawScores( float y ) {
 	int v;
 	vec4_t color;
 
-	s = CG_ConfigString( CS_SCORES1 );
 	s1 = cgs.scores1;
-	s = CG_ConfigString( CS_SCORES2 );
 	s2 = cgs.scores2;
 
 	y -=  BIGCHAR_HEIGHT + 8;
@@ -1482,7 +1480,7 @@ static void CG_DrawLowerRight( void ) {
 	}
 
 	y = CG_DrawScores( y );
-	y = CG_DrawPowerups( y );
+	CG_DrawPowerups( y );
 }
 
 //===========================================================================================
diff --git a/SP/code/cgame/cg_ents.c b/SP/code/cgame/cg_ents.c
index eb9f897..ab56ce0 100644
--- a/SP/code/cgame/cg_ents.c
+++ b/SP/code/cgame/cg_ents.c
@@ -340,7 +340,7 @@ void CG_AddLightstyle( centity_t *cent ) {
 	int otime;
 	int lastch, nextch;
 
-	if ( !cent->dl_stylestring ) {
+	if ( cent->dl_stylestring[0] == '\0' ) {
 		return;
 	}
 
diff --git a/SP/code/cgame/cg_info.c b/SP/code/cgame/cg_info.c
index 2f0cb62..7dffc2f 100644
--- a/SP/code/cgame/cg_info.c
+++ b/SP/code/cgame/cg_info.c
@@ -375,9 +375,6 @@ Draw all the status / pacifier stuff during level loading
 ====================
 */
 void CG_DrawInformation( void ) {
-	const char  *s;
-	const char  *info;
-	qhandle_t levelshot = 0;   // TTimo: init
 	static int callCount = 0;
 	float percentDone;
 
@@ -396,23 +393,11 @@ void CG_DrawInformation( void ) {
 
 	callCount++;
 
-	info = CG_ConfigString( CS_SERVERINFO );
-
 	trap_Cvar_VariableStringBuffer( "com_expectedhunkusage", hunkBuf, MAX_QPATH );
 	expectedHunk = atoi( hunkBuf );
 
-	s = Info_ValueForKey( info, "mapname" );
-
 	//----(SA)	just the briefing now
 
-	if ( s && s[0] != 0 ) {  // there is often no 's'
-		levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s.tga", s ) );
-	}
-
-	if ( !levelshot ) {
-		levelshot = trap_R_RegisterShaderNoMip( "levelshots/unknownmap.jpg" );
-	}
-
 	trap_R_SetColor( NULL );
 
 	// show the loading progress
diff --git a/SP/code/cgame/cg_weapons.c b/SP/code/cgame/cg_weapons.c
index 69e9421..8e8a038 100644
--- a/SP/code/cgame/cg_weapons.c
+++ b/SP/code/cgame/cg_weapons.c
@@ -3010,6 +3010,9 @@ void CG_AddViewWeapon( playerState_t *ps ) {
 		fovOffset[2] = -0.2 * ( cg_fov.integer - 90 );
  	}
 
+	memset( &hand, 0, sizeof( hand ) );
+	VectorCopy( hand.origin, hand.lightingOrigin );
+
 	if ( ps->weapon > WP_NONE ) {
 		// DHM - Nerve :: handle WP_CLASS_SPECIAL for different classes
 		if ( cgs.gametype == GT_WOLF && ps->weapon == WP_CLASS_SPECIAL ) {
@@ -3037,8 +3040,6 @@ void CG_AddViewWeapon( playerState_t *ps ) {
 		}
 		// dhm - end
 
-		memset( &hand, 0, sizeof( hand ) );
-
 		// set up gun position
 		CG_CalculateWeaponPosition( hand.origin, angles );
 
diff --git a/SP/code/game/ai_cast_script_actions.c b/SP/code/game/ai_cast_script_actions.c
index f071d61..150ab04 100644
--- a/SP/code/game/ai_cast_script_actions.c
+++ b/SP/code/game/ai_cast_script_actions.c
@@ -1439,7 +1439,7 @@ qboolean AICast_ScriptAction_TakeWeapon( cast_state_t *cs, char *params ) {
 
 	}
 
-	if ( !g_entities[cs->entityNum].client->ps.weapons ) {
+	if ( !( g_entities[cs->entityNum].client->ps.weapons[0] ) && !( g_entities[cs->entityNum].client->ps.weapons[1] ) ) {
 		if ( cs->bs ) {
 			cs->weaponNum = WP_NONE;
 		} else {
diff --git a/SP/code/game/ai_cast_think.c b/SP/code/game/ai_cast_think.c
index 8b0fc71..37090e8 100644
--- a/SP/code/game/ai_cast_think.c
+++ b/SP/code/game/ai_cast_think.c
@@ -1206,9 +1206,9 @@ done:
 	// hack, if we are above ground, chances are it's because we only did one frame, and gravity isn't applied until
 	// after the frame, so try and drop us down some
 	if ( pm.ps->groundEntityNum == ENTITYNUM_NONE ) {
-		VectorCopy( move->endpos, end );
+		VectorCopy( pm.ps->origin, end );
 		end[2] -= 32;
-		trap_Trace( &tr, move->endpos, pm.mins, pm.maxs, end, pm.ps->clientNum, pm.tracemask );
+		trap_Trace( &tr, pm.ps->origin, pm.mins, pm.maxs, end, pm.ps->clientNum, pm.tracemask );
 		if ( !tr.startsolid && !tr.allsolid && tr.fraction < 1 ) {
 			VectorCopy( tr.endpos, pm.ps->origin );
 			pm.ps->groundEntityNum = tr.entityNum;
diff --git a/SP/code/ui/ui_shared.c b/SP/code/ui/ui_shared.c
index bf77d9a..fe4a73a 100644
--- a/SP/code/ui/ui_shared.c
+++ b/SP/code/ui/ui_shared.c
@@ -1433,7 +1433,7 @@ void Script_NotebookShowpage( itemDef_t *item, char **args ) {
 						continue;
 					}
 
-					if ( pages & ( 1 << ( newpage - 1 ) ) ) {
+					if ( pages & ( 1 << ( abs( newpage - 1 ) ) ) ) {
 						dec++;
 //						if(dec == inc)
 //							break;
@@ -1451,7 +1451,7 @@ void Script_NotebookShowpage( itemDef_t *item, char **args ) {
 						newpage = newpage + NOTEBOOK_MAX_PAGES;
 					}
 
-					if ( pages & ( 1 << ( newpage - 1 ) ) ) {
+					if ( pages & ( 1 << ( abs( newpage - 1 ) ) ) ) {
 						break;
 					}
 				}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list