Skip to content

Commit

Permalink
convert map-gestures to cba hashes (#4187)
Browse files Browse the repository at this point in the history
  • Loading branch information
commy2 authored and thojkooi committed Jul 30, 2016
1 parent 1f6b10c commit 46adfe1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions addons/map_gestures/functions/fnc_drawMapGestures.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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)};
};
Expand Down
6 changes: 3 additions & 3 deletions addons/map_gestures/functions/fnc_moduleGroupSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 46adfe1

Please sign in to comment.