ACE3/addons/spectator/functions/fnc_ui_getTreeDataIndex.sqf
SilentSpike 85c5fbabe9 Remove locations tab from spectator (#5431)
* Fix incorrect function input for spectator hiding
* Remove locations tab from spectator

- Doesn't add much value, adds complexity and the implementation is half
baked. Would rather add back in at a later date (if at all) with a
better implementation.
- I have an idea to replace the locations tab with a meta tab so users
can toggle things like projectile drawing via the UI and are not forced
to use a hotkey. Might also be a good place to display the extended controls.
2017-08-17 12:50:43 +01:00

45 lines
1.3 KiB
Plaintext

/*
* Author: Nelson Duarte, AACO
* Function used to find the tree path of an entity
*
* Arguments:
* 0: Data to search tree for <STRING>
*
* Return Value:
* Tree path to data <ARRAY>
*
* Example:
* [groupID _group] call ace_spectator_fnc_ui_getTreeDataIndex
*
* Public: No
*/
#include "script_component.hpp"
params [["_data", "", [""]]];
scopeName QGVAR(getTreeDataIndex);
// Make sure data is not empty
if (_data != "") then {
private _ctrl = CTRL_LIST;
for "_sideIndex" from 0 to ((_ctrl tvCount []) - 1) do {
if (_ctrl tvData [_sideIndex] == _data) then {
[_sideIndex] breakOut QGVAR(getTreeDataIndex);
};
for "_groupIndex" from 0 to ((_ctrl tvCount [_sideIndex]) - 1) do {
if (_ctrl tvData [_sideIndex, _groupIndex] == _data) then {
[_sideIndex, _groupIndex] breakOut QGVAR(getTreeDataIndex);
};
for "_unitIndex" from 0 to ((_ctrl tvCount [_sideIndex, _groupIndex]) - 1) do {
if (_ctrl tvData [_sideIndex, _groupIndex, _unitIndex] == _data) then {
[_sideIndex, _groupIndex, _unitIndex] breakOut QGVAR(getTreeDataIndex);
};
};
};
};
};
[-1] // return empty path if not found (worst case)