mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Remember loaded custom level and read from it when saving
My previous custom level forwards compatibility would only work if you saved to the same filename as you read from. But what if you saved to a new filename? Well, your extra XML is lost. Not to worry, I've introduced a variable that remembers the filepath of the currently-loaded level (the existing `filename` attribute is kind of weird and not really suited for this purpose, so). I tried to make it a simple `const char*`, but it turns out that's bad when you take the `c_str()` of an `std::string` that then gets destroyed, so it's best to use `std::string` in an `std::string` world. So now when you save a level, it'll attempt to open the original file, and if that doesn't exist then your extra XML gets lost anyway, but I shouldn't be expected to keep your XML if you delete the original file.
This commit is contained in:
@@ -191,6 +191,7 @@ class editorclass{
|
||||
std::string note;
|
||||
std::string keybuffer;
|
||||
std::string filename;
|
||||
std::string loaded_filepath;
|
||||
|
||||
int drawmode;
|
||||
int tilex, tiley;
|
||||
|
||||
Reference in New Issue
Block a user