diff options
author | /dev/humancontroller <devhc@example.com> | 2017-04-13 11:30:00 +0000 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-04-15 17:24:16 +0200 |
commit | 787ae313812f0a385f3cec9216fa0e67df148ca7 (patch) | |
tree | 1a237cba93c991aa09280b2765a23a41179a91ab /src | |
parent | 979776bf1d7319218d84dd488ed69a45a854dce1 (diff) |
fix a bunch of C-specific programming errors
detected by Clang
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_buildable.c | 3 | ||||
-rw-r--r-- | src/game/bg_public.h | 2 | ||||
-rw-r--r-- | src/game/g_active.c | 2 | ||||
-rw-r--r-- | src/game/g_buildable.c | 4 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 8 |
5 files changed, 9 insertions, 10 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index e7b4d85..eed8e0e 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -920,8 +920,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent ) VectorCopy( cent->lerpOrigin, origin ); // center point - origin[ 2 ] += mins[ 2 ]; - origin[ 2 ] += ( abs( mins[ 2 ] ) + abs( maxs[ 2 ] ) ) / 2; + origin[ 2 ] += ( mins[ 2 ] + maxs[ 2 ] ) / 2; entNum = cg.predictedPlayerState.clientNum; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 817b7aa..cbb2def 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -1014,7 +1014,7 @@ typedef struct int meansOfDeath; int team; - weapon_t buildWeapon; + int buildWeapon; int idleAnim; diff --git a/src/game/g_active.c b/src/game/g_active.c index 147aabc..bfbec2a 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -236,7 +236,7 @@ static void G_ClientShove( gentity_t *ent, gentity_t *victim ) VectorNormalizeFast( dir ); // don't break the dretch elevator - if( abs( dir[ 2 ] ) > abs( dir[ 0 ] ) && abs( dir[ 2 ] ) > abs( dir[ 1 ] ) ) + if( fabs( dir[ 2 ] ) > fabs( dir[ 0 ] ) && fabs( dir[ 2 ] ) > fabs( dir[ 1 ] ) ) return; VectorScale( dir, diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index b8ecad4..983e259 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2229,8 +2229,8 @@ qboolean HMGTurret_TrackEnemy( gentity_t *self ) vectoangles( dirToTarget, self->turretAim ); //if pointing at our target return true - if( abs( angleToTarget[ YAW ] - self->s.angles2[ YAW ] ) <= accuracyTolerance && - abs( angleToTarget[ PITCH ] - self->s.angles2[ PITCH ] ) <= accuracyTolerance ) + if( fabs( angleToTarget[ YAW ] - self->s.angles2[ YAW ] ) <= accuracyTolerance && + fabs( angleToTarget[ PITCH ] - self->s.angles2[ PITCH ] ) <= accuracyTolerance ) return qtrue; return qfalse; diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index f63a9fd..f66476c 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -1125,10 +1125,10 @@ void Menu_TransitionItemByName(menuDef_t *menu, const char *p, rectDef_t rectFro item->window.offsetTime = time; memcpy(&item->window.rectClient, &rectFrom, sizeof(rectDef_t)); memcpy(&item->window.rectEffects, &rectTo, sizeof(rectDef_t)); - item->window.rectEffects2.x = abs(rectTo.x - rectFrom.x) / amt; - item->window.rectEffects2.y = abs(rectTo.y - rectFrom.y) / amt; - item->window.rectEffects2.w = abs(rectTo.w - rectFrom.w) / amt; - item->window.rectEffects2.h = abs(rectTo.h - rectFrom.h) / amt; + item->window.rectEffects2.x = fabs(rectTo.x - rectFrom.x) / amt; + item->window.rectEffects2.y = fabs(rectTo.y - rectFrom.y) / amt; + item->window.rectEffects2.w = fabs(rectTo.w - rectFrom.w) / amt; + item->window.rectEffects2.h = fabs(rectTo.h - rectFrom.h) / amt; Item_UpdatePosition(item); } } |