De-duplicate reading/writing main game telesave/quicksave

The game has four different functions for the same XML schema:
Game::loadtele(), Game::savetele(), Game::loadquick(), and
Game::savequick(). This essentially means one XML schema has been
copy-pasted three different times.

I can at least trim that number down to being copy-pasted only one time
by de-duplicating the reading and writing part. So both Game::loadtele()
and Game::loadquick() now use Game::readmaingamesave(), and
Game::savetele() and Game::savequick() now use
Game::writemaingamesave().

This will make it take less work to add XML forwards compatibility
(#373).
This commit is contained in:
Misa
2020-09-13 16:31:02 -07:00
committed by Ethan Lee
parent e01efbec89
commit 7fcc1c8cdc
2 changed files with 61 additions and 374 deletions

View File

@@ -5,6 +5,9 @@
#include <string>
#include <vector>
// Forward decl without including all of <tinyxml2.h>
namespace tinyxml2 { class XMLDocument; }
struct MenuOption
{
char text[161]; // 40 chars (160 bytes) covers the entire screen, + 1 more for null terminator
@@ -152,6 +155,9 @@ public:
void loadsummary();
void readmaingamesave(tinyxml2::XMLDocument& doc);
std::string writemaingamesave(tinyxml2::XMLDocument& doc);
void initteleportermode();
std::string saveFilePath;