Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace AIMaster m_lEventQueue with a priority queue #1537

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Liareth
Copy link
Member

@Liareth Liareth commented Aug 14, 2022

This is a big optimization if your module has a lot of queued events (many areas, many delaycommands, lots of fighting, lots of effects, etc). Previously events that were not immediate would be added to the linked list in AddEventAbsoluteTimeViaTail which would iterate backwards over every calendar entry until it found a place to insert.

Side effect: Events with the same time of day are now executed in an undefined order. E.g:

DelayCommand(0.0f, First());
DelayCommand(0.0f, Second());

Who knows which one will happen first? I certainly don't. But if you don't care about that, and your server is big and full of events, this could be a valuable optimization for you.

Copy link
Member

@Daztek Daztek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a bunch of minor things, also don't forget to update CHANGELOG.md!

Plugins/Optimizations/EventMasterPriorityQueue.cpp Outdated Show resolved Hide resolved
Plugins/Optimizations/EventMasterPriorityQueue.cpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants