Added Remove Volatile functions for battle and creatures.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-02-23 11:11:47 +01:00
parent 645ba95bbc
commit 5f891cd4ed
4 changed files with 20 additions and 9 deletions

View File

@@ -76,15 +76,10 @@ namespace CreatureLib::Battling {
const std::vector<BattleSide*>& GetSides() const { return _sides; }
Script* GetVolatileScript(const std::string& key) const { return _volatile.Get(key); }
void AddVolatileScript(const std::string& key) {
auto script = _volatile.Get(key);
if (script != nullptr) {
script->Stack();
return;
}
script = _library->LoadScript(ScriptCategory::Battle, key);
return _volatile.Add(script);
}
void AddVolatileScript(const std::string& key);
void AddVolatileScript(Script* script);
void RemoveVolatileScript(const std::string& name);
void RemoveVolatileScript(Script* script);
void RegisterEventListener(EVENT_HOOK_FUNC(listener)) { this->_eventHook.RegisterListener(listener); }
void TriggerEventListener(EventData* data) { this->_eventHook.TriggerEvent(data); }