diff options
author | ptitSeb | 2017-12-02 10:54:29 +0100 |
---|---|---|
committer | ptitSeb | 2017-12-02 10:54:29 +0100 |
commit | ba427aba2f50a9ec34befc8369af8e9f71758554 (patch) | |
tree | 77da1ab67d519aceb5760819d46228c17e14e8f1 /src | |
parent | 4b443304b7a5f74856acb9459be31bc7fc56be4a (diff) | |
download | hydracastlelabyrinth-ba427aba2f50a9ec34befc8369af8e9f71758554.tar.gz hydracastlelabyrinth-ba427aba2f50a9ec34befc8369af8e9f71758554.tar.bz2 hydracastlelabyrinth-ba427aba2f50a9ec34befc8369af8e9f71758554.zip |
Fixed save that was not working
Diffstat (limited to 'src')
-rw-r--r-- | src/game.c | 15 | ||||
-rw-r--r-- | src/game.h | 9 | ||||
-rw-r--r-- | src/titlescreen.c | 8 |
3 files changed, 18 insertions, 14 deletions
@@ -62,8 +62,7 @@ int screenX = 5, #ifdef _SDL char savename[4096]; -#else -#define savename "data/save.tmp" +char savemap[4096]; #endif void game() @@ -74,9 +73,12 @@ void game() { strcpy(savename, home); strcat(savename, "/.hydracastlelabyrinth/"); + strcpy(savemap, savename); strcat(savename, "save.tmp"); + strcat(savemap, "save.map"); } else { strcpy(savename, "data/save.tmp"); + strcpy(savemap, savemap); } #endif //Setup services @@ -109,8 +111,8 @@ void game() { if (fileExists(savename) == 1) { loadSave(savename); - }else if (fileExists("map/018.map") == 1) { - loadSave("map/018.map"); + }else if (fileExists(savemap) == 1) { + loadSave(savemap); } } @@ -635,7 +637,7 @@ void saveScreen() PHL_EndDrawing(); } - if (writeSave("map/018.map") == 1) + if (writeSave(savemap) == 1) { if (fileExists(savename)) { @@ -1405,7 +1407,7 @@ int writeSave(char* fname) //mkdir("data"); FILE* f; - char fullPath[128]; + char fullPath[4096]; strcpy(fullPath, ""); #ifdef _3DS strcat(fullPath, "sdmc:/3ds/appdata/HydraCastleLabyrinth/"); @@ -1478,7 +1480,6 @@ int writeSave(char* fname) fclose(f); } - return result; } @@ -177,6 +177,15 @@ Platform* platforms[MAX_PLATFORMS]; #define sndWater01 41 #define sndWolf01 42 +#ifdef _SDL +extern char savename[4096]; +extern char savemap[4096]; +#else +#define savename "data/save.tmp" +#define savemap "map/018.map" +#endif + + void loadResources(); void freeResources(); diff --git a/src/titlescreen.c b/src/titlescreen.c index 4369ac4..328dd8f 100644 --- a/src/titlescreen.c +++ b/src/titlescreen.c @@ -6,12 +6,6 @@ int tempsave = 0; int cursor = 0; -#ifdef _SDL -extern char savename[4096]; -#else -#define savename "data/save.tmp" -#endif - void titleScreenSetup(); int titleScreenStep(); @@ -54,7 +48,7 @@ void titleScreenSetup() cursor = 0; //Move cursor if save file exists - if ( fileExists("map/018.map") ) { + if ( fileExists(savemap) ) { cursor = 1; } |