From f23ffc0457cfc099591fec11da08f6e88497cd9f Mon Sep 17 00:00:00 2001 From: Dav999 Date: Tue, 12 Sep 2023 04:15:12 +0200 Subject: [PATCH] Get rid of Game::savearea (std::string) This is what got saved to the area part of the tags, and it was specifically set upon pressing ACTION to save in the map menu. Which meant tsave.vvv may not get an accurate area name (notably "nowhere" if you hadn't quicksaved before in that session) even though it's not displayed anywhere so it didn't really matter. But this variable can be removed - there's only one place where is written for both quicksaves and telesaves, so that now gets the area at saving time. Fun fact: custom level quicksaves also have a tag, and it's even less functional than the one in tsave.vvv, because it stores whatever main-game area name applies to your current coordinates. So I simply filled in the level's name instead (just like what the actual save box says). --- desktop_version/src/Game.cpp | 5 ++--- desktop_version/src/Game.h | 1 - desktop_version/src/Input.cpp | 1 - desktop_version/src/Render.cpp | 6 +++++- desktop_version/src/Script.cpp | 1 - 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 011ce3e0..fb99596c 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -267,7 +267,6 @@ void Game::init(void) gamesaved = false; gamesavefailed = false; savetime = "00:00"; - savearea = "nowhere"; savetrinkets = 0; intimetrial = false; @@ -5846,7 +5845,7 @@ struct Game::Summary Game::writemaingamesave(tinyxml2::XMLDocument& doc) xml::update_tag(msgs, "finalstretch", (int) map.finalstretch); - std::string legacy_summary = savearea + ", " + timestring(); + std::string legacy_summary = std::string(map.currentarea(saverx, savery)) + ", " + timestring(); xml::update_tag(msgs, "summary", legacy_summary.c_str()); @@ -6009,7 +6008,7 @@ bool Game::customsavequick(const std::string& savfile) } } - std::string legacy_summary = savearea + ", " + timestring(); + std::string legacy_summary = customleveltitle + ", " + timestring(); xml::update_tag(msgs, "summary", legacy_summary.c_str()); if(!FILESYSTEM_saveTiXml2Document(("saves/"+levelfile+".vvv").c_str(), doc)) diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 1c43db84..fe162807 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -359,7 +359,6 @@ public: bool gamesaved; bool gamesavefailed; std::string savetime; - std::string savearea; int savetrinkets; bool startscript; std::string newscript; diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index c52613fb..55c8064e 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -3068,7 +3068,6 @@ static void mapmenuactionpress(const bool version2_2) music.playef(Sound_GAMESAVED); game.savetime = game.timestring(); - game.savearea = map.currentarea(game.roomx, game.roomy); game.savetrinkets = game.trinkets(); bool success; diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index bdac232e..53f29367 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -3012,7 +3012,11 @@ void maprender(void) else { size_t i; - font::print(PR_CEN, -1, FLIP(80, 8), game.savearea, 25, 255 - help.glow/2, 255 - help.glow/2); + font::print( + PR_CEN, -1, FLIP(80, 8), + map.currentarea(game.last_quicksave.saverx, game.last_quicksave.savery), + 25, 255 - help.glow/2, 255 - help.glow/2 + ); for (i = 0; i < SDL_arraysize(game.crewstats); ++i) { /* Crewmates are annoying. Their height is 21 pixels, but to flip them, diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index e6781461..c6ebe63e 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -3127,7 +3127,6 @@ void scriptclass::hardreset(void) game.gamesaved = false; game.gamesavefailed = false; game.savetime = "00:00"; - game.savearea = "nowhere"; game.savetrinkets = 0; if (!version2_2) {