From c0372cccd154736bdbced3511420be4e8c9dfbde Mon Sep 17 00:00:00 2001 From: Flugente Date: Tue, 7 May 2013 00:05:24 +0000 Subject: [PATCH] speed up handling of personal light git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6068 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Soldier Control.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 8079c9d9..c5d819b9 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -16284,12 +16284,17 @@ void SOLDIERTYPE::HandleFlashLights() if ( !NightTime() && !gbWorldSectorZ ) return; + // take note of wether we changed light + BOOLEAN fLightChanged = FALSE; + // remove existing lights we 'own' if ( this->bSoldierFlagMask & SOLDIER_LIGHT_OWNER ) { RemovePersonalLights( this->ubID ); this->bSoldierFlagMask &= ~SOLDIER_LIGHT_OWNER; + + fLightChanged = TRUE; } // not possible to get this bonus on a roof, due to our lighting system @@ -16360,13 +16365,18 @@ void SOLDIERTYPE::HandleFlashLights() // take note: we own a light source this->bSoldierFlagMask |= SOLDIER_LIGHT_OWNER; + + fLightChanged = TRUE; } } - // refresh sight for everybody - AllTeamsLookForAll( TRUE ); + if ( fLightChanged ) + { + // refresh sight for everybody + AllTeamsLookForAll( TRUE ); - SetRenderFlags(RENDER_FLAG_FULL); + SetRenderFlags(RENDER_FLAG_FULL); + } } UINT8 SOLDIERTYPE::GetBestEquippedFlashLightRange()