Moved Creature types to creature itself, instead of using the variant types.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-06-05 16:38:27 +02:00
parent 3c5b3d5c03
commit 9e7607338f
7 changed files with 13 additions and 13 deletions

View File

@@ -25,6 +25,9 @@ Battling::Creature::Creature(ArbUt::BorrowedPtr<const BattleLibrary> library,
if (_nickname.empty()) {
_nickname = species->GetName().std_str();
}
for (auto t : _variant->GetTypes()) {
_types.insert(t);
}
}
void Battling::Creature::ChangeLevelBy(int8_t amount) {
@@ -146,14 +149,10 @@ void Battling::Creature::OverrideActiveTalent(const ConstString& talent) {
_activeTalent.reset(this->_library->LoadScript(ScriptCategory::Talent, talent));
}
const ArbUt::List<uint8_t>& Battling::Creature::GetTypes() const noexcept {
// HOOK: override types.
return this->_variant->GetTypes();
}
const std::unordered_set<uint8_t>& Battling::Creature::GetTypes() const noexcept { return _types; }
bool Battling::Creature::HasType(uint8_t type) const noexcept {
auto t = GetTypes();
return std::find(t.begin(), t.end(), type) != t.end();
return std::find(_types.begin(), _types.end(), type) != _types.end();
}
size_t Battling::Creature::ScriptCount() const {