From 5c3d589443cf75f27ffc27cacae594ec6431dde5 Mon Sep 17 00:00:00 2001 From: vbawol Date: Wed, 25 Oct 2017 19:43:13 -0500 Subject: [PATCH] exit loop if _shipwrecks array is empty ref https://github.com/EpochModTeam/Epoch/issues/947 --- .../compile/epoch_looting/EPOCH_server_spawnBoatLoot.sqf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/epoch_server/compile/epoch_looting/EPOCH_server_spawnBoatLoot.sqf b/Sources/epoch_server/compile/epoch_looting/EPOCH_server_spawnBoatLoot.sqf index 82d220bf..9c09808d 100644 --- a/Sources/epoch_server/compile/epoch_looting/EPOCH_server_spawnBoatLoot.sqf +++ b/Sources/epoch_server/compile/epoch_looting/EPOCH_server_spawnBoatLoot.sqf @@ -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; }; }; -}; \ No newline at end of file +};