Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PORT] GetFlatIcon improvements (#3422)
* GetFlatIcon improvements. (#86077) ## About The Pull Request I've added an get_icon_dimensions() call to a place where `icon.Width()` and `icon.Height()` are called twice each. get_icon_dimensions uses a cache of values so follow-up getFlatIcon() calls with the same current icon won't have it call`icon.Width()` or `icon.Height()` which aren't exactly cheap procs iirc. I've also removed two of the fairly expensive `length(icon_states(icon(curicon, curstate, dir)))` checks, because all icon states have NORTH, EAST and WEST directions except 1-dir icon_states which are always facing SOUTH. That is, unless there is some farfetched procgenned bullshit that's probably not even possible and worth checking against. We'll see. ## Why It's Good For The Game GetFlatIcon is a very expensive proc, every bit of improvement is worth it. ## Changelog N/A * backport some other getFlatIcon improvements so it compiles --------- Co-authored-by: Ghom <[email protected]>
- Loading branch information