-
Notifications
You must be signed in to change notification settings - Fork 29
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 unsigned vs signed issues in D2DamageStrc #147
fix unsigned vs signed issues in D2DamageStrc #147
Conversation
…ever dwDmgTotal is currently unsigned in the D2DamageStrc struct
source/D2Game/src/UNIT/SUnitDmg.cpp
Outdated
@@ -1290,7 +1290,7 @@ void __fastcall SUNITDMG_ExecuteEvents(D2GameStrc* pGame, D2UnitStrc* pAttacker, | |||
STATLIST_SetUnitStat(pDefender, STAT_HITPOINTS, nNewHp, 0); | |||
} | |||
|
|||
if (pDamage->dwDmgTotal > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should change dwDmgTotal
to be signed instead of fixing it only here.
For example it appears in D2Game.0x6FD049D0
too, and it also checks for negative values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to merge the type change of dwDmgTotal
instead
…eStrct since this is how they are treated in d2game
True. I looked at the D2DamageStrc and found several unsigned values that should be signed. This pr is now about signed vs unsigned in D2DamageStrc. |
I think it would be fine to put it as signed since it's passed to |
Updated |
the original codebase has dwDmgTotal being treated as a signed value (jle) on this comparison. This causes differences to the original client when dwDmgTotal is negative