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 allowBiking;
|
||||||
QString allowEscapeRope;
|
QString allowEscapeRope;
|
||||||
QString battle_scene;
|
QString battle_scene;
|
||||||
|
QString sharedEventsMap = "";
|
||||||
|
QString sharedScriptsMap = "";
|
||||||
MapLayout *layout;
|
MapLayout *layout;
|
||||||
bool isPersistedToFile = true;
|
bool isPersistedToFile = true;
|
||||||
bool needsLayoutDir = true;
|
bool needsLayoutDir = true;
|
||||||
|
|
|
@ -158,6 +158,8 @@ bool Project::loadMapData(Map* map) {
|
||||||
map->allowEscapeRope = QString::number(mapObj["allow_escape_rope"].toBool());
|
map->allowEscapeRope = QString::number(mapObj["allow_escape_rope"].toBool());
|
||||||
map->allowRunning = QString::number(mapObj["allow_running"].toBool());
|
map->allowRunning = QString::number(mapObj["allow_running"].toBool());
|
||||||
}
|
}
|
||||||
|
map->sharedEventsMap = mapObj["shared_events_map"].toString();
|
||||||
|
map->sharedScriptsMap = mapObj["shared_scripts_map"].toString();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
map->events["object_event_group"].clear();
|
map->events["object_event_group"].clear();
|
||||||
|
@ -893,6 +895,7 @@ void Project::saveMap(Map *map) {
|
||||||
mapObj["connections"] = QJsonValue::Null;
|
mapObj["connections"] = QJsonValue::Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (map->sharedEventsMap.isEmpty()) {
|
||||||
// Object events
|
// Object events
|
||||||
QJsonArray objectEventsArr;
|
QJsonArray objectEventsArr;
|
||||||
for (int i = 0; i < map->events["object_event_group"].length(); i++) {
|
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;
|
mapObj["bg_events"] = bgEventsArr;
|
||||||
|
} else {
|
||||||
|
mapObj["shared_events_map"] = map->sharedEventsMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!map->sharedScriptsMap.isEmpty()) {
|
||||||
|
mapObj["shared_scripts_map"] = map->sharedScriptsMap;
|
||||||
|
}
|
||||||
|
|
||||||
QJsonDocument mapDoc(mapObj);
|
QJsonDocument mapDoc(mapObj);
|
||||||
mapFile.write(mapDoc.toJson());
|
mapFile.write(mapDoc.toJson());
|
||||||
|
|
Loading…
Reference in a new issue