summaryrefslogtreecommitdiffstats
path: root/sigmodr/models/CoinListObjectModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmodr/models/CoinListObjectModel.cpp')
-rw-r--r--sigmodr/models/CoinListObjectModel.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/sigmodr/models/CoinListObjectModel.cpp b/sigmodr/models/CoinListObjectModel.cpp
index ee74e2e4..8264e272 100644
--- a/sigmodr/models/CoinListObjectModel.cpp
+++ b/sigmodr/models/CoinListObjectModel.cpp
@@ -50,15 +50,15 @@ QVariant Sigmodr::CoinListObjectModel::data(int role) const
Sigmod::CoinListObject* object = qobject_cast<Sigmod::CoinListObject*>(m_object);
if (object->type() == Sigmod::CoinListObject::Item)
{
- const int index = qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->itemIndex(object->object());
- if (index != INT_MAX)
- return qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->item(index)->name();
+ const Sigmod::Item* item = m_object->sigmod()->itemById(object->object());
+ if (item)
+ return item->name();
}
else if (object->type() == Sigmod::CoinListObject::Species)
{
- const int index = qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->speciesIndex(object->object());
- if (index != INT_MAX)
- return qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->species(index)->name();
+ const Sigmod::Species* species = m_object->sigmod()->speciesById(object->object());
+ if (species)
+ return species->name();
}
return "";
}