From bf4f01f9b2cfca33827edf32e467d8f0d87c0896 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Fri, 30 Aug 2019 11:59:41 +0500 Subject: [PATCH] Fix warnings. --- dlls/client.cpp | 16 ++++----- dlls/coop.cpp | 16 ++++----- dlls/enttools.cpp | 6 ++-- dlls/gravgunmod.cpp | 14 ++++---- dlls/player.cpp | 2 +- dlls/player.h | 2 +- dlls/prop.cpp | 2 +- dlls/triggers.cpp | 10 +++--- dlls/util.cpp | 84 ++++++++++++++++++++++----------------------- dlls/weapons.h | 2 +- 10 files changed, 77 insertions(+), 77 deletions(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index 6058d535..444e7b50 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1274,15 +1274,15 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h size = ent->v.size.z; if( size > 512 ) // big brushes may be rotated, but dist check does not cover this - dist = abs(delta.z), size = ent->v.size.z; + dist = fabs(delta.z), size = ent->v.size.z; else { - if( abs(delta.x) > dist ) - dist = abs(delta.x); - if( abs(delta.y) > dist ) - dist = abs(delta.y); - if( abs(delta.z) > dist ) - dist = abs(delta.z); + if( fabs(delta.x) > dist ) + dist = fabs(delta.x); + if( fabs(delta.y) > dist ) + dist = fabs(delta.y); + if( fabs(delta.z) > dist ) + dist = fabs(delta.z); } dist -= size / 2; @@ -1314,7 +1314,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h // attachments/sounds, so we may just skip adding it to packet // but left it just hidden if we have enough visents to prevent // sending big delta packets, but reserve 256 slots for visible - if( counter > 128 && !istrash || counter > 256 ) + if( ( counter > 128 && !istrash ) || counter > 256 ) return 0; } diff --git a/dlls/coop.cpp b/dlls/coop.cpp index b3f57997..cf86224b 100644 --- a/dlls/coop.cpp +++ b/dlls/coop.cpp @@ -224,7 +224,7 @@ static void COOP_CheckSaveSlots( void ) // check save slots (may be cleaned by newunit) GET_GAME_DIR(path); - strcat( path, PATHSEP"save" ); + strcat( path, PATHSEP "save" ); for( i = 0; i < ARRAYSIZE( g_CoopState.p.rgszSaveSlots ); i++ ) { char fpath[256] = ""; @@ -233,8 +233,8 @@ static void COOP_CheckSaveSlots( void ) if( !g_CoopState.p.rgszSaveSlots[i] ) continue; - snprintf( fpath, 255, "%s"PATHSEP"%s.coop", path, g_CoopState.p.rgszSaveSlots[i] ); - if( f = fopen( fpath, "rb" ) ) + snprintf( fpath, 255, "%s" PATHSEP "%s.coop", path, g_CoopState.p.rgszSaveSlots[i] ); + if( ( f = fopen( fpath, "rb" ) ) ) fclose( f ); else g_CoopState.p.rgszSaveSlots[i][0] = 0; @@ -256,7 +256,7 @@ void COOP_ClearSaves( void ) const char *pszOldMap = NULL; GET_GAME_DIR(path); - strcat( path, PATHSEP"save" ); + strcat( path, PATHSEP "save" ); if( g_CoopState.landmarkTransition.szSourceMap[0] ) pszOldMap = g_CoopState.landmarkTransition.szSourceMap; @@ -270,7 +270,7 @@ void COOP_ClearSaves( void ) return; } - while( entry = readdir( dir) ) + while( ( entry = readdir( dir ) ) ) { if( Q_stricmpext("auto0-*", entry->d_name ) || Q_stricmpext("auto1-*", entry->d_name ) || @@ -280,7 +280,7 @@ void COOP_ClearSaves( void ) if( pszOldMap && !strncmp( entry->d_name + 6, pszOldMap, strlen( pszOldMap ) ) ) continue; - snprintf( fpath, 255, "%s"PATHSEP"%s", path, entry->d_name ); + snprintf( fpath, 255, "%s" PATHSEP "%s", path, entry->d_name ); ALERT( at_console, "Removing %s\n", fpath ); remove( fpath ); } @@ -579,7 +579,7 @@ void COOP_MarkTriggers( void ) { CBaseEntity *pTrigger = NULL; - while( pTrigger = UTIL_FindEntityByClassname( pTrigger, "trigger_changelevel" ) ) + while( ( pTrigger = UTIL_FindEntityByClassname( pTrigger, "trigger_changelevel" ) ) ) { struct COOPChangelevelData *pData = COOP_GetTriggerData( pTrigger ); //pData->fIsBack = !strcmp( pData->pszMapName, g_CoopState.landmarkTransition.szSourceMap ); @@ -933,7 +933,7 @@ CBaseEntity *UTIL_CoopGetPlayerTrain( CBaseEntity *pPlayer) if( !train ) return NULL; - if( !train->pev->globalname ||!STRING(train->pev->globalname) || !STRING(train->pev->globalname)[0] ) + if( !train->pev->globalname || !( STRING( train->pev->globalname ) ) || !( STRING( train->pev->globalname ) )[0] ) return NULL; // doors are elevators if( strcmp( STRING( train->pev->classname ), "func_train") && strcmp( STRING( train->pev->classname ), "func_tracktrain") && strcmp( STRING( train->pev->classname ), "func_door") ) diff --git a/dlls/enttools.cpp b/dlls/enttools.cpp index c3e4d6ad..812ba8d1 100644 --- a/dlls/enttools.cpp +++ b/dlls/enttools.cpp @@ -45,7 +45,7 @@ void Ent_AddToBlacklist_f( void ) node->next = entblacklist; strncpy( node->pattern, CMD_ARGV(1), 31 ); - node->pattern[32] = 0; + node->pattern[31] = 0; node->limit = atoi( CMD_ARGV(2) ); node->behaviour = atoi( CMD_ARGV( 3 ) ); node->clear = !!atoi( CMD_ARGV( 4 ) ); @@ -474,7 +474,7 @@ bool Ent_CheckModel( const char *model ) return false; model_t *world = (model_t*)g_physfuncs.pfnGetModel(1); int submodel = atoi(model + 1); - if( submodel < 1 || world && submodel >= world->numsubmodels ) + if( submodel < 1 || ( world && submodel >= world->numsubmodels ) ) return false; } // do not allow to set different model types. bsp models will destroy all submodels on map else if( !strstr( model, ".mdl" ) && !strstr( model, ".spr" ) ) @@ -1093,7 +1093,7 @@ void Ent_Create_f( edict_t *player ) if( pPlayer && pPlayer->IsPlayer() && pPlayer->m_ggm.pState && pPlayer->m_ggm.pState->fRegistered ) entity->enttools_data.enttools = 2; - if( plid ); + if( plid ) strcpy( entity->enttools_data.ownerid, plid ); } } diff --git a/dlls/gravgunmod.cpp b/dlls/gravgunmod.cpp index bb43cfe2..8ca52c40 100644 --- a/dlls/gravgunmod.cpp +++ b/dlls/gravgunmod.cpp @@ -327,7 +327,7 @@ const char *GGM_PlayerName( CBaseEntity *pPlayer ) { if( !pPlayer ) return "unnamed(NULL)"; - return (const char*)( ( pPlayer->pev->netname && STRING( pPlayer->pev->netname )[0] != 0 ) ? STRING( pPlayer->pev->netname ) : "unconnected" ); + return (const char*)( ( pPlayer->pev->netname && ( STRING( pPlayer->pev->netname ) )[0] != 0 ) ? STRING( pPlayer->pev->netname ) : "unconnected" ); } /* @@ -492,7 +492,7 @@ void Ent_RunGC( int flags, const char *userid, const char *pattern ) continue; } - if( !strncmp( classname, "monster_", 8 ) && ent->v.health <= 0 || ent->v.deadflag != DEAD_NO ) + if( ( !strncmp( classname, "monster_", 8 ) && ent->v.health <= 0 ) || ent->v.deadflag != DEAD_NO ) { ent->v.flags |= FL_KILLME; removed++; @@ -742,7 +742,7 @@ bool GGM_FilterFileName( const char *name ) { while( name && *name ) { - if( *name >= 'A' && *name <= 'z' || *name >= '0' && *name <= '9' || *name == '_' ) + if( ( *name >= 'A' && *name <= 'z' ) || ( *name >= '0' && *name <= '9' ) || *name == '_' ) { name++; continue; @@ -1439,7 +1439,7 @@ struct GGMPlayerState *GGM_GetState( const char *uid, const char *name ) { struct GGMPlayerState *pState; struct GGMLogin *pLogin = GGM_LoadLogin( uid, name ); - char *rgpszBadNames[] = { + const char *rgpszBadNames[] = { "player*", // does not even can set own name "*talat*", "*hmse*", @@ -1739,7 +1739,7 @@ bool GGM_PlayerSpawn( CBasePlayer *pPlayer ) return true; } - if( ( mp_coop.value || mp_spectator.value ) && pPlayer->m_ggm.iState == STATE_CONNECTED || !pPlayer->m_ggm.pState ) + if( ( ( mp_coop.value || mp_spectator.value ) && pPlayer->m_ggm.iState == STATE_CONNECTED ) || !pPlayer->m_ggm.pState ) { if( !pPlayer->m_ggm.pState ) GGM_ChatPrintf( pPlayer, "This nickname busy! Please login or change nickname\n" ); @@ -2640,7 +2640,7 @@ bool GGM_MenuCommand( CBasePlayer *player, const char *name ) GGM_PlayerMenu &m = player->m_ggm.menu.New( buf ); - while( pFile = GGM::COM_ParseFile( pFile, buf ) ) + while( ( pFile = GGM::COM_ParseFile( pFile, buf ) ) ) { char cmd[256]; if( !(pFile = GGM::COM_ParseFile( pFile, cmd )) ) @@ -3018,7 +3018,7 @@ void SET_MODEL( edict_t *e, const char *model ) { int index = g_engfuncs.pfnPrecacheModel(model); model_t *mod = (model_t*)g_physfuncs.pfnGetModel(index); - if( !mod || mod->type == mod_brush && !mod->nodes ) + if( !mod || ( mod->type == mod_brush && !mod->nodes ) ) g_engfuncs.pfnSetModel( e, mp_errormdlpath.string ); ALERT( at_console, "SET_MODEL %s %d\n", model, e->v.modelindex ); diff --git a/dlls/player.cpp b/dlls/player.cpp index 1946a7ef..6932239a 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -2849,7 +2849,7 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) if( mp_coop.value || FStringNull( gpGlobals->startspot ) || !strlen(STRING( gpGlobals->startspot ) ) ) { pSpot = NULL; - while( pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_start" ) ) + while( ( pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_start" ) ) ) { TraceResult tr; if( FNullEnt( pSpot ) ) diff --git a/dlls/player.h b/dlls/player.h index c7716cbd..fb69c333 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -217,7 +217,7 @@ public: virtual void StartSneaking( void ) { m_tSneaking = gpGlobals->time - 1; } virtual void StopSneaking( void ) { m_tSneaking = gpGlobals->time + 30; } virtual BOOL IsSneaking( void ) { return m_tSneaking <= gpGlobals->time; } - virtual BOOL IsAlive( void ) { return (pev->deadflag == DEAD_NO) && pev->health > 0 || ( pev->flags & FL_SPECTATOR ); } + virtual BOOL IsAlive( void ) { return ( ( pev->deadflag == DEAD_NO ) && pev->health > 0 ) || ( pev->flags & FL_SPECTATOR ); } virtual BOOL ShouldFadeOnDeath( void ) { return FALSE; } virtual BOOL IsPlayer( void ) { return !( pev->flags & FL_SPECTATOR ); } // Spectators should return FALSE for this, they aren't "players" as far as game logic is concerned diff --git a/dlls/prop.cpp b/dlls/prop.cpp index e91f8f75..c81a6fd1 100644 --- a/dlls/prop.cpp +++ b/dlls/prop.cpp @@ -439,7 +439,7 @@ void CProp::DamageSound( void ) { int pitch; float fvol; - char *rgpsz[6]; + const char *rgpsz[6]; int i = 0; int material = m_Material; diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index b7de4069..053776a0 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1465,7 +1465,7 @@ void CChangeLevel::UseChangeLevel( CBaseEntity *pActivator, CBaseEntity *pCaller { // if not activated by touch, do not count players m_coopData.fUsed = true; - if( pCaller && FClassnameIs( pCaller->edict(), "multi_manager" ) || FClassnameIs( pCaller->edict(), "trigger_once" ) ) + if( ( pCaller && FClassnameIs( pCaller->edict(), "multi_manager" ) ) || FClassnameIs( pCaller->edict(), "trigger_once" ) ) m_coopData.fSkipSpawnCheck = true; else m_coopData.fSkipSpawnCheck = false; @@ -1729,7 +1729,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) ALERT( at_console, "There are %d players in transition volume %s\n", count, m_szLandmarkName ); } - else if( ( (gpGlobals->time -((CBasePlayer*)pPlayer)->m_ggm.flSpawnTime ) < 30 ) && FindTriggerTransition( m_szLandmarkName ) || !InTransitionVolume( pPlayer, m_szLandmarkName ) ) + else if( ( ( (gpGlobals->time -((CBasePlayer*)pPlayer)->m_ggm.flSpawnTime ) < 30 ) && FindTriggerTransition( m_szLandmarkName ) ) || !InTransitionVolume( pPlayer, m_szLandmarkName ) ) { if( !m_coopData.fSkipSpawnCheck ) { @@ -2596,7 +2596,7 @@ void CTriggerCamera::CoopThink() } // Nothing to look at! - if( m_hTarget == NULL ) + if( m_hTarget == 0 ) { return; } @@ -2798,10 +2798,10 @@ void CTriggerCamera::FollowTarget() void CTriggerCamera::CoopFollowTarget() { -// if( m_hPlayer == NULL ) +// if( m_hPlayer == 0 ) // return; - if( m_hTarget == NULL || m_flReturnTime < gpGlobals->time ) + if( m_hTarget == 0 || m_flReturnTime < gpGlobals->time ) { for( int i = 1; i <= gpGlobals->maxClients; i++ ) { diff --git a/dlls/util.cpp b/dlls/util.cpp index d98d37e9..88329f94 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -1113,12 +1113,12 @@ void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color, Vector delta = origin - pPlayer->edict()->v.origin; float dist = 0; - if( abs(delta.x) > dist ) - dist = abs(delta.x); - if( abs(delta.y) > dist ) - dist = abs(delta.y); - if( abs(delta.z) > dist ) - dist = abs(delta.z); + if( fabs(delta.x) > dist ) + dist = fabs(delta.x); + if( fabs(delta.y) > dist ) + dist = fabs(delta.y); + if( fabs(delta.z) > dist ) + dist = fabs(delta.z); if( dist > mp_maxtentdist.value) continue; @@ -1183,12 +1183,12 @@ void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, Vector delta = origin - pPlayer->edict()->v.origin; float dist = 0; - if( abs(delta.x) > dist ) - dist = abs(delta.x); - if( abs(delta.y) > dist ) - dist = abs(delta.y); - if( abs(delta.z) > dist ) - dist = abs(delta.z); + if( fabs(delta.x) > dist ) + dist = fabs(delta.x); + if( fabs(delta.y) > dist ) + dist = fabs(delta.y); + if( fabs(delta.z) > dist ) + dist = fabs(delta.z); if( dist > mp_maxtentdist.value) continue; @@ -1303,12 +1303,12 @@ void UTIL_DecalTrace( TraceResult *pTrace, int decalNumber ) Vector delta = pTrace->vecEndPos - pPlayer->edict()->v.origin; float dist = 0; - if( abs(delta.x) > dist ) - dist = abs(delta.x); - if( abs(delta.y) > dist ) - dist = abs(delta.y); - if( abs(delta.z) > dist ) - dist = abs(delta.z); + if( fabs(delta.x) > dist ) + dist = fabs(delta.x); + if( fabs(delta.y) > dist ) + dist = fabs(delta.y); + if( fabs(delta.z) > dist ) + dist = fabs(delta.z); if( dist > mp_maxtentdist.value) continue; @@ -1380,12 +1380,12 @@ void UTIL_PlayerDecalTrace( TraceResult *pTrace, int playernum, int decalNumber, Vector delta = pTrace->vecEndPos - pPlayer->edict()->v.origin; float dist = 0; - if( abs(delta.x) > dist ) - dist = abs(delta.x); - if( abs(delta.y) > dist ) - dist = abs(delta.y); - if( abs(delta.z) > dist ) - dist = abs(delta.z); + if( fabs(delta.x) > dist ) + dist = fabs(delta.x); + if( fabs(delta.y) > dist ) + dist = fabs(delta.y); + if( fabs(delta.z) > dist ) + dist = fabs(delta.z); if( dist > mp_maxtentdist.value) continue; @@ -1441,12 +1441,12 @@ void UTIL_GunshotDecalTrace( TraceResult *pTrace, int decalNumber ) Vector delta = pTrace->vecEndPos - pPlayer->edict()->v.origin; float dist = 0; - if( abs(delta.x) > dist ) - dist = abs(delta.x); - if( abs(delta.y) > dist ) - dist = abs(delta.y); - if( abs(delta.z) > dist ) - dist = abs(delta.z); + if( fabs(delta.x) > dist ) + dist = fabs(delta.x); + if( fabs(delta.y) > dist ) + dist = fabs(delta.y); + if( fabs(delta.z) > dist ) + dist = fabs(delta.z); if( dist > mp_maxtentdist.value) continue; @@ -1488,12 +1488,12 @@ void UTIL_Sparks( const Vector &position ) Vector delta = position - pPlayer->edict()->v.origin; float dist = 0; - if( abs(delta.x) > dist ) - dist = abs(delta.x); - if( abs(delta.y) > dist ) - dist = abs(delta.y); - if( abs(delta.z) > dist ) - dist = abs(delta.z); + if( fabs(delta.x) > dist ) + dist = fabs(delta.x); + if( fabs(delta.y) > dist ) + dist = fabs(delta.y); + if( fabs(delta.z) > dist ) + dist = fabs(delta.z); if( dist > mp_maxtentdist.value) continue; @@ -1530,12 +1530,12 @@ void UTIL_Ricochet( const Vector &position, float scale ) Vector delta = position - pPlayer->edict()->v.origin; float dist = 0; - if( abs(delta.x) > dist ) - dist = abs(delta.x); - if( abs(delta.y) > dist ) - dist = abs(delta.y); - if( abs(delta.z) > dist ) - dist = abs(delta.z); + if( fabs(delta.x) > dist ) + dist = fabs(delta.x); + if( fabs(delta.y) > dist ) + dist = fabs(delta.y); + if( fabs(delta.z) > dist ) + dist = fabs(delta.z); if( dist > mp_maxtentdist.value) continue; diff --git a/dlls/weapons.h b/dlls/weapons.h index 5002a95a..ebc8203a 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -484,7 +484,7 @@ public: }*/ return 200; } - int ObjectCaps( void ) { return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION | FCAP_DONT_SAVE; } + int ObjectCaps( void ) { return ( CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION ) | FCAP_DONT_SAVE; } }; #ifdef CLIENT_DLL