r932 - trunk/code/botlib

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Oct 12 08:51:24 EDT 2006


Author: thilo
Date: 2006-10-12 08:51:24 -0400 (Thu, 12 Oct 2006)
New Revision: 932

Modified:
   trunk/code/botlib/be_ai_weight.c
Log:
Fix weight calculation in botlib, found by Andi Christ. (#2889)


Modified: trunk/code/botlib/be_ai_weight.c
===================================================================
--- trunk/code/botlib/be_ai_weight.c	2006-10-11 05:05:52 UTC (rev 931)
+++ trunk/code/botlib/be_ai_weight.c	2006-10-12 12:51:24 UTC (rev 932)
@@ -593,9 +593,9 @@
 			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




More information about the quake3-commits mailing list