Added display text event hook.

This commit is contained in:
2020-03-09 17:43:36 +01:00
parent 314b8997be
commit 5a976e4031
6 changed files with 16 additions and 3 deletions

View File

@@ -130,3 +130,4 @@ void Battle::AddVolatileScript(const ConstString& key) {
}
void Battle::AddVolatileScript(Script* script) { return _volatile.Add(script); }
void Battle::RemoveVolatileScript(Script* script) { _volatile.Remove(script->GetName()); }
void Battle::DisplayText(const std::string& text) const { TriggerEventListener(new DisplayTextEvent(text)); }

View File

@@ -89,8 +89,9 @@ namespace CreatureLib::Battling {
bool HasVolatileScript(const ConstString& name) const { return _volatile.Has(name); }
bool HasVolatileScript(uint32_t keyHash) const { return _volatile.Has(keyHash); }
void DisplayText(const std::string& text) const;
void RegisterEventListener(EVENT_HOOK_FUNC(listener)) { this->_eventHook.RegisterListener(listener); }
void TriggerEventListener(EventData* data) { this->_eventHook.TriggerEvent(data); }
void TriggerEventListener(EventData* data) const { this->_eventHook.TriggerEvent(data); }
};
}