From 5cf0bb1de9d321af77d420f019ccc9ec09fae304 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 22 Jul 2021 12:01:26 +0300 Subject: [PATCH] Split moveloop into preamble and core --- src/allmain.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/allmain.c b/src/allmain.c index d1fd65351..b37b5b03d 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -12,6 +12,8 @@ #include #endif +static void moveloop_preamble(boolean); +static void moveloop_core(void); #ifdef POSITIONBAR static void do_positionbar(void); #endif @@ -28,16 +30,9 @@ early_init(void) sys_early_init(); } -void -moveloop(boolean resuming) +static void +moveloop_preamble(boolean resuming) { -#if defined(MICRO) || defined(WIN32) - char ch; - int abort_lev; -#endif - int moveamt = 0, wtcap = 0, change = 0; - boolean monscanmove = FALSE; - /* if a save file created in normal mode is now being restored in explore mode, treat it as normal restore followed by 'X' command to use up the save file and require confirmation for explore mode */ @@ -88,6 +83,17 @@ moveloop(boolean resuming) invent is fully populated and the in_moveloop flag has been set */ if (iflags.perm_invent) update_inventory(); +} + +static void +moveloop_core(void) +{ +#if defined(MICRO) || defined(WIN32) + char ch; + int abort_lev; +#endif + int moveamt = 0, wtcap = 0, change = 0; + boolean monscanmove = FALSE; for (;;) { #ifdef SAFERHANGUP @@ -480,6 +486,13 @@ moveloop(boolean resuming) } } +void +moveloop(boolean resuming) +{ + moveloop_preamble(resuming); + moveloop_core(); +} + #define U_CAN_REGEN() (Regeneration || (Sleepy && u.usleep)) /* maybe recover some lost health (or lose some when an eel out of water) */