Add faster array compare function

Vanilla commit:

7bbeab4e7d
This commit is contained in:
ebaydayz
2016-08-23 11:17:07 -04:00
parent 8c43b0fc1a
commit d7cc4be585
4 changed files with 17 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ _plant = _this;
if (_plant getVariable["Gathering",false]) exitWith {};
_originalCount = getNumber (configFile >> "CfgVehicles" >> (typeOf _plant) >> "TransportMagazines" >> "_xx_leaf" >> "count");
if !([ [[["equip_comfreyleafs"],[_originalCount]],[[],[]]] , [getMagazineCargo _plant, getWeaponCargo _plant] ] call BIS_fnc_areEqual) then {
if !([ [[["equip_comfreyleafs"],[_originalCount]],[[],[]]] , [getMagazineCargo _plant, getWeaponCargo _plant] ] call fnc_isEqual) then {
//diag_log [ [getMagazineCargo _plant, getWeaponCargo _plant], "!=", [[["equip_comfreyleafs"],[_originalCount]],[[],[]]] ];
_plant setVariable["Gathering",true]; // avoid multiple call because the fn_selfActions is called in an infinite loop
[_this] spawn { // in background to be called after fn_selfActions

View File

@@ -0,0 +1,14 @@
/*
Kilzone_Kid's megafast isEqual function
params [array1,array2]
Examples:
hint str ([[1,2,3], [1,2,3]] call fnc_isEqual); //true
hint str ([[1,[2,[3]]], [1,[2,[3]]]] call fnc_isEqual); //true
hint str ([[1,[2,[3]]], [1,[2,[4]]]] call fnc_isEqual); //false
*/
switch (_this select 0) do {
case (_this select 1) : {true};
default {false};
};

View File

@@ -595,6 +595,7 @@ fnc_veh_handleRepair = compile preprocessFileLineNumbers "\z\addons\dayz_code\co
fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
fnc_veh_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
fnc_isEqual = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isEqual.sqf";
fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";

View File

@@ -334,7 +334,7 @@ createCenter civilian;
actualSpawnMarkerCount = 0;
// count valid spawn markers, since different maps have different amounts
for "_i" from 0 to 10 do {
if !([(getMarkerPos format["spawn%1",_i]), [0,0,0]] call BIS_fnc_areEqual) then {
if !([(getMarkerPos format["spawn%1",_i]), [0,0,0]] call fnc_isEqual) then {
actualSpawnMarkerCount = actualSpawnMarkerCount + 1;
} else {
_i = 11; // exit since we did not find any further markers