mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-24 13:11:30 +00:00
Fix weight calculation in botlib, found by Andi Christ. (#2889)
This commit is contained in:
parent
338ca1689e
commit
2977d001e4
1 changed files with 2 additions and 2 deletions
|
@ -593,9 +593,9 @@ float FuzzyWeight_r(int *inventory, fuzzyseperator_t *fs)
|
||||||
if (fs->next->child) w2 = FuzzyWeight_r(inventory, fs->next->child);
|
if (fs->next->child) w2 = FuzzyWeight_r(inventory, fs->next->child);
|
||||||
else w2 = fs->next->weight;
|
else w2 = fs->next->weight;
|
||||||
//the scale factor
|
//the scale factor
|
||||||
scale = (inventory[fs->index] - fs->value) / (fs->next->value - fs->value);
|
scale = (float) (inventory[fs->index] - fs->value) / (fs->next->value - fs->value);
|
||||||
//scale between the two weights
|
//scale between the two weights
|
||||||
return scale * w1 + (1 - scale) * w2;
|
return (1 - scale) * w1 + scale * w2;;
|
||||||
} //end if
|
} //end if
|
||||||
return FuzzyWeight_r(inventory, fs->next);
|
return FuzzyWeight_r(inventory, fs->next);
|
||||||
} //end else if
|
} //end else if
|
||||||
|
|
Loading…
Reference in a new issue