Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aa7ca7fe6: Linkgraph node index order must be maintained due to other references. #7431

Merged
merged 1 commit into from Mar 30, 2019

Conversation

@PeterN
Copy link
Member

PeterN commented Mar 28, 2019

Linkgraph nodes require a specific order that was maintained by swapping just the last
element for the node to be removed. std::vector::erase() changed this to removing the
node is then shuffling the remain items down, which upsets other references to this
indices. This causes deleted nodes to still be referenced and vice-versa.

This is fixed by switching back to the original swap & pop method.

…er references.

Linkgraph nodes require a specific order that was maintained by swapping just the last
element for the node to be removed. std::vector::erase() changed this to removing the
node is then shuffling the remain items down, which upsets other references to this
indices.

This is fixed by switching back to the original swap & pop method.
@PeterN

This comment has been minimized.

Copy link
Member Author

PeterN commented Mar 28, 2019

Attached a savegame that will crash within a few game days without this fix:
pr7431.zip

@PeterN PeterN added the regression label Mar 28, 2019
@PeterN PeterN merged commit 32fda83 into OpenTTD:master Mar 30, 2019
8 checks passed
8 checks passed
OpenTTD CI Build #20190328.9 succeeded
Details
OpenTTD CI (Linux commit-checker) Linux commit-checker succeeded
Details
OpenTTD CI (Linux linux-amd64-clang-3.8) Linux linux-amd64-clang-3.8 succeeded
Details
OpenTTD CI (Linux linux-amd64-gcc-6) Linux linux-amd64-gcc-6 succeeded
Details
OpenTTD CI (Linux linux-i386-gcc-6) Linux linux-i386-gcc-6 succeeded
Details
OpenTTD CI (MacOS) MacOS succeeded
Details
OpenTTD CI (Windows Win32) Windows Win32 succeeded
Details
OpenTTD CI (Windows Win64) Windows Win64 succeeded
Details
@PeterN PeterN deleted the PeterN:fix-aa7ca7fe6 branch Mar 30, 2019
@PeterN

This comment has been minimized.

Copy link
Member Author

PeterN commented Apr 8, 2019

Backport is not necessary as the change that caused the regression came after the 1.9 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.