r933 - trunk/code/botlib
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Oct 12 09:13:08 EDT 2006
Author: thilo
Date: 2006-10-12 09:13:08 -0400 (Thu, 12 Oct 2006)
New Revision: 933
Modified:
trunk/code/botlib/be_ai_weight.c
Log:
Revert partially incorrect fix and add a few more float casts.
Modified: trunk/code/botlib/be_ai_weight.c
===================================================================
--- trunk/code/botlib/be_ai_weight.c 2006-10-12 12:51:24 UTC (rev 932)
+++ trunk/code/botlib/be_ai_weight.c 2006-10-12 13:13:08 UTC (rev 933)
@@ -595,7 +595,7 @@
//the scale factor
scale = (float) (inventory[fs->index] - fs->value) / (fs->next->value - fs->value);
//scale between the two weights
- return (1 - scale) * w1 + scale * w2;;
+ return scale * w1 + (1 - scale) * w2;
} //end if
return FuzzyWeight_r(inventory, fs->next);
} //end else if
@@ -627,7 +627,7 @@
if (fs->next->child) w2 = FuzzyWeight_r(inventory, fs->next->child);
else w2 = fs->next->minweight + random() * (fs->next->maxweight - fs->next->minweight);
//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;
} //end if
@@ -750,7 +750,7 @@
else if (fs->type == WT_BALANCE)
{
//
- fs->weight = (fs->maxweight + fs->minweight) * scale;
+ fs->weight = (float) (fs->maxweight + fs->minweight) * scale;
//get the weight between bounds
if (fs->weight < fs->minweight) fs->weight = fs->minweight;
else if (fs->weight > fs->maxweight) fs->weight = fs->maxweight;
More information about the quake3-commits
mailing list