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

Make mapgen code a bit simpler: #34194

Merged
merged 10 commits into from
Sep 23, 2019
Merged

Make mapgen code a bit simpler: #34194

merged 10 commits into from
Sep 23, 2019

Conversation

BevapDin
Copy link
Contributor

SUMMARY: None

Instead of forwarding several things to each mapgen related function (e.g. monster density, mission, time point), put them all into the existing mapgendata class and only forward a reference to that class. (This reference was forwarded most of the time anyway).

Also convert it into a class for consistency.

And add some preliminary documentation.
Some function take a parameter of that type and modify it via non-const member calls.

At least this creates a consistent interface.
Instead of passing forward all the values that the function uses to construct such an object on its own.
The parameters are:
- when (`time_point`)
- mission (`mission *`)
- monster spawn density (`float`)
- overmap terrain type (`oter_id`)
- map to generate on (`map &`)

Those parameters are forwarded to many mapgen function, but are actually rarely used.
Moving them into the `mapgendata` class allows simpler function declarations.
It's not needed in any of the header files that used to include it. Those files need at most a forward declaration.
@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Map / Mapgen Overmap, Mapgen, Map extras, Map display labels Sep 23, 2019
@kevingranade kevingranade merged commit 94bdea5 into CleverRaven:master Sep 23, 2019
@BevapDin BevapDin deleted the rvg branch September 23, 2019 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Map / Mapgen Overmap, Mapgen, Map extras, Map display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants