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

Add error message if telesave fails

At least, whenever it would say "Game Saved", it now instead gives an
error message if saving is not successful.
This commit is contained in:
Dav999-v 2020-11-04 02:58:38 +01:00 committed by Ethan Lee
parent 4570140a6a
commit 5dbb90c7fd
3 changed files with 15 additions and 18 deletions

View file

@ -1918,16 +1918,15 @@ void Game::updatestate()
} }
else else
{ {
savetele(); if (savetele())
if (graphics.flipmode)
{ {
graphics.createtextbox(" Game Saved ", -1, 202, 174, 174, 174); graphics.createtextbox(" Game Saved ", -1, graphics.flipmode ? 202 : 12, 174, 174, 174);
graphics.textboxtimer(25); graphics.textboxtimer(25);
} }
else else
{ {
graphics.createtextbox(" Game Saved ", -1, 12, 174, 174, 174); graphics.createtextbox(" ERROR: Could not save game! ", -1, graphics.flipmode ? 202 : 12, 255, 60, 60);
graphics.textboxtimer(25); graphics.textboxtimer(50);
} }
state = 0; state = 0;
} }
@ -5698,12 +5697,12 @@ void Game::initteleportermode()
} }
} }
void Game::savetele() bool Game::savetele()
{ {
if (map.custommode || inspecial()) if (map.custommode || inspecial())
{ {
//Don't trash save data! //Don't trash save data!
return; return false;
} }
tinyxml2::XMLDocument doc; tinyxml2::XMLDocument doc;
@ -5714,15 +5713,14 @@ void Game::savetele()
} }
telesummary = writemaingamesave(doc); telesummary = writemaingamesave(doc);
if(FILESYSTEM_saveTiXml2Document("saves/tsave.vvv", doc)) if(!FILESYSTEM_saveTiXml2Document("saves/tsave.vvv", doc))
{
printf("Game saved\n");
}
else
{ {
printf("Could Not Save game!\n"); printf("Could Not Save game!\n");
printf("Failed: %s%s\n", saveFilePath.c_str(), "tsave.vvv"); printf("Failed: %s%s\n", saveFilePath.c_str(), "tsave.vvv");
return false;
} }
printf("Game saved\n");
return true;
} }

View file

@ -132,7 +132,7 @@ public:
void deletequick(); void deletequick();
void savetele(); bool savetele();
void loadtele(); void loadtele();

View file

@ -3552,17 +3552,16 @@ void scriptclass::teleport()
} }
if (!game.intimetrial && !game.nodeathmode && !game.inintermission) if (!game.intimetrial && !game.nodeathmode && !game.inintermission)
{ {
if (graphics.flipmode) if (game.savetele())
{ {
graphics.createtextbox(" Game Saved ", -1, 202, 174, 174, 174); graphics.createtextbox(" Game Saved ", -1, graphics.flipmode ? 202 : 12, 174, 174, 174);
graphics.textboxtimer(25); graphics.textboxtimer(25);
} }
else else
{ {
graphics.createtextbox(" Game Saved ", -1, 12, 174, 174, 174); graphics.createtextbox(" ERROR: Could not save game! ", -1, graphics.flipmode ? 202 : 12, 255, 60, 60);
graphics.textboxtimer(25); graphics.textboxtimer(50);
} }
game.savetele();
} }
} }
} }