Fixed a failure to properly delete save files when requested.

Also added removal of save files in the old (deprecated) format,
after re-saving in the current format.
This commit is contained in:
onpon4 2017-02-04 15:42:59 -05:00
parent b66d7c410d
commit 59db629f5f
2 changed files with 5 additions and 7 deletions

View File

@ -373,12 +373,6 @@ void engine_cleanup()
char filename[PATH_MAX]; char filename[PATH_MAX];
strcpy(filename, ""); strcpy(filename, "");
sprintf(filename, "%smusic.mod", engine.configDirectory);
remove(filename);
sprintf(filename, "%smusic.s3m", engine.configDirectory);
remove(filename);
#ifndef NOSOUND #ifndef NOSOUND
if (engine.useAudio) if (engine.useAudio)
{ {

View File

@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "gfx.h" #include "gfx.h"
#include "intermission.h" #include "intermission.h"
#include "player.h" #include "player.h"
#include "save.h"
#include "screen.h" #include "screen.h"
#include "weapons.h" #include "weapons.h"
@ -252,6 +253,9 @@ int save_load(int slot)
weapons[W_PLAYER_WEAPON].imageIndex[0] = SP_PLASMA_GREEN; weapons[W_PLAYER_WEAPON].imageIndex[0] = SP_PLASMA_GREEN;
weapons[W_PLAYER_WEAPON].imageIndex[1] = SP_PLASMA_GREEN; weapons[W_PLAYER_WEAPON].imageIndex[1] = SP_PLASMA_GREEN;
player = game.thePlayer; player = game.thePlayer;
save(slot);
remove(filename);
} }
// Re-init all the planets in this system... // Re-init all the planets in this system...
@ -457,7 +461,7 @@ int save_showSlots(SDL_Surface *savesSurface, int saveSlot, int x, int y)
x + 253, y + 265, 100, 25)) x + 253, y + 265, 100, 25))
{ {
char filename[PATH_MAX]; char filename[PATH_MAX];
sprintf(filename, "%ssave%.2d.dat", engine.configDirectory, sprintf(filename, "%ssave%.2d.sav", engine.configDirectory,
saveSlot); saveSlot);
remove(filename); remove(filename);
save_initSlots(); save_initSlots();