CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.65k stars 4.18k forks source link

Negative Sound When Smashing Satellite Dish #77823

Open DragonWizard23 opened 2 days ago

DragonWizard23 commented 2 days ago

Describe the bug

When smashing a satellite dish, I get an error for a negative sound: DEBUG : negative sound volume -1 FUNCTION : sound FILE : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\sounds.cpp LINE : 328 VERSION : daebd7d

Attach save file

Nov132024-trimmed.tar.gz

Steps to reproduce

  1. Find a satellite dish or spawn one in (there are some on top of apartment buildings).
  2. Smash it (I used a hammer).
  3. The error should occur.

Expected behavior

I expected a positive sound value for smashing a satellite dish.

Screenshots

No response

Versions and configuration

Additional context

No response

PatrikLundell commented 1 day ago

/Confirmed

The cause seems to be that the JSON for f_small_satellite_dish doesn't set a min/max bash strength, so those seem to default to -1. That is then used by map.cpp operation map::bash_ter_furn to eventually set smin and smax to those -1 values, and then, since sound_vol is -1 (I haven't bothered to try to found out where it comes from), it sets the sound volume to the min of -1 *1.5 and -1, which truncates to -1.

At a guess there should be a further sanity check to set the sound to a non negative number immediately after that. This should probably be some default volume for when none exists (0?, 1?, something else?).

The alternative to require JSON data to either specify a positive min/max STR is probably a bad one.

I leave it to those who know what sound level values mean to figure out how to deal with this.