ALiVEOS / ALiVE.OS

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

Sometimes MACC keeps throwing an error about _takeoff being undefined. #781

Closed romabysen closed 1 year ago

romabysen commented 1 year ago

Prerequisites

Description

On the rare occasion MACC starts throwing errors about _takeoff being undefined. As for know I do not know if this affects the game.

Steps to Reproduce

Sorry, it doesn't happen at a frequency where it is reliably reproducible. alive_takeoff_issue.txt Screenshot 2022-08-30 220521

romabysen commented 1 year ago

As far as I can gather this is a race condition or timing issue so maybe a slight delay of the MACC init could solve it.

romabysen commented 1 year ago

Thinking more about this, discarding/cancelling the air mission if _targetProfile is nil on line 3806 in fnc_ATO.sqf seems to be a reasonable solution.

CrashDome commented 1 year ago

I'm currently working on something else for Alive but if it's that simple, I will have a look tomorrow, trace any possible side effects and submit a code change and pull request if everyone else is busy.

CrashDome commented 1 year ago

I had a look at the code yesterday and instead of cancelling or discarding, I think I found a simple solution. _eventPosition is already defined as the marker position. It just is trying to locate specific target positions and either it is sent no targets or bad target data. Not sure which. I just added a check if _targetProfile is null to fall back and keep _eventPosition as marker position.