Skip to content

Commit 10a8356

Browse files
authored
[GEN][ZH] Remove unnecessary NULL pointer tests in InGameUI (#1092)
1 parent 1aa5077 commit 10a8356

File tree

2 files changed

+13
-29
lines changed

2 files changed

+13
-29
lines changed

Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5158,24 +5158,18 @@ void InGameUI::addWorldAnimation( Anim2DTemplate *animTemplate,
51585158
// ------------------------------------------------------------------------------------------------
51595159
void InGameUI::clearWorldAnimations( void )
51605160
{
5161-
WorldAnimationData *wad;
5162-
51635161
// iterate through all entries and delete the animation data
51645162
for( WorldAnimationListIterator it = m_worldAnimationList.begin();
51655163
it != m_worldAnimationList.end(); /*empty*/ )
51665164
{
51675165

5168-
wad = *it;
5169-
if( wad )
5170-
{
5166+
WorldAnimationData *wad = *it;
51715167

5172-
// delete the animation instance
5173-
deleteInstance(wad->m_anim);
5168+
// delete the animation instance
5169+
deleteInstance(wad->m_anim);
51745170

5175-
// delete the world animation data
5176-
delete wad;
5177-
5178-
} // end if
5171+
// delete the world animation data
5172+
delete wad;
51795173

51805174
it = m_worldAnimationList.erase( it );
51815175

@@ -5189,15 +5183,13 @@ static const UnsignedInt FRAMES_BEFORE_EXPIRE_TO_FADE = LOGICFRAMES_PER_SECOND *
51895183
// ------------------------------------------------------------------------------------------------
51905184
void InGameUI::updateAndDrawWorldAnimations( void )
51915185
{
5192-
WorldAnimationData *wad;
5193-
51945186
// go through all animations
51955187
for( WorldAnimationListIterator it = m_worldAnimationList.begin();
51965188
it != m_worldAnimationList.end(); /*empty*/ )
51975189
{
51985190

51995191
// get data
5200-
wad = *it;
5192+
WorldAnimationData *wad = *it;
52015193

52025194
// update portion ... only when the game is in motion
52035195
if( TheGameLogic->isGamePaused() == FALSE )

GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5330,24 +5330,18 @@ void InGameUI::addWorldAnimation( Anim2DTemplate *animTemplate,
53305330
// ------------------------------------------------------------------------------------------------
53315331
void InGameUI::clearWorldAnimations( void )
53325332
{
5333-
WorldAnimationData *wad;
5334-
53355333
// iterate through all entries and delete the animation data
53365334
for( WorldAnimationListIterator it = m_worldAnimationList.begin();
53375335
it != m_worldAnimationList.end(); /*empty*/ )
53385336
{
53395337

5340-
wad = *it;
5341-
if( wad )
5342-
{
5338+
WorldAnimationData *wad = *it;
53435339

5344-
// delete the animation instance
5345-
deleteInstance(wad->m_anim);
5340+
// delete the animation instance
5341+
deleteInstance(wad->m_anim);
53465342

5347-
// delete the world animation data
5348-
delete wad;
5349-
5350-
} // end if
5343+
// delete the world animation data
5344+
delete wad;
53515345

53525346
it = m_worldAnimationList.erase( it );
53535347

@@ -5361,18 +5355,16 @@ static const UnsignedInt FRAMES_BEFORE_EXPIRE_TO_FADE = LOGICFRAMES_PER_SECOND *
53615355
// ------------------------------------------------------------------------------------------------
53625356
void InGameUI::updateAndDrawWorldAnimations( void )
53635357
{
5364-
WorldAnimationData *wad;
5365-
53665358
// go through all animations
53675359
for( WorldAnimationListIterator it = m_worldAnimationList.begin();
53685360
it != m_worldAnimationList.end(); /*empty*/ )
53695361
{
53705362

53715363
// get data
5372-
wad = *it;
5364+
WorldAnimationData *wad = *it;
53735365

53745366
// update portion ... only when the game is in motion
5375-
if( wad && TheGameLogic->isGamePaused() == FALSE )
5367+
if( TheGameLogic->isGamePaused() == FALSE )
53765368
{
53775369

53785370
//

0 commit comments

Comments
 (0)