Several fixes.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-30 13:53:15 +02:00
parent c6e2de6156
commit 8f73a9a43a
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
6 changed files with 17 additions and 17 deletions

View File

@ -47,3 +47,8 @@ export const char* PkmnLib_Pokemon_GetStatusName(Pokemon* p) { return p->GetStat
SIMPLE_GET_FUNC(Pokemon, GetFriendship, uint8_t)
export void PkmnLib_Pokemon_SetFriendship(Pokemon* p, uint8_t value) { p->SetFriendship(value); }
export void PkmnLib_Pokemon_ChangeFriendship(Pokemon* p, int8_t amount) { p->ChangeFriendship(amount); }
export uint8_t PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species,
const PkmnLib::Library::PokemonForme* forme) {
Try(p->Evolve(species, forme);)
}

View File

@ -8,6 +8,8 @@ void PkmnLib::Battling::Battle::SetWeather(const ArbUt::StringView& name) {
_eventHook.Trigger<WeatherChangeEvent>(name);
}
void PkmnLib::Battling::Battle::ClearWeather() {
if (_weatherScript == nullptr)
return;
_weatherScript->OnRemove();
_weatherScript = nullptr;
_eventHook.Trigger<WeatherChangeEvent>(""_cnc);

View File

@ -17,10 +17,6 @@ namespace PkmnLib::Library {
return CreatureLib::Library::ItemLibrary::Get(name).ForceAs<const Item>();
}
inline ArbUt::BorrowedPtr<const Item> operator[](const ArbUt::BasicStringView& name) const { return Get(name); }
void Insert(const ArbUt::StringView& name, const Item* item) {
CreatureLib::Library::ItemLibrary::Insert(name, item);
}
};
}

View File

@ -26,10 +26,6 @@ namespace PkmnLib::Library {
return Get(name);
}
void Insert(const ArbUt::StringView& name, const PokemonSpecies* species) {
CreatureLib::Library::SpeciesLibrary::Insert(name, species);
}
ArbUt::BorrowedPtr<const PokemonSpecies>
FindPreEvolution(const ArbUt::BorrowedPtr<const PokemonSpecies>& species) const noexcept;
};

View File

@ -10,7 +10,7 @@ TEST_CASE("Able to build and destroy empty library", "library") {
TEST_CASE("Able to build, destroy and insert library", "library") {
auto lib = new PkmnLib::Library::SpeciesLibrary();
lib->Insert("foo"_cnc,
lib->Insert("foo"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme(
@ -23,7 +23,7 @@ TEST_CASE("Able to build, destroy and insert library", "library") {
TEST_CASE("Able to insert and retrieve from library", "library") {
auto lib = new PkmnLib::Library::SpeciesLibrary();
lib->Insert("foo"_cnc,
lib->Insert("foo"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme(

View File

@ -4,7 +4,7 @@
PkmnLib::Battling::BattleLibrary* TestLibrary::_library = nullptr;
PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
auto lib = new PkmnLib::Library::SpeciesLibrary();
lib->Insert("testSpecies"_cnc,
lib->Insert("testSpecies"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
1, "testSpecies"_cnc,
new PkmnLib::Library::PokemonForme(
@ -12,7 +12,7 @@ PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
lib->Insert("testSpecies2"_cnc,
lib->Insert("testSpecies2"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
2, "testSpecies2"_cnc,
new PkmnLib::Library::PokemonForme(
@ -20,7 +20,7 @@ PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
lib->Insert("statTestSpecies1"_cnc,
lib->Insert("statTestSpecies1"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
3, "statTestSpecies1"_cnc,
new PkmnLib::Library::PokemonForme(
@ -28,9 +28,9 @@ PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
lib->Insert("testSpecies3"_cnc,
lib->Insert("testSpecies3"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
2, "testSpecies3"_cnc,
4, "testSpecies3"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.0f, 1.0f, 236, {0, 4},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
@ -53,7 +53,8 @@ PkmnLib::Library::MoveLibrary* TestLibrary::BuildMoveLibrary() {
}
PkmnLib::Library::ItemLibrary* TestLibrary::BuildItemLibrary() {
auto lib = new PkmnLib::Library::ItemLibrary();
lib->Insert("testItem"_cnc, new PkmnLib::Library::Item("testItem"_cnc, CreatureLib::Library::ItemCategory::MiscItem,
CreatureLib::Library::BattleItemCategory::None, 0, {}, 0));
lib->Insert("testItem"_cnc.GetHash(),
new PkmnLib::Library::Item("testItem"_cnc, CreatureLib::Library::ItemCategory::MiscItem,
CreatureLib::Library::BattleItemCategory::None, 0, {}, 0));
return lib;
}