ACE3/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf

34 lines
770 B
Plaintext
Raw Normal View History

2015-03-09 15:46:59 +00:00
/*
* Author: PabstMirror
2015-03-11 07:06:07 +00:00
* Handles clicking the setWP button from the waypoint application
2015-03-09 15:46:59 +00:00
*
* Arguments:
2015-03-11 07:06:07 +00:00
* The "SetWP" button <CONTROL>
2015-03-09 15:46:59 +00:00
*
* Return Value:
2015-03-11 07:06:07 +00:00
* Nothing
2015-03-09 15:46:59 +00:00
*
* Example:
2015-03-11 07:06:07 +00:00
* [] call ace_microdagr_fnc_appWaypointsButtonSetWP
2015-03-09 15:46:59 +00:00
*
2015-03-11 07:06:07 +00:00
* Public: No
2015-03-09 15:46:59 +00:00
*/
#include "script_component.hpp"
2015-03-11 07:06:07 +00:00
private ["_wpListBox", "_newWpIndex", "_waypoints"];
2015-03-09 15:46:59 +00:00
disableSerialization;
2015-03-11 07:06:07 +00:00
PARAMS_1(_wpButton);
2015-03-09 15:46:59 +00:00
_wpListBox = (ctrlParent _wpButton) displayCtrl 144501;
_newWpIndex = lbCurSel _wpListBox;
2015-03-09 18:52:15 +00:00
_waypoints = [] call FUNC(deviceGetWaypoints);
if ((_newWpIndex < 0) || (_newWpIndex > ((count _waypoints) - 1))) exitWith {
2015-03-09 15:46:59 +00:00
GVAR(currentWaypoint) = -1;
ERROR("out of bounds wp");
};
GVAR(currentWaypoint) = _newWpIndex;
[APP_MODE_COMPASS] call FUNC(saveCurrentAndSetNewMode);