convert laser to cba hashes (#4186)

This commit is contained in:
commy2 2016-07-30 17:16:29 +02:00 committed by Glowbal
parent c117a79431
commit 1f6b10c4cb
5 changed files with 12 additions and 12 deletions

View File

@ -11,6 +11,6 @@ ACE_DEFAULT_LASER_CODE = 1001;
ACE_DEFAULT_LASER_WAVELENGTH = 1550;
ACE_DEFAULT_LASER_BEAMSPREAD = 1;
GVAR(laserEmitters) = HASH_CREATE;
GVAR(laserEmitters) = [] call CBA_fnc_hashCreate;
ADDON = true;

View File

@ -5,5 +5,5 @@ ACE_LOGINFO("Laser Emitter Dump");
{
ACE_LOGINFO_1(" %1", _x);
ACE_LOGINFO_1(" %1",HASH_GET(GVAR(laserEmitters),_x));
} forEach GVAR(laserEmitters) select 0;
ACE_LOGINFO_1(" %1",[ARR_2(GVAR(laserEmitters),_x)] call CBA_fnc_hashGet);
} forEach (GVAR(laserEmitters) select 1);

View File

@ -3,6 +3,6 @@
private ["_uuid"];
_uuid = _this select 0;
if(HASH_HASKEY(GVAR(laserEmitters), _uuid)) then {
HASH_REM(GVAR(laserEmitters), _uuid);
if ([GVAR(laserEmitters), _uuid] call CBA_fnc_hashHasKey) then {
[GVAR(laserEmitters), _uuid] call CBA_fnc_hashRem;
};

View File

@ -4,4 +4,4 @@
private ["_uuid", "_args"];
_uuid = _this select 0;
_args = _this select 1;
HASH_SET(GVAR(laserEmitters), _uuid, _args);
[GVAR(laserEmitters), _uuid, _args] call CBA_fnc_hashSet;

View File

@ -76,7 +76,7 @@ _finalOwner = nil;
} forEach (_res select 2);
};
};
} forEach (GVAR(laserEmitters) select 1);
} forEach (GVAR(laserEmitters) select 2);
if((count _spots) > 0) then {
_bucketPos = nil;
@ -123,7 +123,7 @@ if((count _spots) > 0) then {
} forEach _buckets;
_finalBucket = _finalBuckets select _largestIndex;
_owners = HASH_CREATE;
_owners = [] call CBA_fnc_hashCreate;
if(count _finalBucket > 0) then {
_avgX = 0;
@ -135,11 +135,11 @@ if((count _spots) > 0) then {
_avgY = _avgY + ((_x select 0) select 1);
_avgZ = _avgZ + ((_x select 0) select 2);
_owner = _x select 1;
if(HASH_HASKEY(_owners, _owner)) then {
_count = HASH_GET(_owners, _owner);
HASH_SET(_owners, _owner, _count+1);
if ([_owners, _owner] call CBA_fnc_hashHasKey) then {
private _count = [_owners, _owner] call CBA_fnc_hashGet;
[_owners, _owner, _count + 1] call CBA_fnc_hashSet;
} else {
HASH_SET(_owners, _owner, 1);
[_owners, _owner, 1] call CBA_fnc_hashSet;
};
} forEach _finalBucket;
_count = count _finalBucket;