From cfd355bf4dfce8561962be330985276c0c6d8b0c Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 15 Mar 2020 08:17:12 -0700 Subject: [PATCH] Don't let custom levels tamper with main game save data Someone being mean could've overwritten the telesaves of unsuspecting players, or unlocked a bunch of stuff which they shouldn't have for those players, using things like the telesave() command and gamestates. To prevent this, return early in Game::savequick(), Game::savetele(), and Game::unlocknum() if we are in custommode. --- desktop_version/src/Game.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index f188377d..06c9b4a6 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -4208,6 +4208,12 @@ void Game::deletestats( mapclass& map, Graphics& dwgfx ) void Game::unlocknum( int t, mapclass& map, Graphics& dwgfx ) { + if (map.custommode) + { + //Don't let custom levels unlock things! + return; + } + unlock[t] = true; savestats(map, dwgfx); } @@ -5661,6 +5667,12 @@ void Game::savetele( mapclass& map, entityclass& obj, musicclass& music ) //Save to the telesave cookie telecookieexists = true; + if (map.custommode) + { + //Don't trash save data! + return; + } + TiXmlDocument doc; TiXmlElement* msg; TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" ); @@ -5904,6 +5916,12 @@ void Game::savequick( mapclass& map, entityclass& obj, musicclass& music ) { quickcookieexists = true; + if (map.custommode) + { + //Don't trash save data! + return; + } + TiXmlDocument doc; TiXmlElement* msg; TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );