Skip to content

Commit

Permalink
showDroidSensorRanges: Throttle updates
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Jul 9, 2023
1 parent f843722 commit 60d4ebc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/display3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4011,12 +4011,15 @@ static void structureEffects()
/// Show the sensor ranges of selected droids and buildings
static void showDroidSensorRanges()
{
static uint32_t lastRangeUpdateTime = 0;

DROID *psDroid;
STRUCTURE *psStruct;

if (selectedPlayer >= MAX_PLAYERS) { return; /* no-op */ }

if (rangeOnScreen) // note, we still have to decide what to do with multiple units selected, since it will draw it for all of them! -Q 5-10-05
if (rangeOnScreen
&& (graphicsTime - lastRangeUpdateTime) >= 50) // note, we still have to decide what to do with multiple units selected, since it will draw it for all of them! -Q 5-10-05
{
for (psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext)
{
Expand All @@ -4033,6 +4036,8 @@ static void showDroidSensorRanges()
showSensorRange2((BASE_OBJECT *)psStruct);
}
}

lastRangeUpdateTime = graphicsTime;
}//end if we want to display...
}

Expand Down

0 comments on commit 60d4ebc

Please sign in to comment.