Skip to content

Conversation

@CoreyHendrey
Copy link
Contributor

Summary

Bugfixes "Changes a couple switches to be the correct type (ter_str_id) and adds the missing null case"

Purpose of change

Fixes #83613
We were hitting the fallback in some switch cases, and that fallback didn't have a case present.
Also - the fallback was the wrong type, using f_null instead of t_null.

Describe the solution

Changed f_null to t_null
Added the missing t_null case, and mapped it to f_null

Describe alternatives you've considered

I thought about handling the null cases in the actual switch_source code - but the "*_null": "*_null" is an existing pattern in the JSONs (for better, or worse).
I do think this warrants a discussion on how to best handle these null cases. Should "fallback" be omitted if its just falling back to null, and null be an accepted default cause?

Testing

I loaded up the provided save file, and the issue is gone.

Additional context

As mentioned above, there are additional conversations to be had about how best to handle this in the future. I'm not sure this is the best place to make those changes though, as an existing pattern for handling them exists.

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Nov 13, 2025
@mqrause
Copy link
Contributor

mqrause commented Nov 14, 2025

After a bit of a dive into git blame, this conversation is the best explanation I found of what the fallback is supposed to be.

As such, I think the most correct solution would not be adding cases for t_null, but instead picking the same fallback terrain as is used in other places of the palettes if possible, or picking the most sensible terrain from the parameter itself otherwise. So for example for the walkway parameter in the park_nature_palette in terrain it uses t_region_soil as the fallback, so it should also use that in the furniture switch to select the appropriate furniture for that terrain, which unsurprisingly is also f_null.

@CoreyHendrey
Copy link
Contributor Author

Good find! Updated with those changes.

switch_source needs the case to be present, even if its *_null
We were using f_null when the type is ter_str_id (should be t_*)

fixes CleverRaven#83613
We were using f_null when the type is ter_str_id (should be t_*)

fixes CleverRaven#83613
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 18, 2025
@Maleclypse Maleclypse merged commit b0b2513 into CleverRaven:master Nov 19, 2025
55 of 58 checks passed
@CoreyHendrey CoreyHendrey deleted the bugfix-83613 branch November 20, 2025 19:34
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) [JSON] Changes (can be) made in JSON 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.

Mapgen: "Switch doesn't handle case f_null"

3 participants