some optimisations (thanks skaro for advice)

This commit is contained in:
Zac Surplice
2013-12-23 13:18:03 +11:00
parent 23d555a529
commit d5a0ec41b1

View File

@@ -50,6 +50,9 @@ if (isServer and isNil "sm_done") then {
}; };
}; };
_BuildingQueue = [];
_objectQueue = [];
_objectArray = []; _objectArray = [];
if ((_hiveResponse select 0) == "ObjectStreamStart") then { if ((_hiveResponse select 0) == "ObjectStreamStart") then {
_objectCount = _hiveResponse select 1; _objectCount = _hiveResponse select 1;
@@ -58,47 +61,26 @@ if (isServer and isNil "sm_done") then {
_hiveResponse = _key call server_hiveReadWriteLarge; _hiveResponse = _key call server_hiveReadWriteLarge;
_objectArray set [_i - 1, _hiveResponse]; _objectArray set [_i - 1, _hiveResponse];
//diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]); //diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
_type = (_hiveResponse select _i) select 2;
switch true do {
case (_type isKindOf "ModularItems"): {
_BuildingQueue set [(count _BuildingQueue),_hiveResponse];
};
default {
_objectQueue set [(count _objectQueue),_hiveResponse];
};
};
}; };
diag_log ("HIVE: got " + str(count _objectArray) + " objects"); diag_log ("HIVE: got " + str(count _objectArray) + " objects");
}; };
dayz_BuildingQueue = []; _spawnSort = [_BuildingQueue,_objectQueue]; // Put arrays in order that you wish them to spawn
dayz_objectQueue = [];
// # START OF STREAMING #
_countr = 0;
{
//Parse Array
_countr = _countr + 1;
_idKey = _x select 1;
_type = _x select 2;
_ownerID = _x select 3;
_worldspace = _x select 4;
_intentory= _x select 5;
_hitPoints= _x select 6;
_fuel = _x select 7;
_damage = _x select 8;
_objArray = [_countr,_idKey,_type,_ownerID,_worldspace,_intentory,_hitPoints,_fuel,_damage];
switch true do {
case (_type isKindOf "ModularItems"): {
dayz_BuildingQueue set [(count dayz_BuildingQueue),_objArray];
};
default {
dayz_objectQueue set [(count dayz_objectQueue),_objArray];
};
};
} forEach _objectArray;
// # END OF STREAMING #
// # NOW SPAWN OBJECTS # // # NOW SPAWN OBJECTS #
_totalvehicles = 0; _totalvehicles = 0;
{ {
_ObjArray = _x;
{ {
_idKey = _x select 1; _idKey = _x select 1;
_type = _x select 2; _type = _x select 2;
@@ -274,11 +256,8 @@ if (isServer and isNil "sm_done") then {
//Monitor the object //Monitor the object
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object]; PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
}; };
} forEach _ObjArray; } forEach _x;
} forEach [dayz_BuildingQueue,dayz_objectQueue]; // Put arrays in order that you wish them to spawn } forEach _spawnSort;
dayz_BuildingQueue = nil;
dayz_objectQueue = nil;
// # END SPAWN OBJECTS # // # END SPAWN OBJECTS #