1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-09 10:29:45 +01:00

Move assetdir off of Graphics

It's only used in FileSystemUtils and never anywhere else, especially
not Graphics. Why is this on Graphics again?

It's now a static variable inside FileSystemUtils. It has also been
renamed to assetDir for consistency with saveDir and levelDir. Also,
it's a C string now, and is no longer an STL string.
This commit is contained in:
Misa 2021-03-05 23:45:40 -08:00 committed by Ethan Lee
parent 22ced8b59b
commit b4dd516d7d
2 changed files with 8 additions and 7 deletions

View file

@ -26,6 +26,8 @@
static char saveDir[MAX_PATH] = {'\0'}; static char saveDir[MAX_PATH] = {'\0'};
static char levelDir[MAX_PATH] = {'\0'}; static char levelDir[MAX_PATH] = {'\0'};
static char assetDir[MAX_PATH] = {'\0'};
static void PLATFORM_getOSDirectory(char* output); static void PLATFORM_getOSDirectory(char* output);
static void PLATFORM_migrateSaveData(char* output); static void PLATFORM_migrateSaveData(char* output);
static void PLATFORM_copyFile(const char *oldLocation, const char *newLocation); static void PLATFORM_copyFile(const char *oldLocation, const char *newLocation);
@ -221,7 +223,7 @@ void FILESYSTEM_mount(const char *fname)
} }
else else
{ {
graphics.assetdir = std::string(path); SDL_strlcpy(assetDir, path, sizeof(assetDir));
} }
} }
@ -318,7 +320,7 @@ void FILESYSTEM_mountassets(const char* path)
} }
else else
{ {
graphics.assetdir = std::string(zip_data); SDL_strlcpy(assetDir, zip_data, sizeof(assetDir));
} }
FILESYSTEM_assetsmounted = true; FILESYSTEM_assetsmounted = true;
@ -345,11 +347,11 @@ void FILESYSTEM_mountassets(const char* path)
void FILESYSTEM_unmountassets(void) void FILESYSTEM_unmountassets(void)
{ {
if (graphics.assetdir != "") if (assetDir[0] != '\0')
{ {
printf("Unmounting %s\n", graphics.assetdir.c_str()); printf("Unmounting %s\n", assetDir);
PHYSFS_unmount(graphics.assetdir.c_str()); PHYSFS_unmount(assetDir);
graphics.assetdir = ""; assetDir[0] = '\0';
graphics.reloadresources(); graphics.reloadresources();
} }
else else

View file

@ -184,7 +184,6 @@ public:
bool onscreen(int t); bool onscreen(int t);
void reloadresources(void); void reloadresources(void);
std::string assetdir;
void menuoffrender(void); void menuoffrender(void);