Skip to content

Commit b95042c

Browse files
committed
refactor: Move some code comments into correct scopes (#1551)
1 parent f6b8253 commit b95042c

File tree

12 files changed

+52
-30
lines changed

12 files changed

+52
-30
lines changed

Core/Libraries/Source/WWVegas/WWLib/FastAllocator.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,20 @@ class StackAllocator{
163163
T* pTArray = (T*)mTArray;
164164
const T* const pTArrayEnd = pTArray + nCount;
165165
while(pTArray < pTArrayEnd){
166-
new(pTArray)T; //Use the placement operator new. This simply calls the constructor
167-
++pTArray; //of T with 'this' set to the input address. Note that we don't put
168-
} //a '()' after the T this is because () causes trivial types like int
169-
} //and class* to be assigned zero/NULL. We don't want that.
166+
//Use the placement operator new. This simply calls the constructor
167+
//of T with 'this' set to the input address. Note that we don't put
168+
//a '()' after the T this is because () causes trivial types like int
169+
//and class* to be assigned zero/NULL. We don't want that.
170+
new(pTArray)T;
171+
++pTArray;
172+
}
173+
}
170174
return (T*)mTArray;
171-
} //Else the request is too big. So let's use (the slower) operator new.
175+
}
176+
//Else the request is too big. So let's use (the slower) operator new.
172177
return (mpTHeap = new T[nCount]); //The compiler will call the constructors here.
173-
} //Else we are being used. Let's be nice and allocate something anyway.
178+
}
179+
//Else we are being used. Let's be nice and allocate something anyway.
174180
return new T[nCount];
175181
}
176182

Generals/Code/GameEngine/Source/Common/GameLOD.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,10 @@ void GameLODManager::init(void)
288288
if ((Real)(m_numRAM)/(Real)(256*1024*1024) >= PROFILE_ERROR_LIMIT)
289289
m_memPassed=TRUE; //check if they have at least 256 MB
290290

291+
//find data needed to determine m_idealDetailLevel
291292
if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN || TheGlobalData->m_forceBenchmark)
292293
{
294+
//find equivalent CPU to unknown cpu.
293295
if (m_cpuType == XX || TheGlobalData->m_forceBenchmark)
294296
{
295297
//need to run the benchmark
@@ -335,8 +337,8 @@ void GameLODManager::init(void)
335337
}
336338
prof++;
337339
}
338-
} //finding equivalent CPU to unkown cpu.
339-
} //find data needed to determine m_idealDetailLevel
340+
}
341+
}
340342

341343
if (userSetDetail == STATIC_GAME_LOD_CUSTOM)
342344
{

Generals/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,12 +1265,13 @@ void TurretAIIdleState::resetIdleScan()
12651265
StateReturnType TurretAIIdleState::onEnter()
12661266
{
12671267
AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface();
1268+
// ai doesn't exist if the object was just created this frame.
12681269
if (ai)
12691270
{
12701271
ai->resetNextMoodCheckTime();
12711272
if (ai->friend_getTurretSync() == getTurretAI()->friend_getWhichTurret())
12721273
ai->friend_setTurretSync(TURRET_INVALID);
1273-
} // ai doesn't exist if the object was just created this frame.
1274+
}
12741275

12751276
resetIdleScan();
12761277

Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,17 +1658,19 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex)
16581658
else if( shroudedCells + foggedCells == m_coiInUseCount )
16591659
{
16601660
m_shroudedness[playerIndex] = OBJECTSHROUD_FOGGED; //object is visible but fogged.
1661-
if (m_object && m_ghostObject) //object does not exist for modules holding only GhostObjects
1661+
if (m_object && m_ghostObject)
16621662
{
1663+
//object does not exist for modules holding only GhostObjects
16631664
//fogged but may not be visible if faction unit or faction building that has not been seen before
16641665
Player *player=ThePlayerList->getNthPlayer(playerIndex);
16651666
if (player->getRelationship(m_object->getTeam()) == NEUTRAL)
16661667
{ //anything neutral that moves around will not be rendered inside fog.
16671668
if (!m_object->isKindOf(KINDOF_IMMOBILE))
16681669
m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED;
16691670
}
1670-
else //Not neutral
1671-
{ //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always
1671+
else
1672+
{ //Not neutral
1673+
//enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always
16721674
//shroued no matter what.
16731675
if (!(m_object->isKindOf(KINDOF_IMMOBILE) && m_everSeenByPlayer[playerIndex]) || m_object->isKindOf(KINDOF_MINE))
16741676
m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED;
@@ -1685,15 +1687,16 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex)
16851687
}
16861688
}
16871689
else if( shroudedCells == 0 && foggedCells == 0 )
1688-
{ //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings.
1690+
{ //no cell I use has anything
1691+
//Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings.
16891692
m_everSeenByPlayer[playerIndex] = true;
16901693
m_shroudedness[playerIndex] = OBJECTSHROUD_CLEAR;
16911694
if (m_ghostObject && m_shroudednessPrevious[playerIndex] == OBJECTSHROUD_FOGGED)
16921695
{ //object was previously fogged but now is visible so we no longer
16931696
//need a ghost object.
16941697
m_ghostObject->freeSnapShot(playerIndex);
16951698
}
1696-
} // no cell I use has anything
1699+
}
16971700
else
16981701
{ //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings.
16991702
m_everSeenByPlayer[playerIndex] = true;

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ void W3DInGameUI::init( void )
355355
// hide it for now
356356
motd->winHide( TRUE );
357357
358-
} // end if*/
359-
358+
} // end if
359+
*/
360360

