1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-01 10:33:32 +02: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
{
savetele();
if (graphics.flipmode)
if (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);
}
else
{
graphics.createtextbox(" Game Saved ", -1, 12, 174, 174, 174);
graphics.textboxtimer(25);
graphics.createtextbox(" ERROR: Could not save game! ", -1, graphics.flipmode ? 202 : 12, 255, 60, 60);
graphics.textboxtimer(50);
}
state = 0;
}
@ -5698,12 +5697,12 @@ void Game::initteleportermode()
}
}
void Game::savetele()
bool Game::savetele()
{
if (map.custommode || inspecial())
{
//Don't trash save data!
return;
return false;
}
tinyxml2::XMLDocument doc;
@ -5714,15 +5713,14 @@ void Game::savetele()
}
telesummary = writemaingamesave(doc);
if(FILESYSTEM_saveTiXml2Document("saves/tsave.vvv", doc))
{
printf("Game saved\n");
}
else
if(!FILESYSTEM_saveTiXml2Document("saves/tsave.vvv", doc))
{
printf("Could Not Save game!\n");
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 savetele();
bool savetele();
void loadtele();

View File

@ -3552,17 +3552,16 @@ void scriptclass::teleport()
}
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);
}
else
{
graphics.createtextbox(" Game Saved ", -1, 12, 174, 174, 174);
graphics.textboxtimer(25);
graphics.createtextbox(" ERROR: Could not save game! ", -1, graphics.flipmode ? 202 : 12, 255, 60, 60);
graphics.textboxtimer(50);
}
game.savetele();
}
}
}