1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-01-22 23:17:04 +00:00

mapeditor now saves/loads file online

This commit is contained in:
Zeno Rogue 2020-09-21 12:02:23 +02:00
parent 9f1762f0c1
commit a0865998db

View File

@ -1349,6 +1349,10 @@ EX namespace mapeditor {
} }
void save_level() { void save_level() {
#if ISWEB
mapstream::saveMap("web.lev");
offer_download("web.lev", "mime/type");
#else
dialog::openFileDialog(levelfile, XLAT("level to save:"), ".lev", [] () { dialog::openFileDialog(levelfile, XLAT("level to save:"), ".lev", [] () {
if(mapstream::saveMap(levelfile.c_str())) { if(mapstream::saveMap(levelfile.c_str())) {
addMessage(XLAT("Map saved to %1", levelfile)); addMessage(XLAT("Map saved to %1", levelfile));
@ -1359,10 +1363,16 @@ EX namespace mapeditor {
return false; return false;
} }
}); });
#endif
} }
void load_level() { void load_level() {
dialog::openFileDialog(levelfile, XLAT("level to load:"), ".lev", [] () { #if ISWEB
offer_choose_file([] {
mapstream::loadMap("data.txt");
});
#else
dialog::openFileDialog(levelfile, XLAT("level to load:"), ".lev", [] () {
if(mapstream::loadMap(levelfile.c_str())) { if(mapstream::loadMap(levelfile.c_str())) {
addMessage(XLAT("Map loaded from %1", levelfile)); addMessage(XLAT("Map loaded from %1", levelfile));
return true; return true;
@ -1372,6 +1382,7 @@ EX namespace mapeditor {
return false; return false;
} }
}); });
#endif
} }
void showList() { void showList() {