Optimize GetContinentInstanceId #3054
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

🍰 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