Skip to content

Commit 17db253

Browse files
committed
refactor(server): misc minor renames and changes to appease compiler
move type into for rename filter.GetRecipientCount rename RGB -> RGBnext rename for loop i -> j rename KeyValues fix i visiblity remove unused attackerTeam rename index -> iIndex rename pPRecipient rename mass -> massHeld remove unused result of V_snprintf inline fPhysObjectMass rename pPlayer -> pPClient inline count fix sit visibility (while -> for) inline dir rename te -> tempEntity rename pTartget -> pTarget2 rename a -> ia rename inc -> incAdj rename color -> blockedColor move x declaration inside scopes where it is used rename hFunc -> hScopedFunc rename value -> position rename ptag -> ptagOriginal rename flGain rename origin/angles -> shadowOrigin/shadowAngles rename origin -> hanging_origin rename args -> scriptArgs rename taskID -> taskID2 rename goal -> lateralCoverGoal add comment for coverGoal remove second compute flTotalDist suppress warning p4 hides global declaration
1 parent 0ea8f14 commit 17db253

28 files changed

Lines changed: 116 additions & 126 deletions

src/game/server/EventLog.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,7 @@ bool CEventLog::PrintPlayerEvent( IGameEvent *event )
193193

194194
CBasePlayer *pAttacker = UTIL_PlayerByUserId( attackerid );
195195
CTeam *team = pPlayer->GetTeam();
196-
CTeam *attackerTeam = NULL;
197-
198-
if ( pAttacker )
199-
{
200-
attackerTeam = pAttacker->GetTeam();
201-
}
196+
202197
if ( pPlayer == pAttacker && pPlayer )
203198
{
204199

src/game/server/ai_baseactor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,14 @@ bool CAI_BaseActor::StartSceneEvent( CSceneEventInfo *info, CChoreoScene *scene,
294294
}
295295
else if (stricmp( event->GetParameters(), "AI_IGNORECOLLISION") == 0)
296296
{
297-
CBaseEntity *pTarget = FindNamedEntity( event->GetParameters2( ) );
297+
CBaseEntity *pTarget2 = FindNamedEntity( event->GetParameters2( ) );
298298

299-
if (pTarget)
299+
if (pTarget2)
300300
{
301301
info->m_nType = SCENE_AI_IGNORECOLLISION;
302-
info->m_hTarget = pTarget;
302+
info->m_hTarget = pTarget2;
303303
float remaining = event->GetEndTime() - scene->GetTime();
304-
NPCPhysics_CreateSolver( this, pTarget, true, remaining );
304+
NPCPhysics_CreateSolver( this, pTarget2, true, remaining );
305305
info->m_flNext = gpGlobals->curtime + remaining;
306306
return true;
307307
}

src/game/server/ai_basenpc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12158,9 +12158,9 @@ bool CAI_BaseNPC::CineCleanup()
1215812158
}
1215912159
else if ( drop == 0 ) // Hanging in air?
1216012160
{
12161-
Vector origin = GetLocalOrigin();
12162-
origin.z = new_origin.z;
12163-
SetLocalOrigin( origin );
12161+
Vector hanging_origin = GetLocalOrigin();
12162+
hanging_origin.z = new_origin.z;
12163+
SetLocalOrigin( hanging_origin );
1216412164
SetGroundEntity( NULL );
1216512165
}
1216612166
}

src/game/server/ai_basenpc_schedule.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,8 +2146,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
21462146

21472147
if ( GetTacticalServices()->FindLateralCover( pEntity->EyePosition(), 0, &coverPos ) )
21482148
{
2149-
AI_NavGoal_t goal( coverPos, ACT_RUN );
2150-
GetNavigator()->SetGoal( goal, AIN_CLEAR_PREVIOUS_STATE );
2149+
AI_NavGoal_t lateralCoverGoal( coverPos, ACT_RUN );
2150+
GetNavigator()->SetGoal( lateralCoverGoal, AIN_CLEAR_PREVIOUS_STATE );
21512151

21522152
//FIXME: What exactly is this doing internally?
21532153
m_flMoveWaitFinished = gpGlobals->curtime + pTask->flTaskData;
@@ -2166,7 +2166,8 @@ void CAI_BaseNPC::StartTask( const Task_t *pTask )
21662166
AIN_HULL_TOLERANCE,
21672167
AIN_DEF_FLAGS,
21682168
m_hStoredPathTarget );
2169-
2169+
2170+
// TODO: is this a bug? why goal and not coverGoal?
21702171
foundPath = GetNavigator()->SetGoal( goal );
21712172

21722173
m_flMoveWaitFinished = gpGlobals->curtime + pTask->flTaskData;

src/game/server/ai_navigator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4262,8 +4262,8 @@ void CAI_Navigator::DrawDebugRouteOverlay(void)
42624262

42634263
if (waypoint->GetNext())
42644264
{
4265-
Vector RGB = GetRouteColor(waypoint->GetNext()->NavType(), waypoint->GetNext()->Flags());
4266-
NDebugOverlay::Line(waypoint->GetPos(), waypoint->GetNext()->GetPos(),RGB[0],RGB[1],RGB[2], true,0);
4265+
Vector RGBnext = GetRouteColor(waypoint->GetNext()->NavType(), waypoint->GetNext()->Flags());
4266+
NDebugOverlay::Line(waypoint->GetPos(), waypoint->GetNext()->GetPos(),RGBnext[0],RGBnext[1],RGBnext[2], true,0);
42674267
}
42684268
waypoint = waypoint->GetNext();
42694269
}

src/game/server/ai_pathfinder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -929,13 +929,13 @@ AI_Waypoint_t *CAI_Pathfinder::BuildSimpleRoute( Navigation_t navType, const Vec
929929
//-----------------------------------------------------------------------------
930930
// Builds a complex route (triangulation, making way)
931931
//-----------------------------------------------------------------------------
932-
AI_Waypoint_t *CAI_Pathfinder::BuildComplexRoute( Navigation_t navType, const Vector &vStart,
932+
AI_Waypoint_t *CAI_Pathfinder::BuildComplexRoute( const Navigation_t navType, const Vector &vStart,
933933
const Vector &vEnd, const CBaseEntity *pTarget, int endFlags, int nodeID,
934934
int buildFlags, float flYaw, float goalTolerance, float maxLocalNavDistance )
935935
{
936936
AI_PROFILE_SCOPE( CAI_Pathfinder_BuildComplexRoute );
937937

938-
float flTotalDist = ComputePathDistance( navType, vStart, vEnd );
938+
const float flTotalDist = ComputePathDistance( navType, vStart, vEnd );
939939
if ( flTotalDist < 0.0625 )
940940
{
941941
return new AI_Waypoint_t( vEnd, flYaw, navType, endFlags, nodeID );
@@ -980,7 +980,7 @@ AI_Waypoint_t *CAI_Pathfinder::BuildComplexRoute( Navigation_t navType, const Ve
980980
{
981981
if ( !UseStrongOptimizations() || ( GetOuter()->GetState() == NPC_STATE_SCRIPT || GetOuter()->IsCurSchedule( SCHED_SCENE_GENERIC, false ) ) )
982982
{
983-
float flTotalDist = ComputePathDistance( navType, vStart, vEnd );
983+
// float flTotalDist = ComputePathDistance( navType, vStart, vEnd ); // already calculated above
984984

985985
AI_Waypoint_t *triangRoute = BuildTriangulationRoute(vStart, vEnd, pTarget,
986986
endFlags, nodeID, flYaw, flTotalDist - moveTrace.flDistObstructed, navType);

src/game/server/ai_pathfinder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class CAI_Pathfinder : public CAI_Component
134134
const CBaseEntity *pTarget, int endFlags, int nodeID, int nodeTargetType, float flYaw);
135135

136136
// Builds a complex route (triangulation, making way)
137-
AI_Waypoint_t *BuildComplexRoute( Navigation_t navType, const Vector &vStart,
137+
AI_Waypoint_t *BuildComplexRoute( const Navigation_t navType, const Vector &vStart,
138138
const Vector &vEnd, const CBaseEntity *pTarget, int endFlags, int nodeID,
139139
int buildFlags, float flYaw, float goalTolerance, float maxLocalNavDistance );
140140

src/game/server/ai_schedule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ bool CAI_SchedulesManager::LoadSchedulesFromBuffer( const char *prefix, char *pS
287287
pfile = engine->ParseFile(pfile, token, sizeof( token ) );
288288

289289
// Convert generic ID to sub-class specific enum
290-
int taskID = CAI_BaseNPC::GetTaskID(token);
291-
tempTask[taskNum].flTaskData = (pIdSpace) ? pIdSpace->TaskGlobalToLocal(taskID) : AI_RemapFromGlobal( taskID );
290+
int taskID2 = CAI_BaseNPC::GetTaskID(token);
291+
tempTask[taskNum].flTaskData = (pIdSpace) ? pIdSpace->TaskGlobalToLocal(taskID2) : AI_RemapFromGlobal( taskID2 );
292292

293293
if (tempTask[taskNum].flTaskData == -1)
294294
{

src/game/server/ai_scriptconditions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,14 +537,14 @@ void CAI_ScriptConditions::EvaluationThink()
537537
m_hTarget.Get()
538538
};
539539

540-
for ( int i = 0; i < nEvaluators; ++i )
540+
for ( int j = 0; j < nEvaluators; ++j )
541541
{
542-
if ( !(this->*gm_Evaluators[i].pfnEvaluator)( args ) )
542+
if ( !(this->*gm_Evaluators[j].pfnEvaluator)( args ) )
543543
{
544544
pConditionElement->GetTimer()->Reset();
545545
result = false;
546546

547-
ScrCondDbgMsg( ( "%s failed on: %s\n", GetDebugName(), gm_Evaluators[ i ].pszName ) );
547+
ScrCondDbgMsg( ( "%s failed on: %s\n", GetDebugName(), gm_Evaluators[ j ].pszName ) );
548548

549549
break;
550550
}

src/game/server/ambientgeneric.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ void CAmbientGeneric::ComputeMaxAudibleDistance( )
185185

186186
// Sadly, there's no direct way of getting at this.
187187
// We have to do an interative computation.
188-
float flGain = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, m_radius );
189-
if ( flGain <= MIN_AUDIBLE_VOLUME )
188+
const float flGainMRadius = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, m_radius );
189+
if ( flGainMRadius <= MIN_AUDIBLE_VOLUME )
190190
{
191191
m_flMaxRadius = m_radius;
192192
return;
@@ -197,8 +197,8 @@ void CAmbientGeneric::ComputeMaxAudibleDistance( )
197197
while ( true )
198198
{
199199
// First, find a min + max range surrounding the desired distance gain
200-
float flGain = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, flMaxRadius );
201-
if ( flGain <= MIN_AUDIBLE_VOLUME )
200+
const float flGainMaxRadius = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, flMaxRadius );
201+
if ( flGainMaxRadius <= MIN_AUDIBLE_VOLUME )
202202
break;
203203

204204
// Always audible.
@@ -216,9 +216,9 @@ void CAmbientGeneric::ComputeMaxAudibleDistance( )
216216
int nInterations = 4;
217217
while ( --nInterations >= 0 )
218218
{
219-
float flTestRadius = (flMinRadius + flMaxRadius) * 0.5f;
220-
float flGain = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, flTestRadius );
221-
if ( flGain <= MIN_AUDIBLE_VOLUME )
219+
const float flTestRadius = (flMinRadius + flMaxRadius) * 0.5f;
220+
const float flGainTestRadius = enginesound->GetDistGainFromSoundLevel( m_iSoundLevel, flTestRadius );
221+
if ( flGainTestRadius <= MIN_AUDIBLE_VOLUME )
222222
{
223223
flMaxRadius = flTestRadius;
224224
}

0 commit comments

Comments
 (0)