Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spectator - Do not use DISPLAY macro #224

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions addons/spectator/functions/RscDisplayEGSpectator.sqf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "script_component.hpp"
#include "\a3\Functions_F_Exp_A\EGSpectatorCommonDefines.inc"
/*
* Author: 3Mydlo3
* Enhanced original RscDisplayEGSpectator to support showing only valid units from group on the list for selection instead of whole group.
Expand Down Expand Up @@ -34,9 +35,6 @@ disableSerialization;
// Name this script
scriptName "RscDisplayEGSpectator";

// Common spectator defines
#include "\A3\Functions_F_Exp_A\EGSpectatorCommonDefines.inc"

// Params
private ["_mode", "_params"];
_mode = _this param [0, "", [""]];
Expand Down Expand Up @@ -115,7 +113,7 @@ switch _mode do
// Whether an update to the list is required (really only if something changed)
if !(_oldList isEqualTo _newList) then
{
private _allElements = ["TreeGetAllElements"] call DISPLAY;
private _allElements = ["TreeGetAllElements"] call (uiNamespace getVariable ["RscDisplayEGSpectator_script", {}]);
private _groupElements = _allElements select 1;
private _unitElements = _allElements select 2;

Expand Down Expand Up @@ -152,7 +150,7 @@ switch _mode do

if (!_bExists) then
{
["TreeDeleteUnit", [_data]] call DISPLAY;
["TreeDeleteUnit", [_data]] call (uiNamespace getVariable ["RscDisplayEGSpectator_script", {}]);
//[" Unit %1 removed", _data] call BIS_fnc_error;
};
}
Expand Down Expand Up @@ -184,7 +182,7 @@ switch _mode do

if (!_bExists) then
{
["TreeDeleteGroup", [_data]] call DISPLAY;
["TreeDeleteGroup", [_data]] call (uiNamespace getVariable ["RscDisplayEGSpectator_script", {}]);
//["Group %1 removed", _data] call BIS_fnc_error;
};
}
Expand Down Expand Up @@ -228,7 +226,7 @@ switch _mode do
private _groupInfo = _x select 0;
private _unitsInfo = _x select 1;
private _group = _groupInfo select 0;
private _i = ["TreeGetDataIndex", [str _group]] call DISPLAY;
private _i = ["TreeGetDataIndex", [str _group]] call (uiNamespace getVariable ["RscDisplayEGSpectator_script", {}]);
private _groupIndex = if (count _i > 0) then {_i select 1} else {-1};

//["Group %1 with index %2 being checked", _group, _groupIndex] call BIS_fnc_error;
Expand Down Expand Up @@ -263,7 +261,7 @@ switch _mode do

private _text = if (isPlayer _unit) then { _name } else { format ["%1: %2", localize "str_player_ai", _name] };
private _tooltip = if (isPlayer _unit) then { format ["%1 - %2", _name, _groupId] } else { format ["%1: %2 - %3", localize "str_player_ai", _name, _groupId] };
private _i = ["TreeGetDataIndex", [[_unit] call BIS_fnc_objectVar]] call DISPLAY;
private _i = ["TreeGetDataIndex", [[_unit] call BIS_fnc_objectVar]] call (uiNamespace getVariable ["RscDisplayEGSpectator_script", {}]);
private _unitIndex = if (count _i > 0) then {_i select 1} else {-1};
private _unitIcon = getText (configfile >> "CfgVehicles" >> typeOf _unit >> "icon");

Expand Down Expand Up @@ -303,13 +301,13 @@ switch _mode do
};

// Current focused unit
private _focus = ["GetFocus"] call DISPLAY;
private _focus = ["GetFocus"] call (uiNamespace getVariable ["RscDisplayEGSpectator_script", {}]);

// Update focus if required
if (!isNull _focus && {count tvCurSel _ctrl < 3}) then
{
// Get index of current focus in the list
private _i = ["TreeGetDataIndex", [[_focus] call BIS_fnc_objectVar]] call DISPLAY;
private _i = ["TreeGetDataIndex", [[_focus] call BIS_fnc_objectVar]] call (uiNamespace getVariable ["RscDisplayEGSpectator_script", {}]);

// If found, select it
if !(_i isEqualTo []) then
Expand Down
Loading