ACE3/addons/markers/functions/fnc_getEnabledChannels.sqf

40 lines
1.1 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
2015-12-10 14:32:31 +00:00
/*
* Author: commy2, Timi007, LinkIsGrim
2015-12-10 14:32:31 +00:00
* Return enabled channels.
*
* Arguments:
* 0: false - use channel id, true - use localized channel names <BOOl> (default: false)
*
* Return Value:
* Enabled Channels <ARRAY>
*
* Example:
* [false] call ACE_markers_fnc_getEnabledChannels
*
2015-12-10 14:32:31 +00:00
* Public: No
*/
params [["_localize", false, [false]]];
private _enabledChannels = [];
private _currentChannel = currentChannel;
2015-12-10 14:32:31 +00:00
// Micro-optimization so we don't rebuild the array and localize in each iteration
private _engineChannels = CHANNEL_NAMES;
2015-12-10 14:32:31 +00:00
for "_channelId" from 0 to 15 do {
if (_channelId == 5) then {continue}; // Direct channel, ignore
if (setCurrentChannel _channelId) then {
if (_localize) then {
_enabledChannels pushBack (_engineChannels param [_channelId, (radioChannelInfo (_channelId - 5)) select 1]); // radioChannelInfo works off custom IDs only, offset engine channels
} else {
_enabledChannels pushBack _channelId;
2015-12-10 14:32:31 +00:00
};
};
};
setCurrentChannel _currentChannel;
_enabledChannels