From b8ce34fe4bf9c07619f005da2b967e3d62a648bc Mon Sep 17 00:00:00 2001 From: Renato Date: Sun, 26 Feb 2023 19:49:41 -0300 Subject: [PATCH] cleanup --- src/client/uicreature.cpp | 13 +++++-------- src/client/uicreature.h | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/client/uicreature.cpp b/src/client/uicreature.cpp index c66c65134a..f973dd4ffe 100644 --- a/src/client/uicreature.cpp +++ b/src/client/uicreature.cpp @@ -46,22 +46,19 @@ void UICreature::onStyleApply(const std::string_view styleName, const OTMLNodePt { UIWidget::onStyleApply(styleName, styleNode); - if (!m_creature) - setOutfit({}); - for (const auto& node : styleNode->children()) { if (node->tag() == "creature-size") { m_creatureSize = node->value(); } else if (node->tag() == "outfit-id") { - m_creature->getOutfit().setId(node->value()); + getOutfit().setId(node->value()); } else if (node->tag() == "outfit-head") { - m_creature->getOutfit().setHead(node->value()); + getOutfit().setHead(node->value()); } else if (node->tag() == "outfit-body") { - m_creature->getOutfit().setBody(node->value()); + getOutfit().setBody(node->value()); } else if (node->tag() == "outfit-legs") { - m_creature->getOutfit().setLegs(node->value()); + getOutfit().setLegs(node->value()); } else if (node->tag() == "outfit-feet") { - m_creature->getOutfit().setFeet(node->value()); + getOutfit().setFeet(node->value()); } } } diff --git a/src/client/uicreature.h b/src/client/uicreature.h index 4f38481d7a..8bd1922af2 100644 --- a/src/client/uicreature.h +++ b/src/client/uicreature.h @@ -40,6 +40,7 @@ class UICreature : public UIWidget protected: void onStyleApply(const std::string_view styleName, const OTMLNodePtr& styleNode) override; + Outfit getOutfit() { if (!m_creature) setOutfit({}); return m_creature->getOutfit(); } CreaturePtr m_creature; uint8_t m_creatureSize{ 0 }; };