Add Caching to CBA_fnc_compatibleItems (Cleanup)#268
Conversation
|
from my side this is good to go 👍 but @robalo is the maintainer |
|
I have to catch up with things, don't wait for me. as long as you don't break the function... go for it. |
No, don't worry. This PR stores the cache on a dedicated namespace (location). |
| /* | ||
| Author: Karel Moricky | ||
| Enhanced by Robalo | ||
| adding Caching by joko // Jonas |
There was a problem hiding this comment.
"Caching added by..."
| } foreach configproperties [_cfgWeapon >> "WeaponSlotsInfo","isclass _x"]; | ||
| if (_typefilter == 0) then {_compatibleItems} else {[_compatibleItems, {_typefilter == getnumber(configfile>>"cfgweapons">>_x>>"itemInfo">>"type")}] call BIS_fnc_conditionalSelect}; | ||
| nil | ||
| } count configproperties [_cfgWeapon >> "WeaponSlotsInfo","isclass _x"]; |
There was a problem hiding this comment.
configProperties, isClass
|
This has one drawback. createLocation crashes the game when no mission is there. Really minor, but we don't know all the ways this function could be used. |
|
Crashing the game doesn't sound minor to me. Please elaborate on "when no mission is there" and when/how the crash happens. (Potential for MP abuse?) |
|
For example when it's used in the main menu with |
|
Could leave first function untouched and add a 2nd that does caching. |
|
That might work, but again. This issue will most likely never happen. |
|
I was wrong about the crash in the main menu. Can't reproduce anymore. This PR should work. |
|
Fix the comments so we can merge this. |
Add Caching to CBA_fnc_compatibleItems (Cleanup)
Added fixes and test case to @jokoho48 's #261