Rework TryGet on MoveLibrary to be less ugly.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
9ac60dfa42
commit
984088f7a9
|
@ -11,7 +11,12 @@ namespace PkmnLib::Library {
|
||||||
virtual const MoveData* operator[](const Arbutils::CaseInsensitiveConstString& name) const { return Get(name); }
|
virtual const MoveData* operator[](const Arbutils::CaseInsensitiveConstString& name) const { return Get(name); }
|
||||||
|
|
||||||
inline bool TryGet(const Arbutils::CaseInsensitiveConstString& name, const MoveData*& move) const {
|
inline bool TryGet(const Arbutils::CaseInsensitiveConstString& name, const MoveData*& move) const {
|
||||||
return CreatureLib::Library::AttackLibrary::TryGet(name, (const CreatureLib::Library::AttackData*&)move);
|
const CreatureLib::Library::AttackData* ptr;
|
||||||
|
if (CreatureLib::Library::AttackLibrary::TryGet(name, ptr)){
|
||||||
|
move = dynamic_cast<const MoveData*>(ptr);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
const MoveData* Get(const Arbutils::CaseInsensitiveConstString& name) const {
|
const MoveData* Get(const Arbutils::CaseInsensitiveConstString& name) const {
|
||||||
return dynamic_cast<const MoveData*>(CreatureLib::Library::AttackLibrary::Get(name));
|
return dynamic_cast<const MoveData*>(CreatureLib::Library::AttackLibrary::Get(name));
|
||||||
|
|
Loading…
Reference in New Issue