diff --git a/src/game/game.c b/src/game/game.c index d72a28a..54cb641 100644 --- a/src/game/game.c +++ b/src/game/game.c @@ -502,10 +502,10 @@ void deleteSaveSlot(int slot) sprintf(path, "%s/%d", app.saveDir, slot); filenames = getFileList(path, &numFiles); - + for (i = 0 ; i < numFiles ; i++) { - sprintf(path, "%s/%d/%s", app.saveDir, i, filenames[i]); + sprintf(path, "%s/%d/%s", app.saveDir, slot, filenames[i]); if (!deleteFile(path)) { diff --git a/src/game/title.c b/src/game/title.c index 082a281..bf28590 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -323,6 +323,8 @@ static void doOK(void) saveSlot = game.saveSlot; + deleteSaveSlot(saveSlot); + stopMusic(); newGame(); diff --git a/src/game/title.h b/src/game/title.h index 47b45f8..27dcb9a 100644 --- a/src/game/title.h +++ b/src/game/title.h @@ -53,6 +53,7 @@ extern void setSelectedWidget(char *name, char *group); extern void showWidgetGroup(char *group); extern void startSectionTransition(void); extern void stopMusic(void); +extern void deleteSaveSlot(int slot); extern App app; extern Colors colors; diff --git a/src/system/io.c b/src/system/io.c index 80f5b81..9b50b6d 100644 --- a/src/system/io.c +++ b/src/system/io.c @@ -197,7 +197,7 @@ char **getFileList(const char *dir, int *count) int deleteFile(char *path) { - return unlink(path); + return unlink(path) == 0; } static int stringComparator(const void *a, const void *b)