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

Removes all hardcoded overmap_connection_id references #72725

Merged

Conversation

Procyonae
Copy link
Contributor

@Procyonae Procyonae commented Mar 30, 2024

Summary

None

Purpose of change

Hardcoded references bad
Allows mods/regions to have different connections for inter city vs intra city vs normal specials road connections, the former of which was impossible before while the latter required redefining every special to change it's connection
Is also useful for debugging city/inter city roads
Also fixes #72532 bc it's just a 1 line oversight and in the same file

Describe the solution

Adds a new region setting category for the connections with documentation explaining their uses and requirements
Replacing the intra city connections doesn't work perfectly because there's a few hardcoded references to the road oter so for example you can end up with two parallel adjacent roads, will look at making this more seamless in a future PR.

Describe alternatives you've considered

I were going to have them default in region_settings.h and make the category optional so it needn't be defined anywhere unless being overridden but that kind of defeats the purpose of removing the references

Testing

Used the test mod below to check both the new settings and overlay work correctly

[
  {
    "type": "MOD_INFO",
    "id": "testoverlay",
    "name": "testoverlay",
    "authors": [ "testoverlay" ],
    "maintainers": [ "testoverlay" ],
    "description": "testoverlay",
    "category": "rebalance",
    "dependencies": [ "dda" ]
  },
  {
    "type": "region_overlay",
    "regions": [ "all" ],
    "overmap_connection_settings": { "inter_city_road_connection": "z0_subway", "intra_city_road_connection": "z0_sewers" }
  },
  {
    "type": "overmap_connection",
    "id": "z0_sewers",
    "subtypes": [
      { "terrain": "sewer", "locations": [ "road", "z0_sewers" ], "basic_cost": 0, "flags": [ "ORTHOGONAL" ] },
      { "terrain": "sewer", "locations": [ "field" ], "basic_cost": 5 },
      { "terrain": "sewer", "locations": [ "forest" ], "basic_cost": 20 },
      { "terrain": "sewer", "locations": [ "swamp" ], "basic_cost": 40 },
      { "terrain": "sewer", "locations": [ "water" ], "basic_cost": 120 }
    ]
  },
  {
    "type": "overmap_connection",
    "id": "z0_subway",
    "subtypes": [
      { "terrain": "sewer", "locations": [ "z0_sewers" ], "basic_cost": 0, "flags": [ "ORTHOGONAL" ] },
      { "terrain": "subway", "locations": [ "field" ], "basic_cost": 5 },
      { "terrain": "subway", "locations": [ "forest" ], "basic_cost": 20 },
      { "terrain": "subway", "locations": [ "swamp" ], "basic_cost": 40 },
      { "terrain": "subway", "locations": [ "water" ], "basic_cost": 120 }
    ]
  },
  {
    "type": "overmap_connection",
    "id": "local_road",
    "subtypes": [
      { "terrain": "subway", "locations": [ "z0_subway" ], "basic_cost": 0, "flags": [ "ORTHOGONAL" ] },
      { "terrain": "sewer", "locations": [ "z0_sewers" ], "basic_cost": 0, "flags": [ "ORTHOGONAL" ] },
      { "terrain": "road", "locations": [ "road" ], "basic_cost": 0, "flags": [ "ORTHOGONAL" ] },
      { "terrain": "road", "locations": [ "field" ], "basic_cost": 5 },
      { "terrain": "road", "locations": [ "forest" ], "basic_cost": 20 },
      { "terrain": "road", "locations": [ "swamp" ], "basic_cost": 40 },
      { "terrain": "road_nesw_manhole", "locations": [  ] },
      { "terrain": "city_center", "locations": [ "field", "road" ] },
      { "terrain": "bridge", "locations": [ "water" ], "basic_cost": 120 },
      { "terrain": "bridgehead_ground", "locations": [ "water" ], "basic_cost": 120, "flags": [ "ORTHOGONAL" ] }
    ]
  },
  {
    "type": "overmap_location",
    "id": "z0_sewers",
    "terrains": [ "sewer", "city_center", "road_nesw_manhole" ]
  },
  {
    "type": "overmap_location",
    "id": "z0_subway",
    "terrains": [ "subway" ]
  }
]

image

Additional context

This could be used to yeet the SIDEWALK flag

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs <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 Mar 30, 2024
@github-actions github-actions bot added the [JSON] Changes (can be) made in JSON label Mar 30, 2024
@github-actions github-actions bot added Code: Tests Measurement, self-control, statistics, balancing. Mods: Aftershock Anything to do with the Aftershock mod Mods: Dark Days of the Dead Anything related to the DDotD mod (classic style zombies) Mods: No Hope Relating to the mod No Hope Mods: TropiCataclysm 🌴 Having to do with the tropical region mod for DDA. Mods: Desert Region Anything relating to the Desert Region mod labels Mar 30, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-requesting reviews from non-collaborators: @I-am-Erk @Night-Pryanik

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 31, 2024
@Maleclypse Maleclypse merged commit cd66f2d into CleverRaven:master Mar 31, 2024
28 checks passed
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) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. <Documentation> Design documents, internal info, guides and help. [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 [Markdown] Markdown issues and PRs Mods: Aftershock Anything to do with the Aftershock mod Mods: Dark Days of the Dead Anything related to the DDotD mod (classic style zombies) Mods: Desert Region Anything relating to the Desert Region mod Mods: No Hope Relating to the mod No Hope Mods: TropiCataclysm 🌴 Having to do with the tropical region mod for DDA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overmap_ocean_settings cannot be adjusted in a region_overlay
2 participants