-
Notifications
You must be signed in to change notification settings - Fork 4.3k
un-magic-number monster movecost calculation #80673
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
Draft
marilynias
wants to merge
5
commits into
CleverRaven:master
Choose a base branch
from
marilynias:rework-mon-move
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or 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
Please remove the IWYU submodule from the PR entirely. Not just commit a deletion but remove it from the commit history also, please. |
b1b0acc
to
7d2bca8
Compare
d3d1e0f
to
8074fa8
Compare
52035a2
to
cf687ac
Compare
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: Infrastructure / Style / Static Analysis
Code internal infrastructure and style
Code: Tests
Measurement, self-control, statistics, balancing.
json-styled
JSON lint passed, label assigned by github actions
Monsters
Monsters both friendly and unfriendly.
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
Infrastructure "un-magic-number monset movecost calculation."
Purpose of change
while working on #80555 (which I cannot reproduce with "circular distances" enabled) I found this Monstrosity:
Cataclysm-DDA/src/monmove.cpp
Lines 1619 to 1671 in 02f75a2
Describe the solution
un-hardcode the monster::calc_movecost method. Make use of the existing map::combined_movecost method with arguments to be able to ignore terrain/furn/field penalties, and add the desired penalty in calc_movecost.
When ignoring terrain cost, add modifier to ensure movecost matches pre-PR values.
Describe alternatives you've considered
Being able to separately ignore 'from' and 'to' tile. Currently it doesn't matter if only one or both tiles can be ignored.
Testing
TODO: create CI
Additional context
rl_dist actually checks for trigdist and returns it, but since it returns int there a 1-tile diagonal distance of 1.41 gets floored to 1 (probable issue of #71699). I believe it makes sense to make it return float.