From 0e0da77c074e4d1d5984d5a572cffa513293ffaa Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 18 Oct 2022 12:39:37 -0400 Subject: [PATCH] NONE_MAP -> DYNAMIC_MAP --- include/project.h | 5 +++-- src/core/events.cpp | 8 ++++---- src/editor.cpp | 4 ++-- src/project.cpp | 6 +++--- src/ui/draggablepixmapitem.cpp | 6 +++--- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/project.h b/include/project.h index a844b225..e76cfb0f 100644 --- a/include/project.h +++ b/include/project.h @@ -26,8 +26,9 @@ struct EventGraphics bool inanimate; }; -static QString NONE_MAP_CONSTANT = "MAP_NONE"; -static QString NONE_MAP_NAME = "None"; +// The constant and displayed name of the special map value used by warps with multiple potential destinations +static QString DYNAMIC_MAP_CONSTANT = "MAP_DYNAMIC"; +static QString DYNAMIC_MAP_NAME = "Dynamic"; class Project : public QObject { diff --git a/src/core/events.cpp b/src/core/events.cpp index 9a8585d8..7f15997b 100644 --- a/src/core/events.cpp +++ b/src/core/events.cpp @@ -321,8 +321,8 @@ bool CloneObjectEvent::loadFromJson(QJsonObject json, Project *project) { QString mapConstant = ParseUtil::jsonToQString(json["target_map"]); if (project->mapConstantsToMapNames.contains(mapConstant)) { this->setTargetMap(project->mapConstantsToMapNames.value(mapConstant)); - } else if (mapConstant == NONE_MAP_CONSTANT) { - this->setTargetMap(NONE_MAP_NAME); + } else if (mapConstant == DYNAMIC_MAP_CONSTANT) { + this->setTargetMap(DYNAMIC_MAP_NAME); } else { logError(QString("Destination map constant '%1' is invalid").arg(mapConstant)); return false; @@ -431,8 +431,8 @@ bool WarpEvent::loadFromJson(QJsonObject json, Project *project) { QString mapConstant = ParseUtil::jsonToQString(json["dest_map"]); if (project->mapConstantsToMapNames.contains(mapConstant)) { this->setDestinationMap(project->mapConstantsToMapNames.value(mapConstant)); - } else if (mapConstant == NONE_MAP_CONSTANT) { - this->setDestinationMap(NONE_MAP_NAME); + } else if (mapConstant == DYNAMIC_MAP_CONSTANT) { + this->setDestinationMap(DYNAMIC_MAP_NAME); } else { logError(QString("Destination map constant '%1' is invalid for warp").arg(mapConstant)); return false; diff --git a/src/editor.cpp b/src/editor.cpp index 883eaa30..98000854 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -1747,7 +1747,7 @@ void Editor::setConnectionMap(QString mapName) { if (!selected_connection_item) return; - if (mapName.isEmpty() || mapName == NONE_MAP_NAME) { + if (mapName.isEmpty() || mapName == DYNAMIC_MAP_NAME) { removeCurrentConnection(); return; } @@ -1899,7 +1899,7 @@ void Editor::updateDiveEmergeMap(QString mapName, QString direction) { } } - if (mapName.isEmpty() || mapName == NONE_MAP_NAME) { + if (mapName.isEmpty() || mapName == DYNAMIC_MAP_NAME) { // Remove dive/emerge connection if (connection) { map->connections.removeOne(connection); diff --git a/src/project.cpp b/src/project.cpp index 3ce93261..e56dd8eb 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -1762,9 +1762,9 @@ bool Project::readMapGroups() { } } - mapConstantsToMapNames.insert(NONE_MAP_CONSTANT, NONE_MAP_NAME); - mapNamesToMapConstants.insert(NONE_MAP_NAME, NONE_MAP_CONSTANT); - maps.append(NONE_MAP_NAME); + mapConstantsToMapNames.insert(DYNAMIC_MAP_CONSTANT, DYNAMIC_MAP_NAME); + mapNamesToMapConstants.insert(DYNAMIC_MAP_NAME, DYNAMIC_MAP_CONSTANT); + maps.append(DYNAMIC_MAP_NAME); groupNames = groups; groupedMapNames = groupedMaps; diff --git a/src/ui/draggablepixmapitem.cpp b/src/ui/draggablepixmapitem.cpp index ef749a07..5bd042a8 100644 --- a/src/ui/draggablepixmapitem.cpp +++ b/src/ui/draggablepixmapitem.cpp @@ -85,14 +85,14 @@ void DraggablePixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) { if (eventType == Event::Type::Warp) { WarpEvent *warp = dynamic_cast(this->event); QString destMap = warp->getDestinationMap(); - if (destMap != NONE_MAP_NAME) { + if (destMap != DYNAMIC_MAP_NAME) { emit editor->warpEventDoubleClicked(destMap, warp->getDestinationWarpID(), Event::Group::Warp); } } else if (eventType == Event::Type::CloneObject) { CloneObjectEvent *clone = dynamic_cast(this->event); QString destMap = clone->getTargetMap(); - if (destMap != NONE_MAP_NAME) { + if (destMap != DYNAMIC_MAP_NAME) { emit editor->warpEventDoubleClicked(destMap, clone->getTargetID(), Event::Group::Object); } } @@ -100,7 +100,7 @@ void DraggablePixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) { SecretBaseEvent *base = dynamic_cast(this->event); QString baseId = base->getBaseID(); QString destMap = editor->project->mapConstantsToMapNames.value("MAP_" + baseId.left(baseId.lastIndexOf("_"))); - if (destMap != NONE_MAP_NAME) { + if (destMap != DYNAMIC_MAP_NAME) { emit editor->warpEventDoubleClicked(destMap, 0, Event::Group::Warp); } }