1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-16 07:59:43 +01:00
VVVVVV/desktop_version/src/XMLUtils.h
Misa 5aa8b99113 Move all settings to settings.vvv
The game previously did this dumb thing where it lumped in all its
settings with its file that tracked your records and unlocks,
`unlock.vvv`. It wasn't really an issue, until 2.3 came along and added
a few settings, suddenly making a problem where 2.3 settings would be
reset by chance if you decided to touch 2.2.

The solution to this is to move all settings to a new file,
`settings.vvv`. However, for compatibility with 2.2, settings will still
be written to `unlock.vvv`.

The game will prioritize reading from `settings.vvv` instead of
`unlock.vvv`, so if there's a setting that's missing from `unlock.vvv`,
no worries there. But if `settings.vvv` is missing, then it'll read
settings from `unlock.vvv`. As well, if `unlock.vvv` is missing, then
`settings.vvv` will be read from instead (I explicitly tested for this,
and found that I had to write special code to handle this case,
otherwise the game would overwrite the existing `settings.vvv` before
reading from it; kids, make sure to always test your code!).

Closes #373 fully.
2020-11-04 12:06:57 -05:00

29 lines
963 B
C++

// Forward decl, avoid including tinyxml2.h
namespace tinyxml2
{
class XMLComment;
class XMLDocument;
class XMLDeclaration;
class XMLElement;
class XMLNode;
}
namespace xml
{
tinyxml2::XMLDocument& get_document(tinyxml2::XMLNode* parent);
tinyxml2::XMLElement* update_element(tinyxml2::XMLNode* parent, const char* name);
// Same thing as above, but takes &parent instead of *parent
tinyxml2::XMLElement* update_element(tinyxml2::XMLNode& parent, const char* name);
tinyxml2::XMLElement* update_element_delete_contents(tinyxml2::XMLNode* parent, const char* name);
tinyxml2::XMLElement* update_tag(tinyxml2::XMLNode* parent, const char* name, const char* value);
tinyxml2::XMLElement* update_tag(tinyxml2::XMLNode* parent, const char* name, const int value);
tinyxml2::XMLDeclaration* update_declaration(tinyxml2::XMLDocument& doc);
tinyxml2::XMLComment* update_comment(tinyxml2::XMLNode* parent, const char* text);
} // namespace xml