Change count back to forEach - fix empty safes

See Kronzky's note:
https://community.bistudio.com/wiki/count

You can only use count to iterate through an array if all elements in the array are of the same data type. In this case you have an array with strings (type), arrays (worldspace, inventory, hitpoints) and numbers (fuel, ownerID). You need to use forEach instead. 

This error explains the problem people were having with safe inventories being empty when they open them after a restart:
http://epochmod.com/forum/index.php?/topic/13423-safe-is-empty-after-restart-if-you-open-it/
https://github.com/vbawol/DayZ-Epoch/issues/1368
https://github.com/vbawol/DayZ-Epoch/issues/1422
This commit is contained in:
ebaydayz
2014-07-29 15:50:53 -04:00
parent ec1308afd6
commit 0d5d0b9b8e

View File

@@ -256,7 +256,7 @@ if (isServer && isNil "sm_done") then {
//Monitor the object //Monitor the object
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object]; PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
}; };
} count (_BuildingQueue + _objectQueue); } forEach (_BuildingQueue + _objectQueue);
// # END SPAWN OBJECTS # // # END SPAWN OBJECTS #
// preload server traders menu data into cache // preload server traders menu data into cache