prevent Error Zero divisor here

This commit is contained in:
vbawol 2016-07-13 07:51:43 -05:00
parent 4420175667
commit dd54f07534
3 changed files with 21 additions and 17 deletions

View File

@ -180,13 +180,14 @@ for "_i" from 1 to _maxStorageLimit do {
if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then {
_magazineSizeMax = getNumber (configFile >> "CfgMagazines" >> _magazineName >> "count");
if (_magazineSizeMax >= 1) then {
// Add full magazines cargo
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
// Add full magazines cargo
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
// Add last non full magazine
if ((_magazineSize % _magazineSizeMax) > 0) then {
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
// Add last non full magazine
if ((_magazineSize % _magazineSizeMax) > 0) then {
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
};
};
};
};

View File

@ -159,11 +159,13 @@ for "_i" from 1 to _maxVehicleLimit do {
_magazineSize = _objQty select _forEachIndex;
if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then {
_magazineSizeMax = getNumber (configFile >> "CfgMagazines" >> _magazineName >> "count");
// Add full magazines cargo
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
// Add last non full magazine
if ((_magazineSize % _magazineSizeMax) > 0) then {
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
if (_magazineSizeMax >= 1) then {
// Add full magazines cargo
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
// Add last non full magazine
if ((_magazineSize % _magazineSizeMax) > 0) then {
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
};
};
};
};

View File

@ -183,13 +183,14 @@ for "_i" from 1 to _maxVehicleLimit do {
if ((_magazineName isEqualType "STRING") && (_magazineSize isEqualType 0)) then {
_magazineSizeMax = getNumber (configFile >> "CfgMagazines" >> _magazineName >> "count");
if (_magazineSizeMax >= 1) then {
// Add full magazines cargo
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
// Add full magazines cargo
_vehicle addMagazineAmmoCargo [_magazineName, floor (_magazineSize / _magazineSizeMax), _magazineSizeMax];
// Add last non full magazine
if ((_magazineSize % _magazineSizeMax) > 0) then {
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
// Add last non full magazine
if ((_magazineSize % _magazineSizeMax) > 0) then {
_vehicle addMagazineAmmoCargo [_magazineName, 1, floor (_magazineSize % _magazineSizeMax)];
};
};
};
};