361361
} // end init
362362

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ Try improving the fit to vertical surfaces like cliffs.
884884
} //while (mod)
885885
}//edges to flush
886886

887+
//there are some edges to render in pool.
887888
//draw the filled vertex buffers
888889
if (m_edgesToFlush >= 2)
889890
{
@@ -909,7 +910,7 @@ Try improving the fit to vertical surfaces like cliffs.
909910
}
910911
mod=mod->m_nextSystem;
911912
}
912-
} //there are some edges to render in pool.
913+
}
913914

914915
m_edgesToFlush=0; //reset count for next flush
915916
}

GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@ void GameLODManager::init(void)
290290
if ((Real)(m_numRAM)/(Real)(256*1024*1024) >= PROFILE_ERROR_LIMIT)
291291
m_memPassed=TRUE; //check if they have at least 256 MB
292292

293+
//find data needed to determine m_idealDetailLevel
293294
if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN || TheGlobalData->m_forceBenchmark)
294295
{
296+
//find equivalent CPU to unknown cpu.
295297
if (m_cpuType == XX || TheGlobalData->m_forceBenchmark)
296298
{
297299
//need to run the benchmark
@@ -337,8 +339,8 @@ void GameLODManager::init(void)
337339
}
338340
prof++;
339341
}
340-
} //finding equivalent CPU to unkown cpu.
341-
} //find data needed to determine m_idealDetailLevel
342+
}
343+
}
342344

343345
if (userSetDetail == STATIC_GAME_LOD_CUSTOM)
344346
{

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,12 +1287,13 @@ void TurretAIIdleState::resetIdleScan()
12871287
StateReturnType TurretAIIdleState::onEnter()
12881288
{
12891289
AIUpdateInterface *ai = getMachineOwner()->getAIUpdateInterface();
1290+
// ai doesn't exist if the object was just created this frame.
12901291
if (ai)
12911292
{
12921293
ai->resetNextMoodCheckTime();
12931294
if (ai->friend_getTurretSync() == getTurretAI()->friend_getWhichTurret())
12941295
ai->friend_setTurretSync(TURRET_INVALID);
1295-
} // ai doesn't exist if the object was just created this frame.
1296+
}
12961297

12971298
resetIdleScan();
12981299

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,17 +1662,19 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex)
16621662
else if( shroudedCells + foggedCells == m_coiInUseCount )
16631663
{
16641664
m_shroudedness[playerIndex] = OBJECTSHROUD_FOGGED; //object is visible but fogged.
1665-
if (m_object && m_ghostObject) //object does not exist for modules holding only GhostObjects
1665+
if (m_object && m_ghostObject)
16661666
{
1667+
//object does not exist for modules holding only GhostObjects
16671668
//fogged but may not be visible if faction unit or faction building that has not been seen before
16681669
Player *player=ThePlayerList->getNthPlayer(playerIndex);
16691670
if (player->getRelationship(m_object->getTeam()) == NEUTRAL)
16701671
{ //anything neutral that moves around will not be rendered inside fog.
16711672
if (!m_object->isKindOf(KINDOF_IMMOBILE))
16721673
m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED;
16731674
}
1674-
else //Not neutral
1675-
{ //enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always
1675+
else
1676+
{ //Not neutral
1677+
//enemy unit will always be shrouded unless it's a building that's already been seen by the player. Fogged Mines are also always
16761678
//shroued no matter what.
16771679
if (!(m_object->isKindOf(KINDOF_IMMOBILE) && m_everSeenByPlayer[playerIndex]) || m_object->isKindOf(KINDOF_MINE))
16781680
m_shroudedness[playerIndex] = OBJECTSHROUD_SHROUDED;
@@ -1689,15 +1691,16 @@ ObjectShroudStatus PartitionData::getShroudedStatus(Int playerIndex)
16891691
}
16901692
}
16911693
else if( shroudedCells == 0 && foggedCells == 0 )
1692-
{ //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings.
1694+
{ //no cell I use has anything
1695+
//Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings.
16931696
m_everSeenByPlayer[playerIndex] = true;
16941697
m_shroudedness[playerIndex] = OBJECTSHROUD_CLEAR;
16951698
if (m_ghostObject && m_shroudednessPrevious[playerIndex] == OBJECTSHROUD_FOGGED)
16961699
{ //object was previously fogged but now is visible so we no longer
16971700
//need a ghost object.
16981701
m_ghostObject->freeSnapShot(playerIndex);
16991702
}
1700-
} // no cell I use has anything
1703+
}
17011704
else
17021705
{ //Record that this object was seen by the player. This info will be used to show fogged enemy faction buildings.
17031706
m_everSeenByPlayer[playerIndex] = true;

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ void W3DInGameUI::init( void )
355355
// hide it for now
356356
motd->winHide( TRUE );
357357
358-
} // end if*/
359-
358+
} // end if
359+
*/
360360

361361
} // end init
362362

0 commit comments

Comments
 (0)