mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-08 18:09:45 +01:00
Add error message if quicksave fails
This commit is contained in:
parent
5dbb90c7fd
commit
4ebf89e844
5 changed files with 29 additions and 20 deletions
|
@ -225,6 +225,7 @@ void Game::init(void)
|
|||
minutes = 0;
|
||||
hours = 0;
|
||||
gamesaved = false;
|
||||
gamesavefailed = false;
|
||||
savetime = "00:00";
|
||||
savearea = "nowhere";
|
||||
savetrinkets = 0;
|
||||
|
@ -5724,12 +5725,12 @@ bool Game::savetele()
|
|||
}
|
||||
|
||||
|
||||
void Game::savequick()
|
||||
bool Game::savequick()
|
||||
{
|
||||
if (map.custommode || inspecial())
|
||||
{
|
||||
//Don't trash save data!
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
tinyxml2::XMLDocument doc;
|
||||
|
@ -5740,16 +5741,14 @@ void Game::savequick()
|
|||
}
|
||||
quicksummary = writemaingamesave(doc);
|
||||
|
||||
if(FILESYSTEM_saveTiXml2Document("saves/qsave.vvv", doc))
|
||||
{
|
||||
printf("Game saved\n");
|
||||
}
|
||||
else
|
||||
if(!FILESYSTEM_saveTiXml2Document("saves/qsave.vvv", doc))
|
||||
{
|
||||
printf("Could Not Save game!\n");
|
||||
printf("Failed: %s%s\n", saveFilePath.c_str(), "qsave.vvv");
|
||||
return false;
|
||||
}
|
||||
|
||||
printf("Game saved\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns summary of save
|
||||
|
@ -5869,7 +5868,7 @@ std::string Game::writemaingamesave(tinyxml2::XMLDocument& doc)
|
|||
}
|
||||
|
||||
|
||||
void Game::customsavequick(std::string savfile)
|
||||
bool Game::customsavequick(std::string savfile)
|
||||
{
|
||||
const std::string levelfile = savfile.substr(7);
|
||||
|
||||
|
@ -5998,15 +5997,14 @@ void Game::customsavequick(std::string savfile)
|
|||
|
||||
customquicksummary = summary;
|
||||
|
||||
if(FILESYSTEM_saveTiXml2Document(("saves/"+levelfile+".vvv").c_str(), doc))
|
||||
{
|
||||
printf("Game saved\n");
|
||||
}
|
||||
else
|
||||
if(!FILESYSTEM_saveTiXml2Document(("saves/"+levelfile+".vvv").c_str(), doc))
|
||||
{
|
||||
printf("Could Not Save game!\n");
|
||||
printf("Failed: %s%s%s\n", saveFilePath.c_str(), levelfile.c_str(), ".vvv");
|
||||
return false;
|
||||
}
|
||||
printf("Game saved\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ public:
|
|||
|
||||
void resetgameclock();
|
||||
|
||||
void customsavequick(std::string savfile);
|
||||
void savequick();
|
||||
bool customsavequick(std::string savfile);
|
||||
bool savequick();
|
||||
|
||||
void gameclock();
|
||||
|
||||
|
@ -204,6 +204,7 @@ public:
|
|||
|
||||
int frames, seconds, minutes, hours;
|
||||
bool gamesaved;
|
||||
bool gamesavefailed;
|
||||
std::string savetime;
|
||||
std::string savearea;
|
||||
int savetrinkets;
|
||||
|
|
|
@ -2010,6 +2010,7 @@ void gameinput()
|
|||
//Quit menu, same conditions as in game menu
|
||||
game.gamestate = MAPMODE;
|
||||
game.gamesaved = false;
|
||||
game.gamesavefailed = false;
|
||||
graphics.resumegamemode = false;
|
||||
game.menupage = 20; // The Map Page
|
||||
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
||||
|
@ -2040,6 +2041,7 @@ void gameinput()
|
|||
map.cursordelay = 0;
|
||||
map.cursorstate = 0;
|
||||
game.gamesaved = false;
|
||||
game.gamesavefailed = false;
|
||||
graphics.resumegamemode = false;
|
||||
game.menupage = 0; // The Map Page
|
||||
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
||||
|
@ -2058,6 +2060,7 @@ void gameinput()
|
|||
//Quit menu, same conditions as in game menu
|
||||
game.gamestate = MAPMODE;
|
||||
game.gamesaved = false;
|
||||
game.gamesavefailed = false;
|
||||
graphics.resumegamemode = false;
|
||||
game.menupage = 30; // Pause screen
|
||||
|
||||
|
@ -2291,12 +2294,11 @@ void mapmenuactionpress()
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
if (!game.gamesaved && !game.inspecial())
|
||||
if (!game.gamesaved && !game.gamesavefailed && !game.inspecial())
|
||||
{
|
||||
game.flashlight = 5;
|
||||
game.screenshake = 10;
|
||||
music.playef(18);
|
||||
game.gamesaved = true;
|
||||
|
||||
game.savetime = game.timestring();
|
||||
game.savearea = map.currentarea(map.area(game.roomx, game.roomy));
|
||||
|
@ -2304,16 +2306,19 @@ void mapmenuactionpress()
|
|||
|
||||
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111) game.savearea = "The Ship";
|
||||
|
||||
bool success;
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
if(map.custommodeforreal)
|
||||
{
|
||||
game.customsavequick(ed.ListOfMetaData[game.playcustomlevel].filename);
|
||||
success = game.customsavequick(ed.ListOfMetaData[game.playcustomlevel].filename);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
game.savequick();
|
||||
success = game.savequick();
|
||||
}
|
||||
game.gamesaved = success;
|
||||
game.gamesavefailed = !success;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -2215,6 +2215,10 @@ void maprender()
|
|||
{
|
||||
graphics.Print(0, 115, "Cannot Save in Secret Lab", 146, 146, 180, true);
|
||||
}
|
||||
else if (game.gamesavefailed)
|
||||
{
|
||||
graphics.Print(0, 115, "ERROR: Could not save game!", 146, 146, 180, true);
|
||||
}
|
||||
else if (map.custommode)
|
||||
{
|
||||
if (game.gamesaved)
|
||||
|
|
|
@ -3614,6 +3614,7 @@ void scriptclass::hardreset()
|
|||
game.minutes = 0;
|
||||
game.hours = 0;
|
||||
game.gamesaved = false;
|
||||
game.gamesavefailed = false;
|
||||
game.savetime = "00:00";
|
||||
game.savearea = "nowhere";
|
||||
game.savetrinkets = 0;
|
||||
|
|
Loading…
Reference in a new issue