aboutsummaryrefslogtreecommitdiffstats
path: root/code/botlib
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-10-12 12:51:24 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-10-12 12:51:24 +0000
commit04ea0138a7366d52074c11e69dbd9e26a9398ce4 (patch)
tree5d2c5f95c392ccce486dc8c190200ad947315639 /code/botlib
parent3a5adf859a06d8e2c1b91cd55d7c76e6cd73658c (diff)
downloadioquake3-aero-04ea0138a7366d52074c11e69dbd9e26a9398ce4.tar.gz
ioquake3-aero-04ea0138a7366d52074c11e69dbd9e26a9398ce4.zip
Fix weight calculation in botlib, found by Andi Christ. (#2889)
git-svn-id: svn://svn.icculus.org/quake3/trunk@932 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/botlib')
-rw-r--r--code/botlib/be_ai_weight.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/code/botlib/be_ai_weight.c b/code/botlib/be_ai_weight.c
index 2324ed2..ef5080d 100644
--- a/code/botlib/be_ai_weight.c
+++ b/code/botlib/be_ai_weight.c
@@ -593,9 +593,9 @@ float FuzzyWeight_r(int *inventory, fuzzyseperator_t *fs)
if (fs->next->child) w2 = FuzzyWeight_r(inventory, fs->next->child);
else w2 = fs->next->weight;
//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
- return scale * w1 + (1 - scale) * w2;
+ return (1 - scale) * w1 + scale * w2;;
} //end if
return FuzzyWeight_r(inventory, fs->next);
} //end else if