2015-02-04 00:16:47 +00:00
|
|
|
/*
|
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Sets the speed dial for the UI.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Name of speed dial <STRING>
|
|
|
|
* 1: Code to add to speed dial <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* ["My Speed Dial","2131"] call ACE_explosives_fnc_addToSpeedDial;
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
2015-08-15 19:35:33 +00:00
|
|
|
|
|
|
|
params ["_name", "_code"];
|
|
|
|
TRACE_2("params",_name,_code);
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
|
|
|
|
private _found = false;
|
2015-02-04 00:16:47 +00:00
|
|
|
|
2015-08-15 19:35:33 +00:00
|
|
|
if ((_code) == "") exitWith {
|
2015-04-06 16:22:43 +00:00
|
|
|
[_name] call FUNC(removeFromSpeedDial);
|
2015-02-04 00:16:47 +00:00
|
|
|
};
|
|
|
|
{
|
2015-04-06 16:22:43 +00:00
|
|
|
if ((_x select 0) == _name) exitWith {
|
2015-11-30 16:25:16 +00:00
|
|
|
_speedDial set [_forEachIndex, _this];
|
2015-04-06 16:22:43 +00:00
|
|
|
_found = true;
|
|
|
|
};
|
2015-08-15 19:35:33 +00:00
|
|
|
} forEach _speedDial;
|
2015-02-04 00:16:47 +00:00
|
|
|
if (!_found) then {
|
2015-04-06 16:22:43 +00:00
|
|
|
_speedDial pushBack _this;
|
2015-02-04 00:16:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
ace_player setVariable [QGVAR(SpeedDial), _speedDial];
|