Make Creature use smart pointers.
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:
@@ -44,7 +44,7 @@ export void CreatureLib_Creature_SetHeldItemFromItem(Creature* p, const Creature
|
||||
}
|
||||
SIMPLE_GET_FUNC(Creature, GetCurrentHealth, uint32_t);
|
||||
SIMPLE_GET_FUNC_SMART_PTR(Creature, GetBattle, Battle*);
|
||||
SIMPLE_GET_FUNC(Creature, GetBattleSide, BattleSide*);
|
||||
SIMPLE_GET_FUNC_SMART_PTR(Creature, GetBattleSide, BattleSide*);
|
||||
SIMPLE_GET_FUNC(Creature, IsOnBattleField, bool);
|
||||
export const char* CreatureLib_Creature_GetNickname(Creature* p) { return p->GetNickname().c_str(); }
|
||||
export size_t CreatureLib_Creature_GetTypesCount(Creature* p) { return p->GetTypes().Count(); }
|
||||
|
||||
@@ -8,6 +8,7 @@ export void CreatureLib_ExperienceLibrary_Destruct(const ExperienceLibrary* p) {
|
||||
|
||||
export uint8_t CreatureLib_ExperienceLibrary_HandleExperienceGain(const ExperienceLibrary* p, Creature* faintedMon,
|
||||
Creature* opponents[], size_t opponentsCount) {
|
||||
Try(auto set = std::unordered_set<Creature*>(opponents, opponents + opponentsCount);
|
||||
p->HandleExperienceGain(faintedMon, set);)
|
||||
Try(auto set = std::unordered_set<ArbUt::BorrowedPtr<Creature>>(opponentsCount);
|
||||
for (size_t i = 0; i < opponentsCount;
|
||||
i++) { set.insert(opponents[i]); } p->HandleExperienceGain(faintedMon, set);)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user