Improve OTB loader iteration
Pull Request Prelude
- [x] I have followed proper The Forgotten Server code styling.
- [x] I have read and understood the contribution guidelines before making this PR.
- [x] I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.
Changes Proposed
Improves file loader performance by having less indirection and skipping checks aggressively. Loading the map is at least 20% faster (4s -> 3.2s) on my machine using EPuncker/orts2 map.
When running a release build, most of the sanity checks will be skipped (e.g. checking if the file does not underflow, if the nodes have expected types) since we expect map editors to generate correct map files. The map only needs to be loaded once with a debug build if one wants to make sure it works, so there is no need to check again on every start.
Just learned about [[likely]]/[[unlikely]] in C++20 that allows me to keep ifs instead of asserts with virtually no penalty, but with much better error handling (catchable exceptions with meaningful messages)
I'm still working on it to make a single pass loader, it should save a significant amount of time
Edit: but not today
Why does Windows always have to get in the way