SirPlease / ZoneMod

A Competitive L4D2 Configuration.
71 stars 26 forks source link

l4d_tank_damage_announce % fudge bug #16

Closed devilesk closed 5 years ago

devilesk commented 5 years ago

Had a game where the damage done to tank was 1980, 1950, 1658, 412 and it displayed as 33%, 34%, 27%, 6%.

I looked at the source code for the plugin and what it's doing is first rounding down everyone's % damage, so with these numbers it would be 33%, 32%, 27%, 6%. Then it sees that these add up to 98 and tries to add the missing 2% to someone's total.

It's supposed to add the missing 2% to someone's total such that it doesn't make their adjusted % higher than the next highest person. So in this case it should have adjusted 27% to 29% which preserves the order, not 32% to 34%.

The issue is that as it's iterating through the players, it's not updating the last_percent variable that tracks the previous person's %, so last_percent is always its starting value of 100 which nullifies the check to preserve order.

I made a pull request with a fix to one of the sources I found to show what needs to be done https://github.com/Stabbath/ProMod/pull/53/commits/1b4b01dee88cfbf9a6f5550e9dcf04ed32d261d8

SirPlease commented 5 years ago

Fixed @ L4D2 Competitive Rework Thanks for the report and fix, applied it to the Witch Damage Plugin as well.