Skip to content

Commit 0584122

Browse files
committed
[GEN][ZH] Remove unnecessary NULL pointer tests in InGameUI
1 parent ef5fea1 commit 0584122

File tree

2 files changed

+17
-31
lines changed

2 files changed

+17
-31
lines changed

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

Lines changed: 8 additions & 15 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-
{
5171-
5172-
// delete the animation instance
5173-
deleteInstance(wad->m_anim);
5166+
WorldAnimationData *wad = *it;
51745167

5175-
// delete the world animation data
5176-
delete wad;
5168+
// delete the animation instance
5169+
deleteInstance(wad->m_anim);
51775170

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 )
@@ -5525,9 +5517,10 @@ WindowMsgHandledType IdleWorkerSystem( GameWindow *window, UnsignedInt msg,
55255517
//---------------------------------------------------------------------------------------------
55265518
case GWM_INPUT_FOCUS:
55275519
{
5528-
// if we're givin the opportunity to take the keyboard focus we must say we don't want it
5520+
// if we're given the opportunity to take the keyboard focus we must say we don't want it
55295521
if( mData1 == TRUE )
55305522
*(Bool *)mData2 = FALSE;
5523+
break;
55315524
}
55325525
//---------------------------------------------------------------------------------------------
55335526
case GBM_SELECTED:

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

Lines changed: 9 additions & 16 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-
{
5343-
5344-
// delete the animation instance
5345-
deleteInstance(wad->m_anim);
5338+
WorldAnimationData *wad = *it;
53465339

5347-
// delete the world animation data
5348-
delete wad;
5340+
// delete the animation instance
5341+
deleteInstance(wad->m_anim);
53495342

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
//
@@ -5697,9 +5689,10 @@ WindowMsgHandledType IdleWorkerSystem( GameWindow *window, UnsignedInt msg,
56975689
//---------------------------------------------------------------------------------------------
56985690
case GWM_INPUT_FOCUS:
56995691
{
5700-
// if we're givin the opportunity to take the keyboard focus we must say we don't want it
5692+
// if we're given the opportunity to take the keyboard focus we must say we don't want it
57015693
if( mData1 == TRUE )
57025694
*(Bool *)mData2 = FALSE;
5695+
break;
57035696
}
57045697
//---------------------------------------------------------------------------------------------
57055698
case GBM_SELECTED:

0 commit comments

Comments
 (0)