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 water flow in barrier removal #1199

Merged
merged 2 commits into from
Aug 10, 2023

Conversation

Emojigit
Copy link
Contributor

@Emojigit Emojigit commented Aug 10, 2023

This PR fixes water flows by replacing barriers with water source if there are two water sources as their neighbor.

This PR is ready for review. Some maps not extending their border into the ocean (e.g. Desert Spikes) can now be fixed.

The logic

The code only works on barriers that should be replaced by air (i.e. replacement_id == ID_AIR). On each such node, four neighbor nodes of the same Y-coordinate (i.e. z +/- 1, x +/- 1) are listed and checked. If two of them are water sources, the current barrier will be replaced by water source instead of air.

Due to the above code, the d[vi] == ID_AIR check is no longer necessary and is removed in this PR.

Gallery

Before (f44e0ed):

screenshot_20230810_085204

After:

screenshot_20230810_084439

@LoneWolfHT LoneWolfHT merged commit 0aa7837 into MT-CTF:master Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants