Improved the time it takes to open the loadout editor window on a 400x400 map from 5 seconds to pretty much instant
Similarly improved the performance of the generic tab
Re-added the visibility check for greying out items
Other logic should be unchanged
Reasoning
The previous implementation searches through every selectable thing on the map for every item in the list. That's a lot, especially for big and mountanous maps. Now it's only done once each time you open the window or the generic tab. The rest of the lookups go through a distinct list of defs found, which is much, much smaller.
That frees up a lot of performance to reimplement the visibility check that was deemed "CPU expensive!" before.
Changes
Reasoning
The previous implementation searches through every selectable thing on the map for every item in the list. That's a lot, especially for big and mountanous maps. Now it's only done once each time you open the window or the generic tab. The rest of the lookups go through a distinct list of defs found, which is much, much smaller. That frees up a lot of performance to reimplement the visibility check that was deemed "CPU expensive!" before.
Testing
Check tests you have performed: