mirror of https://github.com/FreeCol/freecol.git
Fixes slow AI turns caused by not being able to build new colonies. This is a temporary fix that should be removed when BuildColonyMissions are building colonies according to a grand plan (and the costly searches per unit therefor can be avoided).
This commit is contained in:
parent
18c969071e
commit
146923ee2e
|
@ -1795,11 +1795,22 @@ public class EuropeanAIPlayer extends MissionAIPlayer {
|
|||
done.clear();
|
||||
}
|
||||
if (nBuilders > 0) {
|
||||
/*
|
||||
* Temporary fix for endless amount of colonists not being assigned
|
||||
* any mission. See BR#3322
|
||||
*/
|
||||
final int MAX_BUILDING_MISSION_TRIES = 50;
|
||||
|
||||
int tries = 0;
|
||||
for (AIUnit aiUnit : sort(aiUnits, builderComparator)) {
|
||||
if (aiUnit.getUnit().isArmed() && getGame().getTurn().getNumber() > 20) {
|
||||
// Quickfix to avoid having all soldies being given a BuildColonyMission.
|
||||
continue;
|
||||
}
|
||||
tries++;
|
||||
if (tries > MAX_BUILDING_MISSION_TRIES) {
|
||||
break;
|
||||
}
|
||||
final Location oldTarget = ((m = aiUnit.getMission()) == null)
|
||||
? null : m.getTarget();
|
||||
if ((m = getBuildColonyMission(aiUnit, null)) == null)
|
||||
|
|
Loading…
Reference in New Issue