mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Unified identifiers to entity conversion code
This commit is contained in:
parent
121ef77440
commit
55bd164f1c
@ -292,7 +292,7 @@ const Skill * SecondarySkill::toEntity(const Services * services) const
|
||||
|
||||
const CCreature * CreatureIDBase::toCreature() const
|
||||
{
|
||||
return VLC->creh->objects.at(num);
|
||||
return dynamic_cast<const CCreature *>(toEntity(VLC));
|
||||
}
|
||||
|
||||
const Creature * CreatureIDBase::toEntity(const Services * services) const
|
||||
@ -324,12 +324,7 @@ std::string CreatureID::entityType()
|
||||
|
||||
const CSpell * SpellIDBase::toSpell() const
|
||||
{
|
||||
if(num < 0 || num >= VLC->spellh->objects.size())
|
||||
{
|
||||
logGlobal->error("Unable to get spell of invalid ID %d", static_cast<int>(num));
|
||||
return nullptr;
|
||||
}
|
||||
return VLC->spellh->objects[num];
|
||||
return dynamic_cast<const CSpell*>(toEntity(VLC));
|
||||
}
|
||||
|
||||
const spells::Spell * SpellIDBase::toEntity(const Services * services) const
|
||||
|
Loading…
x
Reference in New Issue
Block a user