[openjk] 28/32: Shared: Fix some warnings spotted by gcc
Simon McVittie
smcv at debian.org
Sun Mar 12 18:03:05 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository openjk.
commit b24826990b40e154e2c441fd926c8853d6b0f882
Author: Ensiform <ensiform at gmail.com>
Date: Sun Mar 12 10:10:57 2017 -0500
Shared: Fix some warnings spotted by gcc
---
code/cgame/cg_main.cpp | 4 ++--
code/game/Q3_Interface.cpp | 2 +-
code/game/g_client.cpp | 6 +++---
code/rd-vanilla/tr_ghoul2.cpp | 4 ++--
codeJK2/cgame/animtable.h | 2 +-
codeJK2/cgame/cg_main.cpp | 4 ++--
codeJK2/game/AI_Utils.cpp | 4 ++--
codeJK2/game/NPC.cpp | 4 ----
codeJK2/game/Q3_Interface.cpp | 8 ++++----
codeJK2/game/g_client.cpp | 6 +++---
codemp/game/NPC.c | 4 ----
codemp/game/bg_panimate.c | 2 +-
12 files changed, 21 insertions(+), 29 deletions(-)
diff --git a/code/cgame/cg_main.cpp b/code/cgame/cg_main.cpp
index ef1ce0e..eeb2ed5 100644
--- a/code/cgame/cg_main.cpp
+++ b/code/cgame/cg_main.cpp
@@ -1000,7 +1000,7 @@ void CG_RegisterClientRenderInfo(clientInfo_t *ci, renderInfo_t *ri)
char torsoSkinName[MAX_QPATH];
char legsSkinName[MAX_QPATH];
- if(!ri->legsModelName || !ri->legsModelName[0])
+ if(!ri->legsModelName[0])
{//Must have at LEAST a legs model
return;
}
@@ -1020,7 +1020,7 @@ void CG_RegisterClientRenderInfo(clientInfo_t *ci, renderInfo_t *ri)
*slash = 0;
}
- if(ri->torsoModelName && ri->torsoModelName[0])
+ if(ri->torsoModelName[0])
{
Q_strncpyz( torsoModelName, ri->torsoModelName, sizeof( torsoModelName ) );
//Torso skin
diff --git a/code/game/Q3_Interface.cpp b/code/game/Q3_Interface.cpp
index 585167a..310dd28 100644
--- a/code/game/Q3_Interface.cpp
+++ b/code/game/Q3_Interface.cpp
@@ -128,7 +128,7 @@ stringID_table_t BSETTable[] =
stringID_table_t WPTable[] =
{
- { "NULL",WP_NONE },
+ { "NULL", WP_NONE },
ENUM2STRING(WP_NONE),
// Player weapons
ENUM2STRING(WP_SABER), // NOTE: lots of code assumes this is the first weapon (... which is crap) so be careful -Ste.
diff --git a/code/game/g_client.cpp b/code/game/g_client.cpp
index 9c05053..039d7c6 100644
--- a/code/game/g_client.cpp
+++ b/code/game/g_client.cpp
@@ -124,13 +124,13 @@ qboolean SpotWouldTelefrag( gentity_t *spot, team_t checkteam )
vec3_t mins, maxs;
// If we have a mins, use that instead of the hardcoded bounding box
- if ( spot->mins && VectorLength( spot->mins ) )
+ if ( !VectorCompare(spot->mins, vec3_origin) && && VectorLength( spot->mins ) )
VectorAdd( spot->s.origin, spot->mins, mins );
else
VectorAdd( spot->s.origin, playerMins, mins );
// If we have a maxs, use that instead of the hardcoded bounding box
- if ( spot->maxs && VectorLength( spot->maxs ) )
+ if ( !VectorCompare(spot->maxs, vec3_origin) && && VectorLength( spot->maxs ) )
VectorAdd( spot->s.origin, spot->maxs, maxs );
else
VectorAdd( spot->s.origin, playerMaxs, maxs );
@@ -290,7 +290,7 @@ gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, team_t team, vec3_t origin, vec
gentity_t *spot;
gentity_t *nearestSpot;
- if ( level.spawntarget != NULL && level.spawntarget[0] )
+ if ( level.spawntarget[0] )
{//we have a spawnpoint specified, try to find it
if ( (nearestSpot = spot = G_Find( NULL, FOFS(targetname), level.spawntarget )) == NULL )
{//you HAVE to be able to find the desired spot
diff --git a/code/rd-vanilla/tr_ghoul2.cpp b/code/rd-vanilla/tr_ghoul2.cpp
index 24110b2..09ea844 100644
--- a/code/rd-vanilla/tr_ghoul2.cpp
+++ b/code/rd-vanilla/tr_ghoul2.cpp
@@ -1223,7 +1223,7 @@ void G2_RagGetAnimMatrix(CGhoul2Info &ghoul2, const int boneNum, mdxaBone_t &mat
skel = (mdxaSkel_t *)((byte *)ghoul2.mBoneCache->header + sizeof(mdxaHeader_t) + offsets->offsets[boneNum]);
//find/add the bone in the list
- if (!skel->name || !skel->name[0])
+ if (!skel->name[0])
{
bListIndex = -1;
}
@@ -1262,7 +1262,7 @@ void G2_RagGetAnimMatrix(CGhoul2Info &ghoul2, const int boneNum, mdxaBone_t &mat
pskel = (mdxaSkel_t *)((byte *)ghoul2.mBoneCache->header + sizeof(mdxaHeader_t) + offsets->offsets[parent]);
//taking bone matrix for the skeleton frame and parent's animFrameMatrix into account, determine our final animFrameMatrix
- if (!pskel->name || !pskel->name[0])
+ if (!pskel->name[0])
{
parentBlistIndex = -1;
}
diff --git a/codeJK2/cgame/animtable.h b/codeJK2/cgame/animtable.h
index db67b1c..c7911b3 100644
--- a/codeJK2/cgame/animtable.h
+++ b/codeJK2/cgame/animtable.h
@@ -1383,5 +1383,5 @@ stringID_table_t animTable [MAX_ANIMATIONS+1] =
ENUM2STRING(FACE_DEAD), //#
//must be terminated
- NULL,-1
+ {NULL,-1}
};
diff --git a/codeJK2/cgame/cg_main.cpp b/codeJK2/cgame/cg_main.cpp
index 128de98..c2bcfa7 100644
--- a/codeJK2/cgame/cg_main.cpp
+++ b/codeJK2/cgame/cg_main.cpp
@@ -949,7 +949,7 @@ void CG_RegisterClientRenderInfo(clientInfo_t *ci, renderInfo_t *ri)
char torsoSkinName[MAX_QPATH];
char legsSkinName[MAX_QPATH];
- if(!ri->legsModelName || !ri->legsModelName[0])
+ if(!ri->legsModelName[0])
{//Must have at LEAST a legs model
return;
}
@@ -969,7 +969,7 @@ void CG_RegisterClientRenderInfo(clientInfo_t *ci, renderInfo_t *ri)
*slash = 0;
}
- if(ri->torsoModelName && ri->torsoModelName[0])
+ if(ri->torsoModelName[0])
{
Q_strncpyz( torsoModelName, ri->torsoModelName, sizeof( torsoModelName ) );
//Torso skin
diff --git a/codeJK2/game/AI_Utils.cpp b/codeJK2/game/AI_Utils.cpp
index c5f9783..2a87946 100644
--- a/codeJK2/game/AI_Utils.cpp
+++ b/codeJK2/game/AI_Utils.cpp
@@ -101,8 +101,8 @@ int AI_ClosestGroupEntityNumToPoint( AIGroupInfo_t &group, vec3_t point )
int markerWP = WAYPOINT_NONE;
int cost, bestCost = Q3_INFINITE;
int closest = ENTITYNUM_NONE;
-
- if ( &group == NULL || group.numGroup <= 0 )
+
+ if ( group.numGroup <= 0 )
{
return ENTITYNUM_NONE;
}
diff --git a/codeJK2/game/NPC.cpp b/codeJK2/game/NPC.cpp
index 30cbcec..b57d634 100644
--- a/codeJK2/game/NPC.cpp
+++ b/codeJK2/game/NPC.cpp
@@ -378,9 +378,6 @@ void pitch_roll_for_slope( gentity_t *forwhom, vec3_t pass_slope )
if ( trace.fraction >= 1.0 )
return;
- if( !( &trace.plane ) )
- return;
-
if ( VectorCompare( vec3_origin, trace.plane.normal ) )
return;
@@ -391,7 +388,6 @@ void pitch_roll_for_slope( gentity_t *forwhom, vec3_t pass_slope )
VectorCopy( pass_slope, slope );
}
-
AngleVectors( forwhom->currentAngles, ovf, ovr, NULL );
vectoangles( slope, new_angles );
diff --git a/codeJK2/game/Q3_Interface.cpp b/codeJK2/game/Q3_Interface.cpp
index ef31d48..7987da9 100644
--- a/codeJK2/game/Q3_Interface.cpp
+++ b/codeJK2/game/Q3_Interface.cpp
@@ -79,7 +79,7 @@ extern cvar_t *g_skippingcin;
extern qboolean stop_icarus;
-#define stringIDExpand(str, strEnum) str, strEnum, ENUM2STRING(strEnum)
+#define stringIDExpand(str, strEnum) { str, strEnum }, ENUM2STRING(strEnum)
//#define stringIDExpand(str, strEnum) str,strEnum
/*
@@ -125,12 +125,12 @@ stringID_table_t BSETTable[] =
ENUM2STRING(BSET_FFIRE),//# script to run when player shoots their own teammates
ENUM2STRING(BSET_FFDEATH),//# script to run when player kills a teammate
stringIDExpand("", BSET_INVALID),
- "", -1,
+ {"", -1},
};
stringID_table_t WPTable[] =
{
- "NULL",WP_NONE,
+ {"NULL", WP_NONE},
ENUM2STRING(WP_NONE),
// Player weapons
ENUM2STRING(WP_SABER), // NOTE: lots of code assumes this is the first weapon (... which is crap) so be careful -Ste.
@@ -2303,7 +2303,7 @@ stringID_table_t teamTable [] =
ENUM2STRING(TEAM_PLAYER),
ENUM2STRING(TEAM_ENEMY),
ENUM2STRING(TEAM_NEUTRAL),
- "", TEAM_FREE,
+ {"", TEAM_FREE},
};
diff --git a/codeJK2/game/g_client.cpp b/codeJK2/game/g_client.cpp
index 9367b33..0535279 100644
--- a/codeJK2/game/g_client.cpp
+++ b/codeJK2/game/g_client.cpp
@@ -104,13 +104,13 @@ qboolean SpotWouldTelefrag( gentity_t *spot, team_t checkteam )
vec3_t mins, maxs;
// If we have a mins, use that instead of the hardcoded bounding box
- if ( spot->mins && VectorLength( spot->mins ) )
+ if ( !VectorCompare(spot->mins, vec3_origin) && VectorLength( spot->mins ) )
VectorAdd( spot->s.origin, spot->mins, mins );
else
VectorAdd( spot->s.origin, playerMins, mins );
// If we have a maxs, use that instead of the hardcoded bounding box
- if ( spot->maxs && VectorLength( spot->maxs ) )
+ if ( !VectorCompare(spot->maxs, vec3_origin) && VectorLength( spot->maxs ) )
VectorAdd( spot->s.origin, spot->maxs, maxs );
else
VectorAdd( spot->s.origin, playerMaxs, maxs );
@@ -270,7 +270,7 @@ gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, team_t team, vec3_t origin, vec
gentity_t *spot;
gentity_t *nearestSpot;
- if ( level.spawntarget != NULL && level.spawntarget[0] )
+ if ( level.spawntarget[0] )
{//we have a spawnpoint specified, try to find it
if ( (nearestSpot = spot = G_Find( NULL, FOFS(targetname), level.spawntarget )) == NULL )
{//you HAVE to be able to find the desired spot
diff --git a/codemp/game/NPC.c b/codemp/game/NPC.c
index 48ebec7..c199544 100644
--- a/codemp/game/NPC.c
+++ b/codemp/game/NPC.c
@@ -364,9 +364,6 @@ void pitch_roll_for_slope( gentity_t *forwhom, vec3_t pass_slope )
if ( trace.fraction >= 1.0 )
return;
- if( !( &trace.plane ) )
- return;
-
if ( VectorCompare( vec3_origin, trace.plane.normal ) )
return;
@@ -377,7 +374,6 @@ void pitch_roll_for_slope( gentity_t *forwhom, vec3_t pass_slope )
VectorCopy( pass_slope, slope );
}
-
AngleVectors( forwhom->r.currentAngles, ovf, ovr, NULL );
vectoangles( slope, new_angles );
diff --git a/codemp/game/bg_panimate.c b/codemp/game/bg_panimate.c
index 9e8c368..8b7b22f 100644
--- a/codemp/game/bg_panimate.c
+++ b/codemp/game/bg_panimate.c
@@ -1848,7 +1848,7 @@ void ParseAnimationEvtBlock(const char *aeb_filename, animevent_t *animEvents, a
token = COM_Parse( text_p );
eventType = (animEventType_t)GetIDForString(animEventTypeTable, token);
- if ( eventType == AEV_NONE || eventType == -1 )
+ if ( eventType == AEV_NONE || eventType == (animEventType_t)-1 )
{//Unrecognized ANIM EVENT TYOE, or we're skipping this line, keep going till you get a good one
//Com_Printf(S_COLOR_YELLOW"WARNING: Unknown token %s in animEvent file %s\n", token, aeb_filename );
continue;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git
More information about the Pkg-games-commits
mailing list