Bugfix/fix small bugs#8559
Open
sebaleme wants to merge 3 commits intodiasurgical:masterfrom
Open
Conversation
StephenCWills
requested changes
May 9, 2026
| const Player &player = Players[missile._misource]; | ||
| int dmg = GenerateRnd(10) + (player.getCharacterLevel() / 2) + 1; | ||
| dmg = ScaleSpellEffect(dmg, missile._mispllvl); | ||
| int dmg = ScaleSpellEffect(dmg, missile._mispllvl); |
Member
There was a problem hiding this comment.
The first one is probably not affecting the binary, since the compiler optimizing non read data
That's not correct. dmg was being used before your change, as it gets passed into ScaleSpellEffect(). Your compiler should be giving you a warning here.
[ 55%] Building CXX object Source/CMakeFiles/libdevilutionx.dir/missiles.cpp.o
.../DevilutionX/Source/missiles.cpp: In function ‘bool devilution::{anonymous}::GuardianTryFireAt(devilution::Missile&, devilution::Point)’:
.../DevilutionX/Source/missiles.cpp:729:23: warning: unused variable ‘player’ [-Wunused-variable]
729 | const Player &player = Players[missile._misource];
| ^~~~~~
.../DevilutionX/Source/missiles.cpp:730:35: warning: ‘dmg’ may be used uninitialized [-Wmaybe-uninitialized]
730 | int dmg = ScaleSpellEffect(dmg, missile._mispllvl);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
.../DevilutionX/Source/missiles.cpp:730:13: note: ‘dmg’ was declared here
730 | int dmg = ScaleSpellEffect(dmg, missile._mispllvl);
| ^~~
Member
|
I'd simply close this PR after reading title/description like this ... |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
2 small fixes. The first one is probably not affecting the binary, since the compiler optimizing non read data, and the second has a very restricted effect.