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 road mapgen to check the correct neighbours #52168

Merged
merged 1 commit into from
Oct 8, 2021

Conversation

jbytheway
Copy link
Contributor

Summary

Bugfixes "Fix road mapgen"

Purpose of change

The changes in #51913 altered how neighbours were entered into the mapgendata context. For JSON mapgen this fixed issues, but for hardcoded mapgen it could break things.

In particular, for road mapgen it caused problems, as seen in this discourse thread.

Describe the solution

Add a new flag to allow specific oter_ts to opt out of this new behaviour, and apply it to roads.

Describe alternatives you've considered

Jsonify road mapgen. I see Aftershock has already done that, so it's probably feasible.

Testing

Launched the game before and after the change to see the difference in newly generated roads.

Additional context

Some screenshots of roads after the fix (I forgot to take the 'before' screenshots):
fixed-road-mapgen-2
fixed-road-mapgen

The changes in CleverRaven#51913 altered how neighbours were entered into the
mapgendata context.  For JSON mapgen this fixed issues, but for
hardcoded mapgen it could break things.

In particular, for road mapgen it caused problems.

Add a new flag to allow specific oter_ts to opt out of this new
behaviour, and apply it to roads.
@BrettDong BrettDong added <Bugfix> This is a fix for a bug (or closes open issue) Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON labels Oct 8, 2021
@ZhilkinSerg ZhilkinSerg merged commit 1b3be1b into CleverRaven:master Oct 8, 2021
@jbytheway jbytheway deleted the fix_road_mapgen branch October 9, 2021 00:33
ralreegorganon added a commit to ralreegorganon/Cataclysm-DDA that referenced this pull request Dec 16, 2023
The changes in CleverRaven#51913 broke the rotation of lake shores when used as
predecessors by essentially pre-rotating the entries in the mapgendata
neighbors even though the shore itself is not a rotatable terrain.

As a result, the predecessor omt generation would be rotated in the
direction of the final mapgen, negating the predecessor application logic
that would pre-rotate it in the opposite direction so that the final
mapgen rotation would put it in the correct spot.

The end result would be that the lake shores used as predecessor terrain
would be incorrect in all orientations except north.

To fix this, I applied the IGNORE_ROTATION_FOR_ADJACENCY flag that was
added in CleverRaven#52168 to lake and ocean shores so that their mapgendata is
provided as expected.

...however, that implementation only worked for the final overmap terrain
and not predecessors because the mapgendata constructor that swaped
overmap terrain types didn't reevaluate the flag to see if the neighbors
should be rotated. Consequently, if the final one is rotated, all the
predecessors got rotated data even if they set this flag.

I updated it so now it checks for a difference in rotation between
the original and new overmap terrain type, and adjusts the neighbors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants