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

Phased mapgen fixes #53842

Merged
merged 2 commits into from
Dec 29, 2021
Merged

Conversation

jbytheway
Copy link
Contributor

Summary

Bugfixes "Perform mapgen in a more correct order"

Purpose of change

A while back I updated mapgen to proceed in phases. This is needed to prevent certain sorts of issues like bashing being done before terrain or furniture is placed, leading to furniture on t_open_air tiles or rubble on otherwise-undamaged tiles.

However, we have two sorts of mapgen; object-based and setmap_points-based. Previously I had only fixed the former. The setmap_points mapgen all happened first and was usually used for bashing, leading to the above sorts of issues.

Describe the solution

Add phases to setmap_points mapgen also, and interleave the two types of mapgen phase-by-phase so that everything happens in the proper order.

I also took the opportunity to remove some code duplication since three different parts of the code were performing similar mapgen of the two types.

Describe alternatives you've considered

Testing

Unit tests. Ran the exhaustive mapgen test which is currently disabled. Other issues remain that prevent that from being re-enabled yet.

Additional context

(This is one of the issues I mentioned in #53698).

We have two styles of mapgen: the "objects" and the "setmap" style.  The
objects were already being done in phases but the setmap mapgen was not,
and it was done entirely before the objects.  That meant that mapgen
could happen in an unhelpful order, such as map bashing happening before
furniture placement (which in turn led to attempted furniture placement
on open air).

Refactor the mapgen so that the two styles are interleaved on a
phase-by-phase basis.  This ensures that all mapgen happens in the
proper order.
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Dec 28, 2021
@NetSysFire NetSysFire added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Map / Mapgen Overmap, Mapgen, Map extras, Map display labels Dec 28, 2021
@kevingranade kevingranade merged commit 02b403f into CleverRaven:master Dec 29, 2021
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 29, 2021
@jbytheway jbytheway deleted the phased_mapgen_fixes branch December 30, 2021 00:34
jbytheway added a commit to jbytheway/Cataclysm-DDA that referenced this pull request Dec 30, 2021
Work in CleverRaven#53842 introduced a bug whereby the wrong mapgendata (with the
wrong params) was passed downward to nest mapgen.  Fix that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants