Clean up all program close paths to use VVV_exit()

Wow, there are a lot of these. All of these exit paths now use
VVV_exit() instead, which attempts to save unlock.vvv and settings.vvv,
and also frees all resources so Valgrind is happy. This is a good thing,
because previously unlock.vvv/settings.vvv wouldn't be written to if we
decided to bail for a given reason.
This commit is contained in:
Misa
2021-02-15 18:53:17 -08:00
committed by Ethan Lee
parent de1e773b7f
commit 8aa5bb8aab
4 changed files with 12 additions and 13 deletions

View File

@@ -4,6 +4,7 @@
#include "editor.h"
#include "Enums.h"
#include "Entity.h"
#include "Exit.h"
#include "FileSystemUtils.h"
#include "Game.h"
#include "Graphics.h"
@@ -93,7 +94,7 @@ int main(int argc, char *argv[])
else \
{ \
printf("%s option requires one argument.\n", argv[i]); \
return 1; \
VVV_exit(1); \
}
if (ARG("-renderer"))
@@ -156,14 +157,14 @@ int main(int argc, char *argv[])
else
{
printf("Error: invalid option: %s\n", argv[i]);
return 1;
VVV_exit(1);
}
}
if(!FILESYSTEM_init(argv[0], baseDir, assetsPath))
{
puts("Unable to initialize filesystem!");
return 1;
VVV_exit(1);
}
SDL_Init(
@@ -311,7 +312,7 @@ int main(int argc, char *argv[])
ed.ListOfMetaData.push_back(meta);
} else {
printf("Level not found\n");
return 1;
VVV_exit(1);
}
}