Optimize GetContinentInstanceId#3054
Optimize GetContinentInstanceId#3054Gamemechanicwow wants to merge 5 commits intovmangos:developmentfrom
Conversation
|
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. |
|
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. |
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 |

🍰 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