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

Get roofs generated for basecamps #72724

Merged
merged 4 commits into from
Apr 4, 2024
Merged

Conversation

PatrikLundell
Copy link
Contributor

@PatrikLundell PatrikLundell commented Mar 30, 2024

Summary

None

Purpose of change

Fix #70603, i.e. get basecamp roofs generated when they previously went AWOL.

Describe the solution

  • Introduce smallmap, an OMT size map that contains all Z levels, as opposed to the previously existing tinymap.
  • Use that map in conjunction with basecamp construction to properly trigger the magic that adds roofs onto constructed walls and ceilings.

Describe alternatives you've considered

There are lots of places where the potential usage of a smallmap rather than a tinymap ought to be investigated:

  • faction_camp operation scan_pseudo_items could be made 3D aware and thus look for items in basements and upper floors.
  • faction_camp operation om_cutdown_trees: There have recently been work done to make trees span multiple Z levels. It ought to be checked whether the tree cutting clears out the stuff on the upper levels, as tinymap can't affect them. Also, the code might need to be updated to have the yield affected by the 3D height of the tree (don't know if regular tree cutting has been modified to do that either).
  • debug_menu operation debug's MAP_EXTRA segment might benefit from an examination of whether it is and should remain a truly 2D action.
  • editmap operation draw_main_ui_overlay may benefit for an examination of whether it is and should remain fully 2D.
  • editmap operation mapgen_preview may benefit from a similar examination.
  • mission_companion operation talk_function::loot_building might benefit from a determination of whether it should support 3D (basement and upper floors) as expanded functionality.
  • Continue to try to device an operation that only adds the roof magic to the modified map. My attempts have all blown up because the code thinks map::grid is empty. I'm tired of failing with this, though.

Testing

Order companions to create a chicken coop in a livestock 2 expansion, debug wait, finish the job, and walk up to the roof to see whether a roof is generated, or the old behavior of showing the walls and floor on the level below remains.

Additional context

The roof addition magic is buried in the map::load call chain, and is only triggered if zlevels is true (as for map and smallmap, but, crucially, not for tinymap).

I've used smallmap for the main processing of the operation as well, because there's code intended to deal with cave-ins in case support is removed, but that code never triggers because zlevels = false causes it to silently fail to do anything.

Renamed the variables to indicate the type used, rather than the type used previously. Results in more "changes", but should lead to less confusion going forward.

@github-actions github-actions bot added Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) labels Mar 30, 2024
src/map.h Outdated Show resolved Hide resolved
src/map.h Outdated Show resolved Hide resolved
src/map.h Outdated Show resolved Hide resolved
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Mar 30, 2024
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Mar 30, 2024
@PatrikLundell PatrikLundell marked this pull request as draft March 30, 2024 16:22
@PatrikLundell PatrikLundell marked this pull request as ready for review March 30, 2024 17:48
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 30, 2024
@I-am-Erk
Copy link
Member

I-am-Erk commented Apr 4, 2024

... Sso to fix this problem, you just casually appear to have added the infrastructure needed for faction camps to properly span z levels?

@I-am-Erk I-am-Erk merged commit 94bfad8 into CleverRaven:master Apr 4, 2024
26 of 36 checks passed
@PatrikLundell
Copy link
Contributor Author

Not quite. It's a step towards that, but it's not sufficient. It didn't hurt that typifying work had resulted in some familiarity with how map/tinymap works.

For one, the current JSON format does not provide any means to specify construction on any other Z level than that of the starting base camp. I assume it wouldn't be too hard to update, though.

For a second, it would require a desire for the definition of predetermined base camps to add construction on other Z levels. Personally I'd rather use free form base camps and thus construction zones, which are already 3D aware. Others may well have desires to expand to other levels (evac shelter basement, mansion upper floors, a dug basement for field base camps, etc).

However, I think a 3D supporting overmap terrain tile map version can be useful in a number of cases.

@PatrikLundell PatrikLundell deleted the fix_roof branch April 4, 2024 07:51
@Procyonae Procyonae added the 0.H Backport PR to backport to the 0.H stable release canddiate label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.H Backport PR to backport to the 0.H stable release canddiate 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.

Base camp expansion buildings generating without roofs
3 participants