Add settler tile adjustments to Civilization class
- Add
SettlerTileAdjustmentsas a child ofCivilization- Encodes the previously hard-coded values as defaults for public fields
- Uses lambda functions to take values at runtime for adjustments that take arguments; this allows future users to supply arbitrary logic
- Replace hard-coded bonus values in
SettlerLocationAI.cswith calls and references toSettlerTileAdjustmentsvia the suppliedPlayer- Notably,
DistancePenaltyis now a negative value by default, which I think is more clear because now adjustments are always added to the tile score
- Notably,
- Make settler tile score a
floatinstead ofint, which gives more precision for multiplicative adjustments - Apply lots of lints from Rider
- Identifier case tweaks (this caused most of the changes in other files)
- Using ternary operators to make code a little smaller when it's still clear
- Some grammar problems (Rider is picky about these for some reason)
- Lint ignores in cases where it makes sense (to me)
- I'm willing to undo these if they're too aggressive or unwanted
Closes #92
Would it be possible to split these apart into a couple of PRs? In particular, I think a PR that only fixes linting issues would be ideal.
Makes sense to me. I'll pull out the lint changes into a new PR and then go through the (many) other ones on that separate branch. It will take some time but will make for a cleaner development experience because the UI will quiet down. Only the parts that are directly related to #92 will remain here.
Also it looks like
C7/C7.sln.DotSettingsis a new file, was that intended to be included in this PR?
This is part of the linting changes. Rider applies spelling and grammar linting in comments :roll_eyes: and some of the words that appear in comments aren't in its dictionary (e.g., "civilopedia"). It's possible to add the unrecognized words to a dictionary so Rider stops flagging them, either locally (untracked) or "team-shared" (tracked). The file you mentioned is where Rider stores this configuration. I think tracking this file is a good idea because it should prevent this kind of linter noise in all Rider installations for this project.
A better option would probably be to find a way to disable this kind of linting entirely, but that should be a discussion elsewhere. I hadn't used Rider before this project, so I'm sure there's a lot I don't know here.
Do you have any thoughts about my approach related to #92? I'm still unfamiliar with the project internals and C# in general, so it wouldn't surprise me if it can be improved.
Do you have any thoughts about my approach related to https://github.com/C7-Game/Prototype/issues/92? I'm still unfamiliar with the project internals and C# in general, so it wouldn't surprise me if it can be improved.
If you're talking about the changes to Civilization.cs and SettlerLocationAI.cs, yeah, that seems good. Do you happen to know if the tests pass successfully? I'm curious as to how the new class of constants is handled with JSON serialization.