Changed LoadScript to StringView.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-06-26 18:23:40 +02:00
parent 48639eeee5
commit 772619db0f
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
7 changed files with 7 additions and 9 deletions

View File

@ -44,6 +44,6 @@ const std::unique_ptr<const DamageLibrary>& BattleLibrary::GetDamageLibrary() co
const std::unique_ptr<const MiscLibrary>& BattleLibrary::GetMiscLibrary() const noexcept { return _miscLibrary; } const std::unique_ptr<const MiscLibrary>& BattleLibrary::GetMiscLibrary() const noexcept { return _miscLibrary; }
Script* BattleLibrary::LoadScript(ScriptCategory category, const ArbUt::BasicStringView& scriptName) const { Script* BattleLibrary::LoadScript(ScriptCategory category, const ArbUt::StringView& scriptName) const {
return _scriptResolver->LoadScript(category, scriptName); return _scriptResolver->LoadScript(category, scriptName);
} }

View File

@ -41,7 +41,7 @@ namespace CreatureLib::Battling {
return _experienceLibrary; return _experienceLibrary;
} }
[[nodiscard]] Script* LoadScript(ScriptCategory category, const ArbUt::BasicStringView& scriptName) const; [[nodiscard]] Script* LoadScript(ScriptCategory category, const ArbUt::StringView& scriptName) const;
}; };
} }

View File

@ -129,7 +129,7 @@ void Battle::ValidateBattleState() {
this->_battleResult = BattleResult::Conclusive(winningSide); this->_battleResult = BattleResult::Conclusive(winningSide);
this->_hasEnded = true; this->_hasEnded = true;
} }
void Battle::AddVolatileScript(const ArbUt::BasicStringView& key) { void Battle::AddVolatileScript(const ArbUt::StringView& key) {
auto script = _volatile.Get(key); auto script = _volatile.Get(key);
if (script != nullptr) { if (script != nullptr) {
script->Stack(); script->Stack();

View File

@ -85,7 +85,7 @@ namespace CreatureLib::Battling {
const ArbUt::UniquePtrList<BattleSide>& GetSides() const noexcept { return _sides; } const ArbUt::UniquePtrList<BattleSide>& GetSides() const noexcept { return _sides; }
ArbUt::BorrowedPtr<Script> GetVolatileScript(const ArbUt::StringView& key) const { return _volatile.Get(key); } ArbUt::BorrowedPtr<Script> GetVolatileScript(const ArbUt::StringView& key) const { return _volatile.Get(key); }
ArbUt::BorrowedPtr<Script> GetVolatileScript(uint32_t keyHash) const noexcept { return _volatile.Get(keyHash); } ArbUt::BorrowedPtr<Script> GetVolatileScript(uint32_t keyHash) const noexcept { return _volatile.Get(keyHash); }
void AddVolatileScript(const ArbUt::BasicStringView& key); void AddVolatileScript(const ArbUt::StringView& key);
void AddVolatileScript(Script* script); void AddVolatileScript(Script* script);
void RemoveVolatileScript(const ArbUt::BasicStringView& name) { _volatile.Remove(name); } void RemoveVolatileScript(const ArbUt::BasicStringView& name) { _volatile.Remove(name); }
void RemoveVolatileScript(uint32_t keyHash) { _volatile.Remove(keyHash); } void RemoveVolatileScript(uint32_t keyHash) { _volatile.Remove(keyHash); }

View File

@ -239,7 +239,7 @@ void Battling::Creature::SetHeldItem(uint32_t itemNameHash) {
_heldItem = item; _heldItem = item;
} }
void Battling::Creature::AddVolatileScript(const ArbUt::BasicStringView& name) { void Battling::Creature::AddVolatileScript(const ArbUt::StringView& name) {
auto script = _volatile.Get(name); auto script = _volatile.Get(name);
if (script != nullptr) { if (script != nullptr) {
script->Stack(); script->Stack();

View File

@ -128,7 +128,7 @@ namespace CreatureLib::Battling {
size_t ScriptCount() const override; size_t ScriptCount() const override;
void GetActiveScripts(ArbUt::List<ScriptWrapper>& scripts) override; void GetActiveScripts(ArbUt::List<ScriptWrapper>& scripts) override;
void ClearVolatileScripts(); void ClearVolatileScripts();
void AddVolatileScript(const ArbUt::BasicStringView& name); void AddVolatileScript(const ArbUt::StringView& name);
void AddVolatileScript(Script* script); void AddVolatileScript(Script* script);
void RemoveVolatileScript(const ArbUt::BasicStringView& name); void RemoveVolatileScript(const ArbUt::BasicStringView& name);
void RemoveVolatileScript(Script* script); void RemoveVolatileScript(Script* script);

View File

@ -14,9 +14,7 @@ namespace CreatureLib::Battling {
virtual ~ScriptResolver() = default; virtual ~ScriptResolver() = default;
virtual void Initialize(BattleLibrary* library){}; virtual void Initialize(BattleLibrary* library){};
virtual Script* LoadScript(ScriptCategory category, const ArbUt::BasicStringView& scriptName) { virtual Script* LoadScript(ScriptCategory category, const ArbUt::StringView& scriptName) { return nullptr; };
return nullptr;
};
}; };
} }