Bad math for translations with different sized ranges

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Eevee
Posts: 592
Joined: Wed Jul 16, 2003 5:26 am
Contact:

Bad math for translations with different sized ranges

Post by Eevee »

Consider:

Code: Select all

"240,247=61:60"
This creates the following mapping:

Code: Select all

240 -> 61
241 -> 60
242 -> 60
243 -> 60
244 -> 60
245 -> 60
246 -> 60
247 -> 59
FRemapTable::AddIndexRange is computing a step by dividing the size of each range, here -1 ÷ 7... which is wrong, because these ranges have 2 and 8 colors, respectively. It then continually adds the step to the first color and truncates the result, so when the ranges go in opposite directions, the higher-numbered replacement color is doomed to never appear more than once. Finally, because floats, I end up with a color that's not even inside the range I asked for.

The mapping I expect to see is:

Code: Select all

240 -> 61
241 -> 61
242 -> 61
243 -> 61
244 -> 60
245 -> 60
246 -> 60
247 -> 60
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Bad math for translations with different sized ranges

Post by _mental_ »

Fixed in 6db8e71.
Post Reply

Return to “Closed Bugs [GZDoom]”