From 55f7b73b9b5214c067f79d0715bcc3e6ff77ef26 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 10 Sep 2022 15:52:44 -0400 Subject: [PATCH] Fix id names of new heal locations --- src/core/events.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/events.cpp b/src/core/events.cpp index a7b03b53..9f08174f 100644 --- a/src/core/events.cpp +++ b/src/core/events.cpp @@ -879,13 +879,16 @@ OrderedJson::object HealLocationEvent::buildEventJson(Project *) { } void HealLocationEvent::setDefaultValues(Project *) { - if (this->getMap()) { - this->setLocationName(Map::mapConstantFromName(this->getMap()->name).remove(0,4)); - this->setIdName(this->getMap()->name.replace(QRegularExpression("([a-z])([A-Z])"), "\\1_\\2").toUpper()); - } this->setElevation(3); - if (projectConfig.getHealLocationRespawnDataEnabled()) { - if (this->getMap()) this->setRespawnMap(this->getMap()->name); + if (!this->getMap()) + return; + bool respawnEanbled = projectConfig.getHealLocationRespawnDataEnabled(); + QString mapConstant = Map::mapConstantFromName(this->getMap()->name).remove(0,4); + QString prefix = respawnEanbled ? "SPAWN_" : "HEAL_LOCATION_"; + this->setLocationName(mapConstant); + this->setIdName(prefix + mapConstant); + if (respawnEanbled) { + this->setRespawnMap(this->getMap()->name); this->setRespawnNPC(1); } }