From 2977d001e4786cf5d675c257a801719227a8565e Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Thu, 12 Oct 2006 12:51:24 +0000 Subject: [PATCH] Fix weight calculation in botlib, found by Andi Christ. (#2889) --- code/botlib/be_ai_weight.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/botlib/be_ai_weight.c b/code/botlib/be_ai_weight.c index 2324ed21..ef5080d1 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