From 18feea5fedf768d64d2a1e22a1fa0ff6b35d1c7c Mon Sep 17 00:00:00 2001 From: Daniel Seiler Date: Tue, 2 Jan 2024 00:08:38 +0100 Subject: [PATCH] fix: optional party phrases (#1377) * fix: optional party phrases Don't return early if there are no party phrases * Update VanityUtilities.cpp --- dGame/dUtilities/VanityUtilities.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/dGame/dUtilities/VanityUtilities.cpp b/dGame/dUtilities/VanityUtilities.cpp index 99087365f..6d5f996c7 100644 --- a/dGame/dUtilities/VanityUtilities.cpp +++ b/dGame/dUtilities/VanityUtilities.cpp @@ -294,21 +294,20 @@ void VanityUtilities::ParseXML(const std::string& file) { auto* partyPhrases = npcs->FirstChildElement("partyphrases"); if (partyPhrases == nullptr) { - LOG("Failed to parse party phrases"); - return; - } - - for (auto* phrase = partyPhrases->FirstChildElement("phrase"); phrase != nullptr; - phrase = phrase->NextSiblingElement("phrase")) { - // Get the phrase - auto* text = phrase->GetText(); - - if (text == nullptr) { - LOG("Failed to parse party phrase"); - continue; + LOG("No party phrases found"); + } else { + for (auto* phrase = partyPhrases->FirstChildElement("phrase"); phrase != nullptr; + phrase = phrase->NextSiblingElement("phrase")) { + // Get the phrase + auto* text = phrase->GetText(); + + if (text == nullptr) { + LOG("Failed to parse party phrase"); + continue; + } + + m_PartyPhrases.push_back(text); } - - m_PartyPhrases.push_back(text); } for (auto* npc = npcs->FirstChildElement("npc"); npc != nullptr; npc = npc->NextSiblingElement("npc")) {