Replace most collections with Arbutils collections for more safety.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
using namespace CreatureLib::Library;
|
||||
|
||||
export GrowthRate* CreatureLib_LookupGrowthRate_Construct(uint32_t experiencePerLevel[], size_t count) {
|
||||
std::vector<uint32_t> exp(experiencePerLevel, experiencePerLevel + count);
|
||||
Arbutils::Collections::List<uint32_t> exp(experiencePerLevel, experiencePerLevel + count);
|
||||
return new LookupGrowthRate(exp);
|
||||
};
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ export void CreatureLib_LearnableAttacks_AddLevelMove(LearnableAttacks* p, uint8
|
||||
}
|
||||
|
||||
export const AttackData* const* CreatureLib_LearnableAttacks_GetAttacksForLevel(LearnableAttacks* p, uint8_t level) {
|
||||
return p->GetAttacksForLevel(level).data();
|
||||
return p->GetAttacksForLevel(level).RawData();
|
||||
}
|
||||
export size_t CreatureLib_LearnableAttacks_GetAttacksForLevelCount(LearnableAttacks* p, uint8_t level) {
|
||||
return p->GetAttacksForLevel(level).size();
|
||||
return p->GetAttacksForLevel(level).Count();
|
||||
}
|
||||
@@ -10,17 +10,17 @@ export SpeciesVariant* CreatureLib_SpeciesVariant_Construct(
|
||||
uint16_t baseMagicalDefense, uint8_t baseSpeed, const char* talents[], size_t talentsLength,
|
||||
const char* secretTalents[], size_t secretTalentsLength, const LearnableAttacks* attacks) {
|
||||
|
||||
auto talentsWrapped = std::vector<ConstString>(talentsLength);
|
||||
auto talentsWrapped = Arbutils::Collections::List<ConstString>(talentsLength);
|
||||
for (size_t i = 0; i < talentsLength; i++) {
|
||||
talentsWrapped[i] = ConstString(talents[i]);
|
||||
}
|
||||
auto secretTalentsWrapped = std::vector<ConstString>(secretTalentsLength);
|
||||
auto secretTalentsWrapped = Arbutils::Collections::List<ConstString>(secretTalentsLength);
|
||||
for (size_t i = 0; i < secretTalentsLength; i++) {
|
||||
secretTalentsWrapped[i] = ConstString(secretTalents[i]);
|
||||
}
|
||||
|
||||
return new SpeciesVariant(Arbutils::CaseInsensitiveConstString(name), height, weight, baseExperience,
|
||||
std::vector<uint8_t>(types, types + typeLength),
|
||||
Arbutils::Collections::List<uint8_t>(types, types + typeLength),
|
||||
CreatureLib::Library::StatisticSet<uint16_t>(baseHealth, baseAttack, baseDefense,
|
||||
baseMagicalAttack, baseMagicalDefense,
|
||||
baseSpeed),
|
||||
|
||||
@@ -33,5 +33,5 @@ export float CreatureLib_TypeLibrary_GetSingleEffectiveness(TypeLibrary* p, uint
|
||||
|
||||
export float CreatureLib_TypeLibrary_GetEffectiveness(TypeLibrary* p, uint8_t attacking, uint8_t defensive[],
|
||||
size_t defensiveCount) {
|
||||
return p->GetEffectiveness(attacking, std::vector<uint8_t>(defensive, defensive + defensiveCount));
|
||||
return p->GetEffectiveness(attacking, List<uint8_t>(defensive, defensive + defensiveCount));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user