Use pushBackUnique in Tags cache (#4249)

* Use pushBackUnique in tagging

* Use configProperties, Add maintainers

* Fix header

* Revert to configClasses
This commit is contained in:
jonpas 2016-08-18 20:52:28 +02:00 committed by GitHub
parent 986ac43a68
commit ff0dcd3152
3 changed files with 9 additions and 12 deletions

View File

@ -8,4 +8,5 @@ Adds a can of spray paint which allows you to tag buildings, walls and other sta
The people responsible for merging changes to this component or answering potential questions. The people responsible for merging changes to this component or answering potential questions.
- []() - [BaerMitUmlaut](https://github.com/BaerMitUmlaut)
- [Jonpas](https://github.com/jonpas)

View File

@ -13,7 +13,7 @@
* None * None
* *
* Example: * Example:
* ["ace_victoryRed", "Victory Red", "ACE_SpraypaintRed", ["path\to\texture1.paa", "path\to\texture2.paa"], "path\to\icon.paa"] call ace_tagging_fnc_addCustomTagLocal * ["ace_victoryRed", "Victory Red", "ACE_SpraypaintRed", ["path\to\texture1.paa", "path\to\texture2.paa"], "path\to\icon.paa"] call ace_tagging_fnc_applyCustomTag
* *
* Public: No * Public: No
*/ */
@ -22,12 +22,10 @@
params ["_identifier", "_displayName", "_requiredItem"]; params ["_identifier", "_displayName", "_requiredItem"];
// Add only if tag not already added (compare identifiers) // Add only if tag not already added (compare identifiers)
if (GVAR(cachedTags) select {_x select 0 == _identifier} isEqualTo []) then { if !(GVAR(cachedTags) select {_x select 0 == _identifier} isEqualTo []) exitWith {
GVAR(cachedTags) pushBack _this;
if !(_requiredItem in GVAR(cachedRequiredItems)) then {
GVAR(cachedRequiredItems) pushBack _requiredItem;
};
TRACE_1("Added custom script tag",_this);
} else {
ACE_LOGINFO_2("Tag with selected identifier already exists: %1 (%2)",_identifier,_displayName) ACE_LOGINFO_2("Tag with selected identifier already exists: %1 (%2)",_identifier,_displayName)
}; };
GVAR(cachedTags) pushBack _this;
GVAR(cachedRequiredItems) pushBackUnique _requiredItem;
TRACE_1("Added custom script tag",_this);

View File

@ -46,8 +46,6 @@
if (!_failure) then { if (!_failure) then {
GVAR(cachedTags) pushBack [_class, _displayName, _requiredItem, _textures, _icon]; GVAR(cachedTags) pushBack [_class, _displayName, _requiredItem, _textures, _icon];
if !(_requiredItem in GVAR(cachedRequiredItems)) then { GVAR(cachedRequiredItems) pushBackUnique _requiredItem;
GVAR(cachedRequiredItems) pushBack _requiredItem;
};
}; };
} forEach ("true" configClasses (configFile >> "ACE_Tags")); } forEach ("true" configClasses (configFile >> "ACE_Tags"));