Skip to content

Commit

Permalink
Water depth fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Jan 6, 2025
1 parent f3aba1e commit b3fc591
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions maps4fs/generator/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ def __init__( # pylint: disable=R0917, R0915

self.dem_settings = dem_settings
self.logger.info("DEM settings: %s", dem_settings)
if self.dem_settings.water_depth > 0:
# Make sure that the plateau value is >= water_depth
self.dem_settings.plateau = max(
self.dem_settings.plateau, self.dem_settings.water_depth
)
self.logger.info(
"Plateau value was set to %s to be >= water_depth value %s",
self.dem_settings.plateau,
self.dem_settings.water_depth,
)

self.background_settings = background_settings
self.logger.info("Background settings: %s", background_settings)
self.grle_settings = grle_settings
Expand Down
4 changes: 4 additions & 0 deletions maps4fs/generator/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class SharedSettings(BaseModel):
class SettingsModel(BaseModel):
"""Base class for settings models. It provides methods to convert settings to and from JSON."""

model_config = ConfigDict(
frozen=False,
)

@classmethod
def all_settings_to_json(cls) -> dict[str, dict[str, Any]]:
"""Get all settings of the current class and its subclasses as a dictionary.
Expand Down

0 comments on commit b3fc591

Please sign in to comment.