Centralize some config reading function and add support for constants in mob skill db #3164
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.
Pull Request Prelude
Changes Proposed
The main objective of this PR is to allow the usage of constants and bitmask arrays in
mob_skill_db.conf
for fields that didn't support it yet.This allows making configs a bit more readable and maybe less error prone as we have actual constants to use.
This change applies for the
val*
fields andEmotion
, and now allows a config like: (Note: Yes, using val0 forNPC_EMOTION
+Emotion
doesn't make much sense, but serves as an example)As we already had functions to do that on
itemdb
(and also the same function for const inmob
), I decided to centralize them inmap.c
(Thanks @4144 for the discussion 😄 ), this way we can use a single function and it doesn't look weird that monster is calling itemdb for no real reason.Note: I was unsure whether I should make a script automatically update the files to use constants where possible. I am not sure if I know all the cases, but if you think it would be nice to have, I can work on a script that updates most common cases (such as slaves, emotion and mode changes)
Issues addressed:
Closes #2768