Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: HyperSpace target system not always updated
This bug manifested itself in the edge-case of loading a game with an active hyperspace route, and jumping to the next system in the route without entering the Sector View first. On arrival in the new system, the Hyperspace Target was not updated to the next system in the route. The bug was caused by the implementation of the hyperJumpPlanner LUA module tracking the size of the route in a local variable "route_jumps". This variable was not initialized until the Sector View was opened, but it crucial for correctly updating the HyperSpace target system after a jump. 2 ways were identified to fix this bug: 1. update the variable in the "buildJumpRouteList" function 2. remove the variable and read the size of the "hyperjump_route" table directly wherever it is needed. The second option was chosen for this fix as it removes an unnecessary local variable at the expense of slightly more verbose code. This is deemed to be more robust as future refactoring or feature additions will not introduce similar issues where the variable and the table size get out of sync.