Properly read dynamically-set warps that use MAP_NONE as their destination

This commit is contained in:
Marcus Huderle 2018-09-15 15:25:34 -05:00
parent a2d95bfc72
commit b3a30c91ae
3 changed files with 16 additions and 1 deletions

View file

@ -1700,7 +1700,10 @@ void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *) {
void DraggablePixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) { void DraggablePixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) {
if (this->event->get("event_type") == EventType::Warp) { 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"));
}
} }
} }

View file

@ -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; groupNames = groups;
groupedMapNames = groupedMaps; groupedMapNames = groupedMaps;
mapNames = maps; mapNames = maps;
@ -1473,6 +1477,11 @@ void Project::readMapEvents(Map *map) {
warp->put("event_group_type", "warp_event_group"); warp->put("event_group_type", "warp_event_group");
warp->put("event_type", EventType::Warp); warp->put("event_type", EventType::Warp);
map->events["warp_event_group"].append(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 { } else {
qDebug() << QString("Destination map constant '%1' is invalid for warp").arg(mapConstant); qDebug() << QString("Destination map constant '%1' is invalid for warp").arg(mapConstant);
} }

View file

@ -9,6 +9,9 @@
#include <QList> #include <QList>
#include <QStandardItem> #include <QStandardItem>
static QString NONE_MAP_CONSTANT = "MAP_NONE";
static QString NONE_MAP_NAME = "None";
class Project class Project
{ {
public: public: