From de0250b07eaff6e794627005fade550a73ac2b69 Mon Sep 17 00:00:00 2001 From: Robert Alm Nilsson Date: Sun, 4 Oct 2020 14:02:41 +0200 Subject: [PATCH] Remove variable `frameloops` It was hard to understand what it meant and it was only used for determining whether the loop was in the first frame/iteration. Therefore I replaced it with variable `first_frame` which has a clearer purpose. --- src/engine/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/engine/main.cpp b/src/engine/main.cpp index f59f07213..0df3ee8af 100644 --- a/src/engine/main.cpp +++ b/src/engine/main.cpp @@ -808,7 +808,7 @@ void resetfps() fpspos = 0; } -void updatefps(int frames, int millis) +void updatefps(int millis) { fpshistory[fpspos++] = max(1, min(1000, millis)); if(fpspos >= MAXFPSHISTORY) fpspos = 0; @@ -1121,15 +1121,15 @@ int main(int argc, char **argv) blue_nebula_protocol_arg = NULL; } - for(int frameloops = 0; ; frameloops = frameloops >= INT_MAX-1 ? MAXFPSHISTORY+1 : frameloops+1) + for(bool first_frame = true; ; first_frame = false) { curtextscale = textscale; int elapsed = updatetimer(true); - updatefps(frameloops, elapsed); + updatefps(elapsed); checkinput(); menuprocess(); - if(frameloops) + if(!first_frame) { RUNWORLD("on_update"); game::updateworld(); @@ -1138,7 +1138,7 @@ int main(int argc, char **argv) checksleep(lastmillis); serverslice(); ircslice(); - if(frameloops) + if(!first_frame) { game::recomputecamera(screenw, screenh); hud::update(screenw, screenh);