convert map-gestures to cba hashes (#4187)

This commit is contained in:
commy2 2016-07-30 17:17:52 +02:00 committed by Glowbal
parent 1f6b10c4cb
commit 46adfe1150
2 changed files with 5 additions and 5 deletions

View File

@ -46,8 +46,8 @@ params ["_mapHandle"];
_grpName = groupID _group;
// If color settings for the group exist, then use those, otherwise fall back to the default colors
_color = if (HASH_HASKEY(GVAR(GroupColorConfigurationMapping),_grpName)) then {
(GVAR(GroupColorConfigurations) select (HASH_GET(GVAR(GroupColorConfigurationMapping),_grpName))) select (_x != leader _group)
_color = if ([GVAR(GroupColorConfigurationMapping), _grpName] call CBA_fnc_hashHasKey) then {
(GVAR(GroupColorConfigurations) select ([GVAR(GroupColorConfigurationMapping), _grpName] call CBA_fnc_hashGet)) select (_x != leader _group)
} else {
if (_x == leader _group) then {GVAR(defaultLeadColor)} else {GVAR(defaultColor)};
};

View File

@ -31,15 +31,15 @@ if (!([_color] call FUNC(isValidColorArray))) exitWith {ERROR("color is not a va
// If we already have color configurations from another source, use those, otherwise use default.
_configurations = if (isNil QGVAR(GroupColorConfigurations)) then { [] } else { +GVAR(GroupColorConfigurations) };
_configurationGroupMappings = if(isNil QGVAR(GroupColorConfigurationMapping)) then { HASH_CREATE } else { +GVAR(GroupColorConfigurationMapping) };
_configurationGroupMappings = if(isNil QGVAR(GroupColorConfigurationMapping)) then { [] call CBA_fnc_hashCreate } else { +GVAR(GroupColorConfigurationMapping) };
// Save custom color configuration and keep the index of the entry.
_configurationIndex = _configurations pushBack [_leadColor, _color];
// Add all synchronized groups and reference custom configuration for them
{
HASH_SET(_configurationGroupMappings,groupID (group _x),_configurationIndex);
} count _units;
[_configurationGroupMappings, groupID group _x, _configurationIndex] call CBA_fnc_hashSet;
} forEach _units;
[QGVAR(GroupColorConfigurations), _configurations, false, true] call EFUNC(common,setSetting);
[QGVAR(GroupColorConfigurationMapping), _configurationGroupMappings, false, true] call EFUNC(common,setSetting);