From 951e1653a61135bdebc07f1e9735aa74e3f2c2f2 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 15 Feb 2021 17:52:41 -0800 Subject: [PATCH] Move cleanup code to separate function I will need to re-use this code, so it's best that it not be copy-pasted. --- desktop_version/src/main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index a2e046be..83ef473b 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -76,6 +76,8 @@ static inline Uint32 get_framerate(const int slowdown) static void inline deltaloop(); static void inline fixedloop(); +static void cleanup(); + int main(int argc, char *argv[]) { char* baseDir = NULL; @@ -357,12 +359,16 @@ int main(int argc, char *argv[]) deltaloop(); } + cleanup(); + return 0; +} + +static void cleanup() +{ game.savestatsandsettings(); NETWORK_shutdown(); SDL_Quit(); FILESYSTEM_deinit(); - - return 0; } static void inline deltaloop()