ACE3/addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf

38 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-04-05 20:48:56 +00:00
/*
* Author: PabstMirror
2015-04-05 22:50:07 +00:00
* Called when listbox selection changes. Updates the rangetable with new values.
2015-04-05 20:48:56 +00:00
*
* Arguments:
2015-04-05 22:50:07 +00:00
* No
2015-04-05 20:48:56 +00:00
*
* Return Value:
2015-04-05 22:50:07 +00:00
* No
2015-04-05 20:48:56 +00:00
*
* Example:
2015-04-06 06:05:28 +00:00
* [] call ace_mk6mortar_fnc_rangeTablePageChange
2015-04-05 22:50:07 +00:00
*
2015-04-05 20:48:56 +00:00
* Public: No
*/
#include "script_component.hpp"
#define RANGE_TABLE ((uiNamespace getVariable "ACE_82mm_RangeTable_Dialog") displayCtrl 20001)
#define LIST_CHARGE ((uiNamespace getVariable "ACE_82mm_RangeTable_Dialog") displayCtrl 1501)
2015-04-08 00:30:07 +00:00
private ["_listBoxData", "_muzzleVelocity", "_airFriction", "_precalcArray"];
2015-04-05 20:48:56 +00:00
_listBoxData = LIST_CHARGE lbData (lbCurSel LIST_CHARGE);
if (isNil "_listBoxData" || {_listBoxData == ""}) exitWith {ERROR("lbCurSel out of bounds or no data");};
_muzzleVelocity = parseNumber _listBoxData;
2015-04-08 00:19:08 +00:00
_airFriction = if (GVAR(airResistanceEnabled)) then {MK6_82mm_AIR_FRICTION} else {0};
_precalcArray = [_muzzleVelocity, _airFriction] call FUNC(rangeTablePreCalculatedValues);
2015-04-05 20:48:56 +00:00
lnbClear RANGE_TABLE;
{
RANGE_TABLE lnbAddRow _x;
} forEach _precalcArray;
//put dummy line at end because scrolling is fucked and can't see last line
RANGE_TABLE lnbAddRow ["", "", "", "", "", "", "", "", "", "", ""];