Fix tagging model cache (#5055)

This commit is contained in:
PabstMirror
2017-04-11 10:12:03 -05:00
committed by GitHub
parent 6c592e5a10
commit f44da354d5
3 changed files with 12 additions and 22 deletions

View File

@ -16,7 +16,7 @@ for "_index" from 0 to (_countOptions - 1) do {
private _model = getText (_cfgClass >> "model"); private _model = getText (_cfgClass >> "model");
if (_model != "") then { if (_model != "") then {
private _array = _model splitString "\"; private _array = _model splitString "\";
GVAR(cacheStaticModels) setVariable [toLower (_array select ((count _array) - 2)), _cfgClass]; GVAR(cacheStaticModels) setVariable [(_array select ((count _array) - 1)), true];
}; };
}; };
}; };
@ -32,7 +32,7 @@ for "_index" from 0 to (_countOptions - 1) do {
private _model = getText (_cfgClass >> "model"); private _model = getText (_cfgClass >> "model");
if (_model != "") then { if (_model != "") then {
private _array = _model splitString "\"; private _array = _model splitString "\";
GVAR(cacheStaticModels) setVariable [toLower (_array select ((count _array) - 2)), _cfgClass]; GVAR(cacheStaticModels) setVariable [(_array select ((count _array) - 1)), true];
}; };
}; };
}; };

View File

@ -9,16 +9,14 @@
* Is surface taggable <BOOL> * Is surface taggable <BOOL>
* *
* Example: * Example:
* [unit] call ace_tagging_fnc_checkTaggable * [player] call ace_tagging_fnc_checkTaggable
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit"]; [_this, {
[[_unit], {
params ["_unit"]; params ["_unit"];
// Exit if no required item in inventory // Exit if no required item in inventory
@ -45,15 +43,11 @@ params ["_unit"];
if (_object isKindOf "Static") exitWith {false}; if (_object isKindOf "Static") exitWith {false};
// If the class is not categorized correctly search the cache // If the class is not categorized correctly search the cache
private _array = str(_object) splitString " "; private _modelName = (getModelInfo _object) select 0;
private _str = toLower (_array select 1); private _isStatic = GVAR(cacheStaticModels) getVariable [_modelName, false];
TRACE_1("Object:",_str); TRACE_2("Object:",_modelName,_isStatic);
private _objClass = GVAR(cacheStaticModels) getVariable _str;
// If the class in not on the cache, exit // If the class in not on the cache, exit
if (isNil "_objClass") exitWith { (!_isStatic)
false
};
true
}) exitWith { }) exitWith {
TRACE_1("Pointed object is non static",_object); TRACE_1("Pointed object is non static",_object);
false false

View File

@ -49,15 +49,11 @@ if ((!isNull _object) && {
if (_object isKindOf "Static") exitWith {false}; if (_object isKindOf "Static") exitWith {false};
// If the class is not categorized correctly search the cache // If the class is not categorized correctly search the cache
private _array = str(_object) splitString " "; private _modelName = (getModelInfo _object) select 0;
private _str = toLower (_array select 1); private _isStatic = GVAR(cacheStaticModels) getVariable [_modelName, false];
TRACE_1("Object:",_str); TRACE_2("Object:",_modelName,_isStatic);
private _objClass = GVAR(cacheStaticModels) getVariable _str;
// If the class in not on the cache, exit // If the class in not on the cache, exit
if (isNil "_objClass") exitWith { (!_isStatic)
false
};
true
}) exitWith { }) exitWith {
TRACE_1("Pointed object is non static",_object); TRACE_1("Pointed object is non static",_object);
false false