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

Fix classic zombies map extras chance values which could cause debugmsg #49396

Merged

Conversation

jbytheway
Copy link
Contributor

@jbytheway jbytheway commented Jun 21, 2021

Summary

Mods "Fix classic zombies map extras chance values"

Purpose of change

Classic zombies was setting the weight of various map_extras to zero. This makes sense, but it was also setting the chance of map extras on certain extras types for every region. This is problematic because some regions' extras types lacked any map extras, so setting the chance non-zero led to errors when the game tried to select an extra.

Describe the solution

First, add more validation to the map extras weights so that this issue is caught at validation time rather than at random at map generation time.

Change the classic zombies mod to just set the extras weights and not set the chance, so that the regions with no extras would remain at the default chance of zero and no errors would arise.

As a side-effect, this dramatically increases the chance of field map extras for the classic zombies mod which had become out of sync with the base game, which is probably an improvement.

Describe alternatives you've considered

Maybe this should have targeted master, but I've only been working on 0.F-dev lately, so I'm not sure whether the same issue exists in master.

Testing

The new checks I added now pass in unit testing with mods loaded.

Additional context

Noticed because of CI errors on my PR #48529.

If map extras are specified with invalid weights, this can cause a
runtime error when an extra needs to be selected.  Bring that error
forwards to validation time to make it more reliable.
Classic zombies was setting the weight of various map_extras to zero.
This makes sense, but it was also setting the chance of map extras on
certain extras types for every region.  This is problematic because some
regions' extras types lacked any map extras, so setting the chance
non-zero led to errors.

Change the classic zombies mod to just set the extras weights and not
set the chance, so that the regions with no extras would remain at the
default chance of zero and no errors would arise.

As a side-effect, this dramatically increases the chance of field map
extras for the classic zombies mod which had become out of sync with the
base game, which is probably an improvement.
@jbytheway jbytheway requested a review from I-am-Erk as a code owner June 21, 2021 14:45
@anothersimulacrum anothersimulacrum added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` labels Jun 21, 2021
@ZhilkinSerg ZhilkinSerg merged commit 1a916cd into CleverRaven:0.F-dev Jun 21, 2021
@ZhilkinSerg ZhilkinSerg mentioned this pull request Jun 21, 2021
14 tasks
@jbytheway jbytheway deleted the region_overlay_map_extras_bug branch June 22, 2021 00:39
ZhilkinSerg added a commit to ZhilkinSerg/Cataclysm-DDA that referenced this pull request Aug 12, 2021
ZhilkinSerg added a commit that referenced this pull request Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants