exit loop if _shipwrecks array is empty

ref https://github.com/EpochModTeam/Epoch/issues/947
This commit is contained in:
vbawol 2017-10-25 19:43:13 -05:00
parent 813ee76427
commit 5c3d589443

View File

@ -20,7 +20,8 @@ if (getNumber(_cfgEpoch >> "shipwreckLootEnabled") isEqualTo 1) then {
_worldSize = worldSize/2;
_shipwrecks = nearestTerrainObjects [ [_worldSize, _worldSize], ["SHIPWRECK"], _worldSize];
_total = getNumber(_cfgEpoch >> "maxSpawnedShipwrecks");
for "_i" from 0 to _total-1 do{
for "_i" from 1 to _total do {
if (_shipwrecks isEqualTo []) exitWith {};
_wreck = selectRandom _shipwrecks;
_shipwrecks = _shipwrecks - [_wreck];
_item = createVehicle["container_epoch", _wreck, [], 0, "NONE"];
@ -29,4 +30,4 @@ if (getNumber(_cfgEpoch >> "shipwreckLootEnabled") isEqualTo 1) then {
_markers = ["Shipwreck",_wreck] call EPOCH_server_createGlobalMarkerSet;
};
};
};
};