Respect shared_events_map and shared_scripts_map
This commit is contained in:
parent
94686e6f0a
commit
d70145d89a
2 changed files with 58 additions and 46 deletions
|
@ -36,6 +36,8 @@ public:
|
|||
QString allowBiking;
|
||||
QString allowEscapeRope;
|
||||
QString battle_scene;
|
||||
QString sharedEventsMap = "";
|
||||
QString sharedScriptsMap = "";
|
||||
MapLayout *layout;
|
||||
bool isPersistedToFile = true;
|
||||
bool needsLayoutDir = true;
|
||||
|
|
|
@ -158,6 +158,8 @@ bool Project::loadMapData(Map* map) {
|
|||
map->allowEscapeRope = QString::number(mapObj["allow_escape_rope"].toBool());
|
||||
map->allowRunning = QString::number(mapObj["allow_running"].toBool());
|
||||
}
|
||||
map->sharedEventsMap = mapObj["shared_events_map"].toString();
|
||||
map->sharedScriptsMap = mapObj["shared_scripts_map"].toString();
|
||||
|
||||
// Events
|
||||
map->events["object_event_group"].clear();
|
||||
|
@ -893,6 +895,7 @@ void Project::saveMap(Map *map) {
|
|||
mapObj["connections"] = QJsonValue::Null;
|
||||
}
|
||||
|
||||
if (map->sharedEventsMap.isEmpty()) {
|
||||
// Object events
|
||||
QJsonArray objectEventsArr;
|
||||
for (int i = 0; i < map->events["object_event_group"].length(); i++) {
|
||||
|
@ -943,6 +946,13 @@ void Project::saveMap(Map *map) {
|
|||
}
|
||||
}
|
||||
mapObj["bg_events"] = bgEventsArr;
|
||||
} else {
|
||||
mapObj["shared_events_map"] = map->sharedEventsMap;
|
||||
}
|
||||
|
||||
if (!map->sharedScriptsMap.isEmpty()) {
|
||||
mapObj["shared_scripts_map"] = map->sharedScriptsMap;
|
||||
}
|
||||
|
||||
QJsonDocument mapDoc(mapObj);
|
||||
mapFile.write(mapDoc.toJson());
|
||||
|
|
Loading…
Reference in a new issue