Jump to content
Sign in to follow this  
Mike84

HC display event handler bug

Recommended Posts

Hi, I'm making an addon (a mix of spon recognize and spon status) which is operated by the spacebar, but everytime me or one of my testers uses the addon with High Command, it failed, and the display event handlers I put on the spacebar suddenly disappeared.

This was reproduceable every time, so I decided to take a look at the HC module code, and how it handled its display event handlers, and I spotted this error:

HC\Data\Scripts\HC_GUI.sqf

code that adds the display event handlers:

//--- Set 3D Event Handlers
BIS_HC_displayEventHandlers = [];
{
_eh = (uinamespace getvariable "_displayMain") displayAddEventHandler [_x, 
	format ["_temp = ['%1',_this] spawn BIS_HC_GUI;",_x]
];
BIS_HC_displayEventHandlers = BIS_HC_displayEventHandlers + [_eh];
} foreach ["keydown","keyup"];

code that removes the display event handlers:

//--- Remove 3D Event Handlers
_events = ["keydown","keyup"];
for "_i" from 0 to 1 do {
_current = _events select _i;
(uinamespace getvariable "_displayMain") displayremoveEventhandler [_current, BIS_HC_ctrlEventHandlers select _i]
};
BIS_HC_displayEventHandlers = nil;

As you can see, the 1st codebox saves the EH indices into a variable called BIS_HC_displayEventHandlers, but if you look at the 2nd codebox you can see that it is removing the event handlers with the indices saved in BIS_HC_ctrlEventHandlers (which is used for the 2d map eventhandlers).

Can someone doublecheck and confirm my findings, and if correct, forward it to a place where the BIS devs are looking?

Thanks in advance,

mike

Share this post


Link to post
Share on other sites
forward it to a place where the BIS devs are looking

BIS devs are looking everywhere ;)

Nice find, I overlooked this typo.

Share this post


Link to post
Share on other sites

It was stated in the 1.04 changelog that this was fixed:

Fixed: High Command could behave strange when someone added his own display event handler. 

The bug is still present, in the latest 1.05 beta as well.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×