ALiVEOS / ALiVE.OS

ALiVE Open Source GPL v2
http://alivemod.com/
Other
157 stars 80 forks source link

Base-game ORBAT Viewer does not open when Advanced Markers are not disabled. #718

Closed ampersand38 closed 3 years ago

ampersand38 commented 4 years ago

Prerequisites

Description

Having ALiVE Required module with Disable Adv Markers set to No, base-game ORBAT Viewer does not open on map click.

Steps to Reproduce

  1. Load into Editor with CBA_A3 and ALiVE
  2. Place any unit
  3. Place ORBAT Group module configfile >> "CfgORBAT" >> "BIS" >> "B_1"
  4. Place ALiVE Required Module
  5. Play mission
  6. Open map and click on ORBAT icon

Expected behavior: ORBAT Viewer to open

Actual behavior: ORBAT Viewer fails to open

https://youtu.be/Y47Nuqmi5hs

trapw0w commented 4 years ago

ctrlEventHandlers added by the ModuleStrategicMapORBAT_F module via BIS_fnc_moduleStrategicMapORBAT:

//--- Add event handlers
_fnc_addHandlers = {
    {
        _x spawn {
            disableserialization;
            waituntil {!isnull (finddisplay _this displayctrl 51)};
            _control = finddisplay _this displayctrl 51;
            _control ctrladdeventhandler ["draw","_this call BIS_fnc_moduleStrategicMapORBAT_draw;"];
            _control ctrladdeventhandler ["mousemoving","_this call BIS_fnc_moduleStrategicMapORBAT_mouse;"];
            _control ctrladdeventhandler ["mouseholding","_this call BIS_fnc_moduleStrategicMapORBAT_mouse;"];
            _control ctrladdeventhandler ["mousebuttonclick","['BIS_fnc_moduleStrategicMapORBAT',_this] spawn BIS_fnc_strategicMapMouseButtonClick;"];
        };
    } foreach [
        getnumber (configfile >> "RscDisplayMainMap" >> "idd"),
        getnumber (configfile >> "RscDisplayGetReady" >> "idd"),
        getnumber (configfile >> "RscDisplayClientGetReady" >> "idd"),
        getnumber (configfile >> "RscDisplayServerGetReady" >> "idd")
    ];
};

[] spawn _fnc_addHandlers;

Appear to get overwritten by ALiVE here: https://github.com/ALiVEOS/ALiVE.OS/blob/c98722e646913bcbcd5c64a7aa477ea8b6e4ffb7/addons/sys_marker/fnc_marker.sqf#L303

&

https://github.com/ALiVEOS/ALiVE.OS/blob/c98722e646913bcbcd5c64a7aa477ea8b6e4ffb7/addons/sys_marker/fnc_marker.sqf#L344

As a temporary fix, throw this into the init of the ORBAT Module:

[] spawn {
    sleep 10;
    _control = finddisplay 12 displayctrl 51;

    _control ctrladdeventhandler ["mousebuttonclick","['BIS_fnc_moduleStrategicMapORBAT',_this] spawn BIS_fnc_strategicMapMouseButtonClick;"];
};
trapw0w commented 4 years ago

Control Event Handlers are stackable and are processed in reverse order (i.e. last added: processed first, first added: processed last).

In our instance, ALiVEs EH's are processed first as they're declared last. This seems to work fine if the EH's within BIS_fnc_moduleStrategicMapORBAT are processed first.

trapw0w commented 4 years ago

Inverting the following return value to false allows secondary EH's to be fired:

https://github.com/ALiVEOS/ALiVE.OS/blob/c98722e646913bcbcd5c64a7aa477ea8b6e4ffb7/addons/sys_marker/fnc_marker.sqf#L527

LinkIsGrim commented 3 years ago

Works after #719, can probably close this now.