Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Caching to CBA_fnc_compatibleItems (Cleanup) #268

Merged
merged 6 commits into from
Mar 6, 2016

Conversation

PabstMirror
Copy link
Contributor

Added fixes and test case to @jokoho48 's #261

@jokoho48
Copy link
Member

from my side this is good to go 👍 but @robalo is the maintainer

@robalo
Copy link
Contributor

robalo commented Feb 22, 2016

I have to catch up with things, don't wait for me. as long as you don't break the function... go for it.
If this will be called for a lot of weapons, should we be concerned about polluting the namespace with a lot of variables ?

@nicolasbadano
Copy link
Contributor

should we be concerned about polluting the namespace with a lot of variables ?

No, don't worry. This PR stores the cache on a dedicated namespace (location).

@@ -1,10 +1,11 @@
/*
Author: Karel Moricky
Enhanced by Robalo
adding Caching by joko // Jonas
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Caching added by..."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D ok will fix it

} 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"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configProperties, isClass

@commy2
Copy link
Contributor

commy2 commented Feb 24, 2016

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.

@Killswitch00
Copy link
Contributor

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?)

@commy2
Copy link
Contributor

commy2 commented Feb 24, 2016

For example when it's used in the main menu with -world="empty" or in a CfgFunctions with preStart = 1;
I really really doubt any addon out there does that, but if there would be, it would crash after this PR.
No MP abuse here.

@PabstMirror
Copy link
Contributor Author

Could leave first function untouched and add a 2nd that does caching.
or if (missionName == "") exitWith {[]};

@commy2
Copy link
Contributor

commy2 commented Feb 24, 2016

That might work, but again. This issue will most likely never happen.

@commy2
Copy link
Contributor

commy2 commented Feb 25, 2016

I was wrong about the crash in the main menu. Can't reproduce anymore. This PR should work.

@Killswitch00
Copy link
Contributor

Fix the comments so we can merge this.

Killswitch00 added a commit that referenced this pull request Mar 6, 2016
Add Caching to CBA_fnc_compatibleItems (Cleanup)
@Killswitch00 Killswitch00 merged commit 5e2aff7 into master Mar 6, 2016
@thojkooi thojkooi deleted the cleanupJrCache branch April 25, 2016 11:33
@commy2 commy2 added this to the 2.3.2 milestone May 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants