[#44] BaseDataWindow: Fix conversion between season precisions
All checks were successful
Test / Run tests (push) Successful in 1m59s

This commit is contained in:
2024-06-10 23:01:42 +02:00
parent 08f551a394
commit ca0497e396

View File

@ -178,12 +178,14 @@ namespace Elwig.Windows {
CalcMode = s?.CalcMode ?? 0,
});
if (s != null && d.CopyModifiers) {
int mult = d.Precision > s.Precision ? (int)Math.Pow(10, d.Precision - s.Precision) : 1;
int div = d.Precision < s.Precision ? (int)Math.Pow(10, s.Precision - d.Precision) : 1;
ctx.AddRange(s.Modifiers.Select(m => new Modifier {
Year = year,
ModId = m.ModId,
Ordering = m.Ordering,
Name = m.Name,
AbsValue = m.AbsValue,
AbsValue = m.AbsValue * mult / div,
RelValue = m.RelValue,
IsStandard = m.IsStandard,
IsQuickSelect = m.IsQuickSelect,