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

basecamps: Modular camp fixes #31470

Merged
merged 4 commits into from
Jun 15, 2019

Conversation

mlangsdorf
Copy link
Contributor

@mlangsdorf mlangsdorf commented Jun 15, 2019

Summary

SUMMARY: Bugfixes "basecamps: Modular camp fixes"

Purpose of change

Fixes #31391
Fixes #31450
Fixes #31425
There may be some others.

modular basecamp recipes using blueprint_autocalc were accessing unallocated memory and stomping over everything. This caused all kinds of weird and subtle bugs.

Also, starting a faction camp did not correctly set the initial blueprint_provides, cutting off the development of the camp.

Also, digging a trench was supposed to provide huge amounts of soil, rocks, pebbles, and clay but was not.

Describe the solution

Rewrite get_changed_ids_from_update_mapgen() not attempt to get the actual regional settings and not to not really load the temporary tinymap. Instead, using a dummy regional settings variable and a new tinymap load_fake() function that does the minimal loading necessary for get_changed_ids_from_update_mapgen()'s purposes.

When defining a camp, pass the fully encoded base type, which is the name of the recipe, and not just the short type name, to update_provides().

Add some place_items() to the mapgen_update definitions for digging camp trenches.

Additional context

Whoops. Mea maxima culpa.

@mlangsdorf mlangsdorf added <Bugfix> This is a fix for a bug (or closes open issue) <Crash / Freeze> Fatal bug that results in hangs or crashes. [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Player Faction Base / Camp All about the player faction base/camp/site labels Jun 15, 2019
@mlangsdorf mlangsdorf changed the title baecamps: Modular camp fixes basecamps: Modular camp fixes Jun 15, 2019
@mlangsdorf mlangsdorf requested a review from kevingranade June 15, 2019 14:56
Using tinymap::load during data validation apparently causes all
kinds of write-after-free errors and stomps over all the game data
and is generally bad.  So don't do that any more.

Instead, borrow enough of the code from map::load and map::loadn
to load a tinymap that is never intended to saved or integrated
with the real MAPBUFFER.

Similarly, when using a tinymap loaded by fake_map, don't try
to retrieve the regional settings and just use a dummy variable.
the recipe is the fully encoded camp type, not just the camp type.
change the name of the core part of a modular camp to a modular hub,
and differentiate betweeh the modular hub field (which is built in a
field) and other modular hubs (such as one built on a mall roof).  No
other modular hubs are currently supported, but add some more scaffolding
for that  effort.

Make sure that digging trenches produces appropriate amounts of rocks
and soil.
When reloading factions from master.gsav after they've already been
loaded from the templates by loading NPCs, find the existing factions
instead of making multiple copies.
@mlangsdorf mlangsdorf force-pushed the modular_camp_fixes branch from a7e51e1 to d0b490f Compare June 15, 2019 15:38
@kevingranade kevingranade self-assigned this Jun 15, 2019
@kevingranade kevingranade merged commit 3e8ef77 into CleverRaven:master Jun 15, 2019
@mlangsdorf mlangsdorf deleted the modular_camp_fixes branch June 15, 2019 18:55
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` <Crash / Freeze> Fatal bug that results in hangs or crashes. [JSON] Changes (can be) made in JSON Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to play world on latest build Crash on character creation Map exploration is lost on game reload
2 participants