Update StarInventory.cpp

This commit is contained in:
Kae 2024-08-18 14:15:07 +10:00
parent d7065e7611
commit 76a00ac5c9

View File

@ -238,6 +238,7 @@ PanePtr InventoryPane::createTooltip(Vec2I const& screenPosition) {
if (auto techIcon = fetchChild<ImageWidget>(strf("tech{}", p.second))) { if (auto techIcon = fetchChild<ImageWidget>(strf("tech{}", p.second))) {
if (techIcon->screenBoundRect().contains(screenPosition)) { if (techIcon->screenBoundRect().contains(screenPosition)) {
if (auto techModule = m_player->techs()->equippedTechs().maybe(p.first)) if (auto techModule = m_player->techs()->equippedTechs().maybe(p.first))
if (techDatabase->contains(*techModule))
return SimpleTooltipBuilder::buildTooltip(techDatabase->tech(*techModule).description); return SimpleTooltipBuilder::buildTooltip(techDatabase->tech(*techModule).description);
} }
} }
@ -325,9 +326,12 @@ void InventoryPane::update(float dt) {
auto techDatabase = Root::singleton().techDatabase(); auto techDatabase = Root::singleton().techDatabase();
for (auto const& p : TechTypeNames) { for (auto const& p : TechTypeNames) {
if (auto techIcon = fetchChild<ImageWidget>(strf("tech{}", p.second))) { if (auto techIcon = fetchChild<ImageWidget>(strf("tech{}", p.second))) {
if (auto techModule = m_player->techs()->equippedTechs().maybe(p.first)) if (auto techModule = m_player->techs()->equippedTechs().maybe(p.first)) {
if (techDatabase->contains(*techModule)) {
techIcon->setImage(techDatabase->tech(*techModule).icon); techIcon->setImage(techDatabase->tech(*techModule).icon);
else continue;
}
}
techIcon->setImage(""); techIcon->setImage("");
} }
} }