Support flags for species and formes.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
de3ad4a9c8
commit
88971dce37
|
@ -129,6 +129,7 @@ Standard: c++20
|
||||||
StatementMacros:
|
StatementMacros:
|
||||||
- Q_UNUSED
|
- Q_UNUSED
|
||||||
- QT_REQUIRE_VERSION
|
- QT_REQUIRE_VERSION
|
||||||
|
- Try
|
||||||
TabWidth: 8
|
TabWidth: 8
|
||||||
UseCRLF: false
|
UseCRLF: false
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
|
|
|
@ -5,15 +5,19 @@ using namespace PkmnLib::Library;
|
||||||
export uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint16_t id, const char* name,
|
export uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint16_t id, const char* name,
|
||||||
const PokemonForme* defaultForme, float genderRatio,
|
const PokemonForme* defaultForme, float genderRatio,
|
||||||
const char* growthRate, uint8_t captureRate, uint8_t baseHappiness,
|
const char* growthRate, uint8_t captureRate, uint8_t baseHappiness,
|
||||||
const char* const* eggGroupsRaw, size_t eggGroupsLength) {
|
const char* const* eggGroupsRaw, size_t eggGroupsLength,
|
||||||
|
const char* flags[], size_t flagsCount) {
|
||||||
|
|
||||||
Try(
|
Try(
|
||||||
ArbUt::List<ArbUt::StringView> eggGroups(eggGroupsLength);
|
std::unordered_set<uint32_t> conversedFlags(flagsCount); for (size_t i = 0; i < flagsCount; i++) {
|
||||||
for (size_t i = 0; i < eggGroupsLength; i++) { eggGroups.Append(ArbUt::StringView(eggGroupsRaw[i])); }
|
conversedFlags.insert(ArbUt::StringView::CalculateHash(flags[i]));
|
||||||
auto cName = ArbUt::StringView(name);
|
} ArbUt::List<ArbUt::StringView>
|
||||||
|
eggGroups(eggGroupsLength);
|
||||||
|
for (size_t i = 0; i < eggGroupsLength;
|
||||||
|
i++) { eggGroups.Append(ArbUt::StringView(eggGroupsRaw[i])); } auto cName = ArbUt::StringView(name);
|
||||||
auto cGrowthRate = ArbUt::StringView(growthRate);
|
auto cGrowthRate = ArbUt::StringView(growthRate);
|
||||||
out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness,
|
out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness,
|
||||||
eggGroups);)
|
eggGroups, conversedFlags);)
|
||||||
}
|
}
|
||||||
|
|
||||||
export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; }
|
export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; }
|
||||||
|
@ -31,9 +35,7 @@ export uint8_t PkmnLib_PokemonSpecies_GetEvolutions(const PokemonSpecies* p, con
|
||||||
Try(out = p->GetEvolutions().RawData());
|
Try(out = p->GetEvolutions().RawData());
|
||||||
}
|
}
|
||||||
|
|
||||||
export size_t PkmnLib_PokemonSpecies_GetEggGroupCount(const PokemonSpecies* p) {
|
export size_t PkmnLib_PokemonSpecies_GetEggGroupCount(const PokemonSpecies* p) { return p->GetEggGroups().Count(); }
|
||||||
return p->GetEggGroups().Count();
|
export const char* PkmnLib_PokemonSpecies_GetEggGroup(const PokemonSpecies* p, size_t index) {
|
||||||
}
|
|
||||||
export const char* PkmnLib_PokemonSpecies_GetEggGroup(const PokemonSpecies* p, size_t index){
|
|
||||||
return p->GetEggGroups()[index].c_str();
|
return p->GetEggGroups()[index].c_str();
|
||||||
}
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
#include "PokemonForme.hpp"
|
#include "PokemonForme.hpp"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
PkmnLib::Library::PokemonForme::PokemonForme(const ArbUt::StringView& name, float height, float weight,
|
PkmnLib::Library::PokemonForme::PokemonForme(const ArbUt::StringView& name, float height, float weight,
|
||||||
uint32_t baseExperience, const ArbUt::List<uint8_t>& types,
|
uint32_t baseExperience, const ArbUt::List<uint8_t>& types,
|
||||||
CreatureLib::Library::StatisticSet<uint16_t> baseStats,
|
CreatureLib::Library::StatisticSet<uint16_t> baseStats,
|
||||||
const ArbUt::List<ArbUt::StringView>& talents,
|
const ArbUt::List<ArbUt::StringView>& talents,
|
||||||
const ArbUt::List<ArbUt::StringView>& secretTalents,
|
const ArbUt::List<ArbUt::StringView>& secretTalents,
|
||||||
const CreatureLib::Library::LearnableAttacks* attacks)
|
const CreatureLib::Library::LearnableAttacks* attacks,
|
||||||
: SpeciesVariant(name, height, weight, baseExperience, types, baseStats, talents, secretTalents, attacks) {}
|
std::unordered_set<uint32_t> flags)
|
||||||
|
: SpeciesVariant(name, height, weight, baseExperience, types, baseStats, talents, secretTalents, attacks, std::move(flags)) {}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace PkmnLib::Library {
|
||||||
PokemonForme(const ArbUt::StringView& name, float height, float weight, uint32_t baseExperience,
|
PokemonForme(const ArbUt::StringView& name, float height, float weight, uint32_t baseExperience,
|
||||||
const ArbUt::List<uint8_t>& types, CreatureLib::Library::StatisticSet<uint16_t> baseStats,
|
const ArbUt::List<uint8_t>& types, CreatureLib::Library::StatisticSet<uint16_t> baseStats,
|
||||||
const ArbUt::List<ArbUt::StringView>& talents, const ArbUt::List<ArbUt::StringView>& secretTalents,
|
const ArbUt::List<ArbUt::StringView>& talents, const ArbUt::List<ArbUt::StringView>& secretTalents,
|
||||||
const CreatureLib::Library::LearnableAttacks* attacks);
|
const CreatureLib::Library::LearnableAttacks* attacks, std::unordered_set<uint32_t> flags = {});
|
||||||
|
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -15,8 +15,8 @@ namespace PkmnLib::Library {
|
||||||
public:
|
public:
|
||||||
PokemonSpecies(uint16_t id, const ArbUt::StringView& name, const PokemonForme* defaultForme, float genderRatio,
|
PokemonSpecies(uint16_t id, const ArbUt::StringView& name, const PokemonForme* defaultForme, float genderRatio,
|
||||||
const ArbUt::StringView& growthRate, uint8_t captureRate, uint8_t baseHappiness,
|
const ArbUt::StringView& growthRate, uint8_t captureRate, uint8_t baseHappiness,
|
||||||
const ArbUt::List<ArbUt::StringView>& eggGroups) noexcept
|
const ArbUt::List<ArbUt::StringView>& eggGroups, std::unordered_set<uint32_t> flags = {}) noexcept
|
||||||
: CreatureSpecies(id, name, defaultForme, genderRatio, growthRate, captureRate),
|
: CreatureSpecies(id, name, defaultForme, genderRatio, growthRate, captureRate, flags),
|
||||||
_baseHappiness(baseHappiness), _eggGroups(eggGroups) {}
|
_baseHappiness(baseHappiness), _eggGroups(eggGroups) {}
|
||||||
|
|
||||||
~PokemonSpecies() override = default;
|
~PokemonSpecies() override = default;
|
||||||
|
|
Loading…
Reference in New Issue