-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Better in city check #74191
Merged
Merged
Better in city check #74191
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-Authored-By: anothersimulacrum <[email protected]>
github-actions
bot
added
Map / Mapgen
Overmap, Mapgen, Map extras, Map display
[C++]
Changes (can be) made in C++. Previously named `Code`
EOC: Effects On Condition
Anything concerning Effects On Condition
<Bugfix>
This is a fix for a bug (or closes open issue)
json-styled
JSON lint passed, label assigned by github actions
astyled
astyled PR, label is assigned by github actions
labels
May 30, 2024
github-actions
bot
added
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
May 30, 2024
github-actions
bot
added
<Documentation>
Design documents, internal info, guides and help.
[Markdown]
Markdown issues and PRs
labels
Oct 18, 2024
github-actions
bot
removed
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Oct 18, 2024
Not sure why I were checking 2 thick circles?
github-actions
bot
added
BasicBuildPassed
This PR builds correctly, label assigned by github actions
and removed
BasicBuildPassed
This PR builds correctly, label assigned by github actions
labels
Oct 19, 2024
ehughsbaird
approved these changes
Oct 19, 2024
Co-authored-by: ehughsbaird <[email protected]>
github-actions
bot
added
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Oct 20, 2024
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`
<Documentation>
Design documents, internal info, guides and help.
EOC: Effects On Condition
Anything concerning Effects On Condition
json-styled
JSON lint passed, label assigned by github actions
Map / Mapgen
Overmap, Mapgen, Map extras, Map display
[Markdown]
Markdown issues and PRs
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.
Summary
None
Purpose of change
Fixes #74177
Might be used for #71822 and the first commit is code from it mainly courtesy of anothersimulacrum
Describe the solution
Current checks for whether stuff is in a city or not use the difference between the test points distance from the nearest city's centre and the nearest city's size. Given that our cities are thankfully more organic than perfect circles that isn't particularly accurate.
Now every city road and building that gets placed is added to a set of
point_om_omt
s per overmap that can be checked against to determine if you're in a city. Once all cities are placed in an overmap the result is floodfilled so random fields in the middle of cities still count as being in the city limits.Currently only affects EOCs
map_in_city
and overmap_specials city_distanceFalls back on calculating distance based on city size but cuts off at 0 as < 0 isn't a useful result
Describe alternatives you've considered
Keeping track of tripoints instead of just points but that seems excessive
Adding 1 tile padding to the edges of city_tiles after it's flood filled
Adding more initial usages but this has been sitting drafted for ages
Testing
For basic city_tiles testing or map_in_city testing plop this anywhere in the JSON and walk around, also tested post save/load to check that works
For city_distance performance testing add this to a test cpp and run it with and without the changes, comparing the times
Additional context