Bug smashers #1

Here’s a bug fixing story… Maybe someone will find it interesting… :slight_smile:

As has been pointed out, in NGO, any planes leaving the far cargo stand can block any other planes trying to enter that “gate area” until it flies away.

It turns out this is a core bug. All stands have a “skip nodes after pushback” option. That’s supposed to ensure airplanes don’t “dance around” when leaving the stand, because they’re trying to follow nodes very close to their pushback node. This used to happen in PRG on Gate 22.

We thought we solved it, but apparently not.

This functionality tells the airplane to remove the first X points from it’s path, except for the first point. After some time of debugging, I ended up at this bit of code.:

for (int i = 0; i < nodesToSkipAfterPushback; i++)
{
	pathNodes.RemoveAt(i + 1);
}

Where nodesToSkipAfterPushback is equal to 7 in this case.

Can you spot the mistake? This indeed removes 7 nodes, but the list’s indexes update with each node removal along with i’s increments. This removes every other node from the list. Resulting in this.

It removes every other node, including the area exit node. As the airplane never hits the exit node, the airplane never removes itself from the gate area. It keeps “blocking” the gate area indefinitely, until it flies away and despawns.

This bug must be present on all stands using this functionality.

After fixing the code:

	pathNodes.RemoveAt(1);

It correctly removes the first 7 nodes, allowing the airplane to hit the area exit, and remove itself from the area.

The 7 skipped nodes are now obviously an overkill. For a 747 to turn around on the spot and go forwards, skipping 3 or 4 nodes at most should be enough.

I’m not sure who wrote that bit of code. I’m hoping it wasn’t me. :smile: Little mistake which caused significant issues, and was quite hard to track down. This should hopefully solve every other instance in the game where airplanes have been “dancing” around when exiting the stand.

Hope this has been somewhat interesting. Big update is coming soon. Until then, I’ll keep on bug smashing. And thank you all for reporting the bugs you find.

Jan

22 Likes