Skip to content

Add Caching to CBA_fnc_compatibleItems (Cleanup)#268

Merged
Killswitch00 merged 6 commits intomasterfrom
cleanupJrCache
Mar 6, 2016
Merged

Add Caching to CBA_fnc_compatibleItems (Cleanup)#268
Killswitch00 merged 6 commits intomasterfrom
cleanupJrCache

Conversation

@PabstMirror
Copy link
Copy Markdown
Contributor

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

@jokoho48
Copy link
Copy Markdown
Member

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

@robalo
Copy link
Copy Markdown
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
Copy Markdown
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).

Comment thread addons/jr/fnc_compatibleItems.sqf Outdated
/*
Author: Karel Moricky
Enhanced by Robalo
adding Caching by joko // Jonas
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread addons/jr/fnc_compatibleItems.sqf Outdated
} 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@commy2
Copy link
Copy Markdown
Contributor

commy2 commented Feb 24, 2016

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

@commy2
Copy link
Copy Markdown
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
Copy Markdown
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.

6 participants