From 3f7fe6f8a51f61083b4940eaadddc3b390f8e238 Mon Sep 17 00:00:00 2001 From: xinef1 Date: Mon, 6 Feb 2017 01:10:15 +0100 Subject: Core/Spells: Remade trajectory target selection (#19048) * Remade trajectory target selection * Added possibility to apply conditions to trajectory spells * Properly recalculate delay time if CMSG_UPDATE_PROJECTILE_POSITION is received (cherrypicked from c6060dd0c511ddad3cb1f0423aa9ccf2de7aedec) --- src/common/Utilities/EventProcessor.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/common/Utilities/EventProcessor.cpp') diff --git a/src/common/Utilities/EventProcessor.cpp b/src/common/Utilities/EventProcessor.cpp index 41fcc1fe8f7..9df76f96438 100644 --- a/src/common/Utilities/EventProcessor.cpp +++ b/src/common/Utilities/EventProcessor.cpp @@ -119,6 +119,20 @@ void EventProcessor::AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime m_events.insert(std::pair(e_time, Event)); } +void EventProcessor::ModifyEventTime(BasicEvent* Event, uint64 newTime) +{ + for (auto itr = m_events.begin(); itr != m_events.end(); ++itr) + { + if (itr->second != Event) + continue; + + Event->m_execTime = newTime; + m_events.erase(itr); + m_events.insert(std::pair(newTime, Event)); + break; + } +} + uint64 EventProcessor::CalculateTime(uint64 t_offset) const { return(m_time + t_offset); -- cgit v1.2.3