Fix for RuntimeMaterials to pick the right ground texture in Woodland Hills #2545
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



A user was having a mismatch in RuntimeMaterials when replacing ground textures according to climate/season/weather.
In this example:

The bright green of the hill clashes with the dark green of the rest of the area. This is because the hill has been made to use archive 302-304, and Woodland Hills uses archive 102-104 for ground.
A concrete climate's ground archive is defined in
MapsFile.GetWorldClimateSettings, along with its base climate setting. Without the concrete climate, we can get a default ground archive matching the base climate as defined inClimateSwapslogic (either inApplyClimateorGetGroundArchive).In the latter case, we have for the ground:
With winter variants at x03 and rain variants at x04.
For the most part, the climates in
MapsFile.GetWorldClimateSettingshave a ground archive matching the base climate's inClimateSwaps.GetGroundArchive. We only have one exception:Climates.MountainWoods(aka "Woodland Hills") has a Temperate base climate (normally ground archive 302), but with a specific ground archive of 102 (the mountain one).102 is the archive used by the terrain generator. Therefore, any ground generated in this climate needs to match 102, not 302.
This fix adds an explicit check in RuntimeMaterials for whether we're replacing a ground archive, and if so, use the climate settings' ground archive, not the naive climate-based swap.
And the result is a more natural hill

Similarly,
DaggerfallMesh.SetClimateusesMaterialReader.ChangeClimatewhich also relies onClimateSwapslogic to customize by weather. However, I'm not sure whether aDaggerfallMeshever uses the ground archive, so I did not insert this fix in this PR.