mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
ATragMX - Fixes possible divison through zero
This commit is contained in:
parent
dbb59c8fd1
commit
cb3693f664
@ -37,16 +37,20 @@ private ["_lowerIndex", "_upperIndex"];
|
||||
for "_index" from 1 to (_lookupTableSize - 1) do {
|
||||
_upperIndex = _index;
|
||||
_lowerIndex = _upperIndex - 1;
|
||||
if (((_lookupTable select _index) select 0) >= (GVAR(targetRange) select GVAR(currentTarget))) exitWith {}
|
||||
if (((_lookupTable select _index) select 0) >= (GVAR(targetRange) select GVAR(currentTarget))) exitWith {};
|
||||
};
|
||||
|
||||
private ["_lowerDistance", "_upperDistance", "_lowerC1", "_upperC1", "_slope", "_c1"];
|
||||
private ["_lowerDistance", "_upperDistance", "_lowerC1", "_upperC1", "_c1"];
|
||||
_lowerDistance = (_lookupTable select _lowerIndex) select 0;
|
||||
_upperDistance = (_lookupTable select _upperIndex) select 0;
|
||||
_lowerC1 = (_lookupTable select _lowerIndex) select 1;
|
||||
_upperC1 = (_lookupTable select _upperIndex) select 1;
|
||||
_slope = (_upperC1 - _lowerC1) / (_upperDistance - _lowerDistance);
|
||||
_c1 = 0.1 max (_lowerC1 + ((GVAR(targetRange) select GVAR(currentTarget)) - _lowerDistance) * _slope) min 2.0;
|
||||
_c1 = _lowerC1;
|
||||
if (_lowerDistance != _upperDistance) then {
|
||||
private _slope = (_upperC1 - _lowerC1) / (_upperDistance - _lowerDistance);
|
||||
_c1 = _lowerC1 + ((GVAR(targetRange) select GVAR(currentTarget)) - _lowerDistance) * _slope;
|
||||
};
|
||||
_c1 = 0.1 max _c1 min 2.0;
|
||||
|
||||
if (_c1 != GVAR(workingMemory) select 15) then {
|
||||
GVAR(workingMemory) set [15, _c1];
|
||||
|
@ -37,16 +37,20 @@ private ["_lowerIndex", "_upperIndex"];
|
||||
for "_index" from 1 to (_lookupTableSize - 1) do {
|
||||
_upperIndex = _index;
|
||||
_lowerIndex = _upperIndex - 1;
|
||||
if (((_lookupTable select _index) select 0) >= GVAR(temperature)) exitWith {}
|
||||
if (((_lookupTable select _index) select 0) >= GVAR(temperature)) exitWith {};
|
||||
};
|
||||
|
||||
private ["_lowerTemperature", "_upperTemperature", "_lowerMuzzleVelocity", "_upperMuzzleVelocity", "_slope", "_muzzleVelocity"];
|
||||
private ["_lowerTemperature", "_upperTemperature", "_lowerMuzzleVelocity", "_upperMuzzleVelocity", "_muzzleVelocity"];
|
||||
_lowerTemperature = (_lookupTable select _lowerIndex) select 0;
|
||||
_upperTemperature = (_lookupTable select _upperIndex) select 0;
|
||||
_lowerMuzzleVelocity = (_lookupTable select _lowerIndex) select 1;
|
||||
_upperMuzzleVelocity = (_lookupTable select _upperIndex) select 1;
|
||||
_slope = (_upperMuzzleVelocity - _lowerMuzzleVelocity) / (_upperTemperature - _lowerTemperature);
|
||||
_muzzleVelocity = _lowerMuzzleVelocity + (GVAR(temperature) - _lowerTemperature) * _slope;
|
||||
_muzzleVelocity = _lowerMuzzleVelocity;
|
||||
if (_lowerTemperature != _upperTemperature) then {
|
||||
private _slope = (_upperMuzzleVelocity - _lowerMuzzleVelocity) / (_upperTemperature - _lowerTemperature);
|
||||
_muzzleVelocity = _lowerMuzzleVelocity + (GVAR(temperature) - _lowerTemperature) * _slope;
|
||||
};
|
||||
_muzzleVelocity = 100 max _muzzleVelocity min 1400;
|
||||
|
||||
if (_muzzleVelocity != GVAR(workingMemory) select 1) then {
|
||||
GVAR(workingMemory) set [1, _muzzleVelocity];
|
||||
|
Loading…
Reference in New Issue
Block a user