Page MenuHomeFeedback Tracker

High Command module resets _all_ map control EHs
Reviewed, NormalPublic

Description

When the last group under the HC commander's control is removed, the module will remove _all_ map control EHs breaking a lot of things (e.g. mouse cursor coords and elevation no longer update, other mods that rely on map control EHs).

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 7
Category
General
Steps To Reproduce

Run repro mission [1] and follow instructions, very low effort. :)

[1]: https://www.dropbox.com/s/ekon6j00aghdm4s/c2_hc_repro.Stratis.zip?dl=1

EDIT: The script error at start is expected and happens because there is no unit synced to the module.

Additional Information

The problem lies in a3\modules_f\hc\data\scripts\hc_local.sqf:

//--- Reset GUI
{
	(uinamespace getvariable "_map") ctrlSetEventHandler [_x, ""];
} foreach ["mousemoving","mouseholding","mousebuttondown","mousebuttonup","keydown","keyup"];

My proposed fix is to reuse the EH resetting code from a3\modules_f\hc\data\scripts\hc_gui.sqf:

if (!isnil "BIS_HC_ctrlEventHandlers") then {
    _events = ["mousemoving","mouseholding","mousebuttondown","mousebuttonup"];
    for "_i" from 0 to 3 do {
        _current = _events select _i;
        (uinamespace getvariable "_map") ctrlremoveEventhandler [_current, BIS_HC_ctrlEventHandlers select _i]
    };
    BIS_HC_ctrlEventHandlers = nil;
};

This has been tested and verified to work by overriding the script through an addon.

Event Timeline

marceldev89 edited Additional Information. (Show Details)
Wulf changed the task status from New to Reviewed.Aug 24 2018, 4:10 PM
Wulf added a subscriber: Wulf.

Hello.

Thank you for the report. We will have a look at it.