Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah committed Feb 26, 2023
1 parent b863e13 commit b8ce34f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/client/uicreature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>();
} else if (node->tag() == "outfit-id") {
m_creature->getOutfit().setId(node->value<int>());
getOutfit().setId(node->value<int>());
} else if (node->tag() == "outfit-head") {
m_creature->getOutfit().setHead(node->value<int>());
getOutfit().setHead(node->value<int>());
} else if (node->tag() == "outfit-body") {
m_creature->getOutfit().setBody(node->value<int>());
getOutfit().setBody(node->value<int>());
} else if (node->tag() == "outfit-legs") {
m_creature->getOutfit().setLegs(node->value<int>());
getOutfit().setLegs(node->value<int>());
} else if (node->tag() == "outfit-feet") {
m_creature->getOutfit().setFeet(node->value<int>());
getOutfit().setFeet(node->value<int>());
}
}
}
1 change: 1 addition & 0 deletions src/client/uicreature.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
};

0 comments on commit b8ce34f

Please sign in to comment.