From decce7905bc318e96daf966b174afe4f0fd0a7f4 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 24 Mar 2020 22:55:25 -0500 Subject: [PATCH] Moved LUAh_GameQuit(void) function to the end of the lua_hooklib.c --- src/lua_hooklib.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index f4860f85a..88f1b291d 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1663,29 +1663,6 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend) } #endif // SEENAMES -// Hook for game quitting -void LUAh_GameQuit(void) -{ - hook_p hookp; - if (!gL || !(hooksAvailable[hook_GameQuit/8] & (1<<(hook_GameQuit%8)))) - return; - - for (hookp = roothook; hookp; hookp = hookp->next) - { - if (hookp->type != hook_GameQuit) - continue; - - lua_pushfstring(gL, FMT_HOOKID, hookp->id); - lua_gettable(gL, LUA_REGISTRYINDEX); - if (lua_pcall(gL, 0, 0, 0)) { - if (!hookp->error || cv_debug & DBG_LUA) - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); - lua_pop(gL, 1); - hookp->error = true; - } - } -} - boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname) { hook_p hookp; @@ -1727,4 +1704,27 @@ boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname) hud_running = false; return keepplaying; +} + +// Hook for game quitting +void LUAh_GameQuit(void) +{ + hook_p hookp; + if (!gL || !(hooksAvailable[hook_GameQuit/8] & (1<<(hook_GameQuit%8)))) + return; + + for (hookp = roothook; hookp; hookp = hookp->next) + { + if (hookp->type != hook_GameQuit) + continue; + + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + if (lua_pcall(gL, 0, 0, 0)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + } + } } \ No newline at end of file