Cleanup. Do not access hash contents directly

This commit is contained in:
TheMagnetar 2018-01-29 17:50:12 +01:00
parent 9a1c2b337f
commit 1f603cc814
13 changed files with 39 additions and 39 deletions

View File

@ -80,7 +80,7 @@ class Stage6
};
class Stage7
{
texture="a3\data\env_land_co.paa";
texture="a3\data_f\env_land_co.paa";
uvSource="none";
// uvSource="tex";
// class uvTransform

View File

@ -24,7 +24,7 @@ if (GVAR(ifOpenStart) || {GVAR(uavViewActive)} || {!I_CLOSED}) exitWith {false};
private _ownedDevices = [_target] call EFUNC(bft,getOwnedDevices);
if (count _ownedDevices == 0) exitwith {false};
if (_ownedDevices isEqualTo []) exitwith {false};
private _return = false;
{

View File

@ -18,6 +18,6 @@
#include "script_component.hpp"
[_this select 0,[["mapWorldPos",getPosASL vehicle ACE_player]],true,true] call FUNC(setSettings);
[_this select 0, [["mapWorldPos", getPosASL vehicle ACE_player]], true, true] call FUNC(setSettings);
true
true

View File

@ -88,9 +88,9 @@ if !(GVAR(UAVcams) isEqualTo []) exitWith {
{
if !(isNil "_x") then {
_uav = _x select 0;
_cam = _x select 2;
private _cam = _x select 2;
if (alive _uav) then {
_dir = (_uav selectionPosition (_x select 3)) vectorFromTo (_uav selectionPosition (_x select 4));
private _dir = (_uav selectionPosition (_x select 3)) vectorFromTo (_uav selectionPosition (_x select 4));
_cam setVectorDirAndUp [_dir,_dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]];
} else {
[_cam] call FUNC(deleteUAVcam);

View File

@ -49,7 +49,7 @@ if (_property != "") exitWith {
private _combinedProperties = +_commonProperties;
systemChat format ["Device app data %1", _deviceAppData];
{
[_combinedProperties, _x, (_deviceAppData select 2) select _forEachIndex] call CBA_fnc_hashSet;
} forEach (_deviceAppData select 1);
[_combinedProperties, _x, [_deviceAppData, _x] call CBA_fnc_hashGet] call CBA_fnc_hashSet;
} forEach ([_deviceAppData] call CBA_fnc_hashKeys);
_combinedProperties

View File

@ -26,9 +26,10 @@ uiNamespace setVariable [I_GET_NAME, _display];
// setup bft_drawing
private _mapTypes = [I_GET_ID,"mapTypes"] call FUNC(getSettings);
{
0 = [_display displayCtrl _x] call EFUNC(bft_drawing,doBFTDraw);
} count (_mapTypes select 2);
[_display displayCtrl ([_mapTypes, _x] call CBA_fnc_hashGet)] call EFUNC(bft_drawing,doBFTDraw);
} forEach ([_mapTypes] call CBA_fnc_hashKeys);
// send "bft_deviceOpened" event
["bft_deviceOpened",[I_GET_DEVICE]] call CBA_fnc_localEvent;

View File

@ -1,5 +1,5 @@
/*
* Author: Gundy
* Author: Gundy, TheMagnetar
*
* Description:
* Update current interface (display or dialog) to match current settings.
@ -59,7 +59,7 @@ if (isNil "_mode") then {
{
call {
private _value = (_settings select 2) select _forEachIndex;
private _value = [_settings, _x] call CBA_fnc_hashGet;
if (isNil "_value") exitWith {};
// ------------ DISPLAY POSITION ------------
@ -96,7 +96,7 @@ if (isNil "_mode") then {
[0,0]
} else {
// reset to defaults
_backgroundPosition = [_displayName] call FUNC(getBackgroundPosition);
private _backgroundPosition = [_displayName] call FUNC(getBackgroundPosition);
[(_backgroundPosition select 1 select 0) - (_backgroundPosition select 0 select 0),(_backgroundPosition select 1 select 1) - (_backgroundPosition select 0 select 1)]
};
};
@ -365,7 +365,7 @@ if (isNil "_mode") then {
// ------------ MAP TYPE ------------
if (_x == "mapType") exitWith {
private _mapTypes = [_interfaceID,"mapTypes"] call FUNC(getSettings);
if ((count (_mapTypes select 1) > 1) && (_mode == "BFT")) then {
if ((count ([_mapTypes] call CBA_fnc_hashKeys) > 1) && (_mode == "BFT")) then {
private _targetMapName = _value;
private _targetMapIDC = [_mapTypes, _targetMapName] call CBA_fnc_hashGet;
_targetMapCtrl = _display displayCtrl _targetMapIDC;
@ -373,11 +373,11 @@ if (isNil "_mode") then {
if (!_interfaceInit && _isDialog) then {
private _previousMapCtrl = controlNull;
{
private _previousMapIDC = (_mapTypes select 2) select _forEachIndex;
private _previousMapIDC = ([_mapTypes, _x] call CBA_fnc_hashGet);
_previousMapCtrl = _display displayCtrl _previousMapIDC;
if (ctrlShown _previousMapCtrl) exitWith {};
_previousMapCtrl = controlNull;
} forEach (_mapTypes select 1);
} forEach ([_mapTypes] call CBA_fnc_hashKeys);
// See if _targetMapCtrl is already being shown
if ((!ctrlShown _targetMapCtrl) && (_targetMapCtrl != _previousMapCtrl)) then {
// Update _targetMapCtrl to scale and position of _previousMapCtrl
@ -389,9 +389,9 @@ if (isNil "_mode") then {
// Hide all unwanted map types
{
if (_x != _targetMapName) then {
(_display displayCtrl ((_mapTypes select 2) select _forEachIndex)) ctrlShow false;
(_display displayCtrl ([_mapTypes, _x] call CBA_fnc_hashGet)) ctrlShow false;
};
} forEach (_mapTypes select 1);
} forEach ([_mapTypes] call CBA_fnc_hashKeys);
// Update OSD element if it exists
private _osdCtrl = _display displayCtrl IDC_OSD_MAP_TGGL;
@ -550,7 +550,7 @@ if (isNil "_mode") then {
};
// ----------------------------------
};
} forEach (_settings select 1);
} forEach ([_settings] call CBA_fnc_hashKeys);
// update scale and world position if we have to. If so, fill in the blanks and make the changes
if ((!isNil "_targetMapScale") || (!isNil "_targetMapWorldPos")) then {

View File

@ -20,7 +20,7 @@
params ["_interfaceID"];
private _showIconText = !([_interfaceID,"showIconText"] call FUNC(getSettings));
[_interfaceID,[["showIconText",_showIconText]]] call FUNC(setSettings);
private _showIconText = !([_interfaceID, "showIconText"] call FUNC(getSettings));
[_interfaceID, [["showIconText", _showIconText]]] call FUNC(setSettings);
_showIconText

View File

@ -32,6 +32,6 @@ call {
};
};
};
[_interfaceID,[["mode",_mode]]] call FUNC(setSettings);
[_interfaceID, [["mode",_mode]]] call FUNC(setSettings);
true

View File

@ -20,7 +20,7 @@
params ["_interfaceID"];
private _showMenu = [_interfaceID,"showMenu"] call FUNC(getSettings);
[_interfaceID,[["showMenu",!_showMenu]]] call FUNC(setSettings);
private _showMenu = [_interfaceID, "showMenu"] call FUNC(getSettings);
[_interfaceID, [["showMenu", !_showMenu]]] call FUNC(setSettings);
true

View File

@ -20,7 +20,7 @@
params ["_interfaceID"];
private _newMapTools = !([_interfaceID,"mapTools"] call FUNC(getSettings));
[_interfaceID,[["mapTools",_newMapTools]]] call FUNC(setSettings);
private _newMapTools = !([_interfaceID, "mapTools"] call FUNC(getSettings));
[_interfaceID, [["mapTools", _newMapTools]]] call FUNC(setSettings);
_newMapTools

View File

@ -1,5 +1,5 @@
/*
* Author: Gundy
* Author: Gundy, TheMagnetar
*
* Description:
* Toggle mapType to the next one in the list of available map types
@ -20,20 +20,15 @@
params ["_interfaceID"];
// List of available map types
private _mapTypesHash = [_interfaceID, "mapTypes"] call FUNC(getSettings);
private _mapTypes = [_mapTypesHash] call CBA_fnc_hashKeys;
private _mapTypes = _mapTypesHash select 1;
private _mapTypesIndexes = _mapTypesHash select 2;
systemChat format ["mapTypes %1", _mapTypes];
systemChat format ["mapTypesIndexes %1", _mapTypesIndexes];
// Current map type
private _currentMapType = [_interfaceID, "mapType"] call FUNC(getSettings);
private _currentMapTypeIndex = _mapTypes find _currentMapType;
systemChat format ["currentMapType %1", _currentMapType];
systemChat format ["currentMapIndex %1", _currentMapTypeIndex];
if (_currentMapTypeIndex == (count _mapTypesIndexes) - 1) then {
if (_currentMapTypeIndex == (count _mapTypes) - 1) then {
[_interfaceID, [["mapType", _mapTypes select 0]]] call FUNC(setSettings);
} else {
[_interfaceID, [["mapType", _mapTypes select (_currentMapTypeIndex + 1)]]] call FUNC(setSettings);

View File

@ -20,11 +20,15 @@
params ["_interfaceID"];
private _nightMode = [_interfaceID,"nightMode"] call FUNC(getSettings);
private _nightMode = [_interfaceID, "nightMode"] call FUNC(getSettings);
if (_nightMode != 2) then {
if (_nightMode == 0) then {_nightMode = 1} else {_nightMode = 0};
[_interfaceID,[["nightMode",_nightMode]]] call FUNC(setSettings);
if (_nightMode == 0) then {
_nightMode = 1;
} else {
_nightMode = 0;
};
[_interfaceID, [["nightMode", _nightMode]]] call FUNC(setSettings);
};
true