forked from 0ad/0ad
Fix issue with preferences in BuildingAI. Refs #1731
This was SVN commit r16580.
This commit is contained in:
parent
6c13bd92fd
commit
604538a63a
@ -306,6 +306,7 @@ BuildingAI.prototype.FireArrows = function()
|
||||
|
||||
// add targets to a weighted list, to allow preferences
|
||||
var targets = new WeightedList();
|
||||
var maxPreferenceBonus = this.MAX_PREFERENCE_BONUS;
|
||||
var addTarget = function(target)
|
||||
{
|
||||
var preference = cmpAttack.GetPreference(target);
|
||||
@ -314,7 +315,7 @@ BuildingAI.prototype.FireArrows = function()
|
||||
{
|
||||
// Lower preference scores indicate a higher preference so they
|
||||
// should result in a higher weight.
|
||||
weight = 1 + this.MAX_PREFERENCE_BONUS / (1 + preference);
|
||||
weight = 1 + maxPreferenceBonus / (1 + preference);
|
||||
}
|
||||
targets.push(target, weight);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user