2019-12-29 14:29:52 +00:00
|
|
|
#ifndef PKMNLIB_SPECIESLIBRARY_HPP
|
|
|
|
#define PKMNLIB_SPECIESLIBRARY_HPP
|
|
|
|
|
2020-02-08 18:22:29 +00:00
|
|
|
#include <CreatureLib/Library/SpeciesLibrary.hpp>
|
2019-12-29 14:29:52 +00:00
|
|
|
#include "PokemonSpecies.hpp"
|
|
|
|
|
|
|
|
namespace PkmnLib::Library {
|
|
|
|
class SpeciesLibrary : public CreatureLib::Library::SpeciesLibrary {
|
2020-08-11 19:46:22 +00:00
|
|
|
ArbUt::Dictionary<ArbUt::BorrowedPtr<const PokemonSpecies>, ArbUt::BorrowedPtr<const PokemonSpecies>>
|
|
|
|
_preEvolutionCache;
|
|
|
|
|
2019-12-29 14:29:52 +00:00
|
|
|
public:
|
2020-07-04 13:50:30 +00:00
|
|
|
inline bool TryGet(const ArbUt::BasicStringView& name,
|
2020-05-27 15:26:25 +00:00
|
|
|
ArbUt::BorrowedPtr<const PokemonSpecies>& outSpecies) const {
|
|
|
|
auto v = outSpecies.As<const PokemonSpecies::CreatureSpecies>();
|
|
|
|
auto res = CreatureLib::Library::SpeciesLibrary::TryGet(name, v);
|
|
|
|
outSpecies = v.As<const PokemonSpecies>();
|
|
|
|
return res;
|
2020-02-01 15:56:09 +00:00
|
|
|
}
|
|
|
|
|
2020-07-04 13:50:30 +00:00
|
|
|
inline ArbUt::BorrowedPtr<const PokemonSpecies> Get(const ArbUt::BasicStringView& name) const {
|
2020-05-27 15:26:25 +00:00
|
|
|
return CreatureLib::Library::SpeciesLibrary::Get(name).As<const PokemonSpecies>();
|
2019-12-29 14:29:52 +00:00
|
|
|
}
|
|
|
|
|
2020-07-04 13:50:30 +00:00
|
|
|
ArbUt::BorrowedPtr<const PokemonSpecies> operator[](const ArbUt::BasicStringView& name) const {
|
2020-05-27 15:26:25 +00:00
|
|
|
return Get(name);
|
|
|
|
}
|
2019-12-29 14:29:52 +00:00
|
|
|
|
2020-08-11 19:46:22 +00:00
|
|
|
ArbUt::BorrowedPtr<const PokemonSpecies>
|
|
|
|
FindPreEvolution(const ArbUt::BorrowedPtr<const PokemonSpecies>& species) const noexcept;
|
2019-12-29 14:29:52 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // PKMNLIB_SPECIESLIBRARY_HPP
|