From b3a30c91ae3d62903b853bf58fa22019751996b7 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sat, 15 Sep 2018 15:25:34 -0500 Subject: [PATCH] Properly read dynamically-set warps that use MAP_NONE as their destination --- editor.cpp | 5 ++++- project.cpp | 9 +++++++++ project.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/editor.cpp b/editor.cpp index 375c4ebf..cc550aaa 100755 --- a/editor.cpp +++ b/editor.cpp @@ -1700,7 +1700,10 @@ void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *) { void DraggablePixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) { if (this->event->get("event_type") == EventType::Warp) { - emit editor->warpEventDoubleClicked(this->event->get("destination_map_name"), this->event->get("destination_warp")); + QString destMap = this->event->get("destination_map_name"); + if (destMap != NONE_MAP_NAME) { + emit editor->warpEventDoubleClicked(this->event->get("destination_map_name"), this->event->get("destination_warp")); + } } } diff --git a/project.cpp b/project.cpp index b01d6aa5..fa886dec 100755 --- a/project.cpp +++ b/project.cpp @@ -1010,6 +1010,10 @@ void Project::readMapGroups() { } } + mapConstantsToMapNames->insert(NONE_MAP_CONSTANT, NONE_MAP_NAME); + mapNamesToMapConstants->insert(NONE_MAP_NAME, NONE_MAP_CONSTANT); + maps->append(NONE_MAP_NAME); + groupNames = groups; groupedMapNames = groupedMaps; mapNames = maps; @@ -1473,6 +1477,11 @@ void Project::readMapEvents(Map *map) { warp->put("event_group_type", "warp_event_group"); warp->put("event_type", EventType::Warp); map->events["warp_event_group"].append(warp); + } else if (mapConstant == NONE_MAP_CONSTANT) { + warp->put("destination_map_name", NONE_MAP_NAME); + warp->put("event_group_type", "warp_event_group"); + warp->put("event_type", EventType::Warp); + map->events["warp_event_group"].append(warp); } else { qDebug() << QString("Destination map constant '%1' is invalid for warp").arg(mapConstant); } diff --git a/project.h b/project.h index 454cb676..fb630f38 100755 --- a/project.h +++ b/project.h @@ -9,6 +9,9 @@ #include #include +static QString NONE_MAP_CONSTANT = "MAP_NONE"; +static QString NONE_MAP_NAME = "None"; + class Project { public: