mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
3f4564605b
* Muzzle Velocity vs. Temperature Interpolation * C1 Ballistic Coefficient vs. Distance Interpolation * Coriolis and Spin drift output * Options menu * Truing Drop --------------------------------- * Overworked default gun profiles --------------------------------- * Fixed the Cancel buttons on the gun-, atmosphere- and target columns. * Fixed some muzzle velocity entries in the default gun list. * Fixed divide by zero error in the target range estimator
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
/*
|
|
* Author: Ruthberg
|
|
* Inserts entry in the muzzle velocity vs. temperature interpolation table
|
|
*
|
|
* Arguments:
|
|
* temperature - <NUMBER>
|
|
* muzzle velocity - <NUMBER>
|
|
*
|
|
* Return Value:
|
|
* Nothing
|
|
*
|
|
* Example:
|
|
* [10, 800] call ace_atragmx_fnc_insert_muzzle_velocity_data
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
params ["_temperature", "_muzzleVelocity"];
|
|
|
|
private _insertIndex = 0;
|
|
private _minDiff = 1000;
|
|
{
|
|
if (_minDiff > 0 && {(((GVAR(workingMemory) select 18) select _forEachIndex) select 1) == 0}) then {
|
|
_insertIndex = _forEachIndex;
|
|
_minDiff = 0;
|
|
};
|
|
private _t = ((GVAR(workingMemory) select 18) select _forEachIndex) select 0;
|
|
private _diff = abs(_temperature - _t);
|
|
if (_diff == 0) exitWith {
|
|
_insertIndex = _forEachIndex;
|
|
};
|
|
if (_diff < _minDiff) then {
|
|
_insertIndex = _forEachIndex;
|
|
_minDiff = _diff;
|
|
};
|
|
} forEach (GVAR(workingMemory) select 18);
|
|
|
|
(GVAR(workingMemory) select 18) set [_insertIndex, [_temperature, 0 max _muzzleVelocity min 1400]];
|
|
|
|
call FUNC(update_muzzle_velocity_data);
|