Uh oh!
There was an error while loading. Please reload this page.
Optimize GetContinentInstanceId - #3054
Conversation
ratkosrb
commented
May 31, 2025
Why move those to the header file? They are not used outside the file. No need to expose them. Also now if anyone edits the boundaries it will recompile most of the core because it's in a header. |
Gamemechanicwow
commented
Jun 18, 2025
Ye, from that perspective I guess it makes sense to keep them in the .cpp file. I have moved the constants to the .cpp file. Also marked this PR as a draft, since there might be an edgecase with the orgrimmar boundary. It's a small area that doesn't contain any creatures, so my initial test didn't catch it. |
Gamemechanicwow
commented
Jun 27, 2025
Diagram showing the 3 types of early outs: 1 - Player is more south than the most southern point in the boundary line, so the player can't be in this area |
Uh oh!
There was an error while loading. Please reload this page.

🍰 Pullrequest
Optimizes GetContinentInstanceId() by precalculating boundaries needed to do early returns.
Example of existing lines that are used to calculated ContinentInstanceId:

(Crude mock up. Boundary lines might be off)
Image of orc/troll starting zone, with its own continentinstanceid - show with lines that indicate boundaries and their early return values

Test show high potential for performance gains

Test explained:
Notes:
Could use better codeformatting.
Maybe better naming of structs, vars etc.
Alternative solution
Remove struct and makeboundary - and just add the boundary as constants to function call:
if (IsNorthTo(x, y, topNorthSouthBoundary, yyy, YYY, xxx, XXX))
return MAP0_TOP_NORTH;
Upside: less code needed.
Downside: if someone is to edit limits, they also manually need to update the numbers in the function call
Proof
Issues
How2Test
Todo / Checklist