Skip to content

Commit

Permalink
Revert partially incorrect fix and add a few more float casts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thilo Schulz committed Oct 12, 2006
1 parent 2977d00 commit a88611d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/botlib/be_ai_weight.c
Expand Up @@ -595,7 +595,7 @@ float FuzzyWeight_r(int *inventory, fuzzyseperator_t *fs)
//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
Expand Down Expand Up @@ -627,7 +627,7 @@ float FuzzyWeightUndecided_r(int *inventory, fuzzyseperator_t *fs)
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
Expand Down Expand Up @@ -750,7 +750,7 @@ void ScaleFuzzySeperator_r(fuzzyseperator_t *fs, float scale)
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;
Expand Down

0 comments on commit a88611d

Please sign in to comment.