mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-11 09:22:41 +00:00
## About The Pull Request Adds a check for icon state existence in spritesheet insert, run during unit tests. ## Why It's Good For The Game Inserting a nonexistent icon state via `Insert()` will corrupt the spritesheet it's inserted to, resulting in offsets being incorrect—specifically, it results in the entire icon's contents being inserted. This happened downstream on Doppler Shift and broke language icons. I fixed the issue there but figured that there should be a check upstream for it. `if (!I || !length(icon_states(I))) // that direction or state doesn't exist)` This check doesn't catch it, by the way. Since it returns the entire icon file, `length(icon_states(I))` is >0. You could do `length(icon_states) != 1`, but then it still wouldn't catch cases where there's a single-icon-state icon *and* the icon_state is invalid. Boo. A test like this is the best option. I tried using the rust-g variant of icon_states and sort-of got it working, but I figured it'd be too fragile to justify given that it doesn't accept actual icon instances, only paths.