From 60d4ebc06b4337d61b3ce730c5720a390238d818 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Fri, 30 Jun 2023 17:32:39 -0400 Subject: [PATCH] showDroidSensorRanges: Throttle updates --- src/display3d.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/display3d.cpp b/src/display3d.cpp index 75add4c0ff0..929bfd68c5b 100644 --- a/src/display3d.cpp +++ b/src/display3d.cpp @@ -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) { @@ -4033,6 +4036,8 @@ static void showDroidSensorRanges() showSensorRange2((BASE_OBJECT *)psStruct); } } + + lastRangeUpdateTime = graphicsTime; }//end if we want to display... }