NONE_MAP -> DYNAMIC_MAP
This commit is contained in:
parent
75788ed3f9
commit
0e0da77c07
5 changed files with 15 additions and 14 deletions
|
@ -26,8 +26,9 @@ struct EventGraphics
|
||||||
bool inanimate;
|
bool inanimate;
|
||||||
};
|
};
|
||||||
|
|
||||||
static QString NONE_MAP_CONSTANT = "MAP_NONE";
|
// The constant and displayed name of the special map value used by warps with multiple potential destinations
|
||||||
static QString NONE_MAP_NAME = "None";
|
static QString DYNAMIC_MAP_CONSTANT = "MAP_DYNAMIC";
|
||||||
|
static QString DYNAMIC_MAP_NAME = "Dynamic";
|
||||||
|
|
||||||
class Project : public QObject
|
class Project : public QObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -321,8 +321,8 @@ bool CloneObjectEvent::loadFromJson(QJsonObject json, Project *project) {
|
||||||
QString mapConstant = ParseUtil::jsonToQString(json["target_map"]);
|
QString mapConstant = ParseUtil::jsonToQString(json["target_map"]);
|
||||||
if (project->mapConstantsToMapNames.contains(mapConstant)) {
|
if (project->mapConstantsToMapNames.contains(mapConstant)) {
|
||||||
this->setTargetMap(project->mapConstantsToMapNames.value(mapConstant));
|
this->setTargetMap(project->mapConstantsToMapNames.value(mapConstant));
|
||||||
} else if (mapConstant == NONE_MAP_CONSTANT) {
|
} else if (mapConstant == DYNAMIC_MAP_CONSTANT) {
|
||||||
this->setTargetMap(NONE_MAP_NAME);
|
this->setTargetMap(DYNAMIC_MAP_NAME);
|
||||||
} else {
|
} else {
|
||||||
logError(QString("Destination map constant '%1' is invalid").arg(mapConstant));
|
logError(QString("Destination map constant '%1' is invalid").arg(mapConstant));
|
||||||
return false;
|
return false;
|
||||||
|
@ -431,8 +431,8 @@ bool WarpEvent::loadFromJson(QJsonObject json, Project *project) {
|
||||||
QString mapConstant = ParseUtil::jsonToQString(json["dest_map"]);
|
QString mapConstant = ParseUtil::jsonToQString(json["dest_map"]);
|
||||||
if (project->mapConstantsToMapNames.contains(mapConstant)) {
|
if (project->mapConstantsToMapNames.contains(mapConstant)) {
|
||||||
this->setDestinationMap(project->mapConstantsToMapNames.value(mapConstant));
|
this->setDestinationMap(project->mapConstantsToMapNames.value(mapConstant));
|
||||||
} else if (mapConstant == NONE_MAP_CONSTANT) {
|
} else if (mapConstant == DYNAMIC_MAP_CONSTANT) {
|
||||||
this->setDestinationMap(NONE_MAP_NAME);
|
this->setDestinationMap(DYNAMIC_MAP_NAME);
|
||||||
} else {
|
} else {
|
||||||
logError(QString("Destination map constant '%1' is invalid for warp").arg(mapConstant));
|
logError(QString("Destination map constant '%1' is invalid for warp").arg(mapConstant));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1747,7 +1747,7 @@ void Editor::setConnectionMap(QString mapName) {
|
||||||
if (!selected_connection_item)
|
if (!selected_connection_item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mapName.isEmpty() || mapName == NONE_MAP_NAME) {
|
if (mapName.isEmpty() || mapName == DYNAMIC_MAP_NAME) {
|
||||||
removeCurrentConnection();
|
removeCurrentConnection();
|
||||||
return;
|
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
|
// Remove dive/emerge connection
|
||||||
if (connection) {
|
if (connection) {
|
||||||
map->connections.removeOne(connection);
|
map->connections.removeOne(connection);
|
||||||
|
|
|
@ -1762,9 +1762,9 @@ bool Project::readMapGroups() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapConstantsToMapNames.insert(NONE_MAP_CONSTANT, NONE_MAP_NAME);
|
mapConstantsToMapNames.insert(DYNAMIC_MAP_CONSTANT, DYNAMIC_MAP_NAME);
|
||||||
mapNamesToMapConstants.insert(NONE_MAP_NAME, NONE_MAP_CONSTANT);
|
mapNamesToMapConstants.insert(DYNAMIC_MAP_NAME, DYNAMIC_MAP_CONSTANT);
|
||||||
maps.append(NONE_MAP_NAME);
|
maps.append(DYNAMIC_MAP_NAME);
|
||||||
|
|
||||||
groupNames = groups;
|
groupNames = groups;
|
||||||
groupedMapNames = groupedMaps;
|
groupedMapNames = groupedMaps;
|
||||||
|
|
|
@ -85,14 +85,14 @@ void DraggablePixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) {
|
||||||
if (eventType == Event::Type::Warp) {
|
if (eventType == Event::Type::Warp) {
|
||||||
WarpEvent *warp = dynamic_cast<WarpEvent *>(this->event);
|
WarpEvent *warp = dynamic_cast<WarpEvent *>(this->event);
|
||||||
QString destMap = warp->getDestinationMap();
|
QString destMap = warp->getDestinationMap();
|
||||||
if (destMap != NONE_MAP_NAME) {
|
if (destMap != DYNAMIC_MAP_NAME) {
|
||||||
emit editor->warpEventDoubleClicked(destMap, warp->getDestinationWarpID(), Event::Group::Warp);
|
emit editor->warpEventDoubleClicked(destMap, warp->getDestinationWarpID(), Event::Group::Warp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (eventType == Event::Type::CloneObject) {
|
else if (eventType == Event::Type::CloneObject) {
|
||||||
CloneObjectEvent *clone = dynamic_cast<CloneObjectEvent *>(this->event);
|
CloneObjectEvent *clone = dynamic_cast<CloneObjectEvent *>(this->event);
|
||||||
QString destMap = clone->getTargetMap();
|
QString destMap = clone->getTargetMap();
|
||||||
if (destMap != NONE_MAP_NAME) {
|
if (destMap != DYNAMIC_MAP_NAME) {
|
||||||
emit editor->warpEventDoubleClicked(destMap, clone->getTargetID(), Event::Group::Object);
|
emit editor->warpEventDoubleClicked(destMap, clone->getTargetID(), Event::Group::Object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ void DraggablePixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) {
|
||||||
SecretBaseEvent *base = dynamic_cast<SecretBaseEvent *>(this->event);
|
SecretBaseEvent *base = dynamic_cast<SecretBaseEvent *>(this->event);
|
||||||
QString baseId = base->getBaseID();
|
QString baseId = base->getBaseID();
|
||||||
QString destMap = editor->project->mapConstantsToMapNames.value("MAP_" + baseId.left(baseId.lastIndexOf("_")));
|
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);
|
emit editor->warpEventDoubleClicked(destMap, 0, Event::Group::Warp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue