MantisBT - VCMI
View Issue Details
0002696VCMIAI - Adventure Mappublic2017-06-17 08:142017-06-17 08:26
Dydzio 
Warmonger 
normalminoralways
assignedopen 
Microsoft WindowsWindows 7Home Premium x64
1.next 
 
0002696: VCAI::tryBuildNextStructure bug - does not build prerequirements correctly
VCAI::tryBuildNextStructure - this function checks for prerequisites when building structures and is trying to build them too. But if prerequisite has another prerequisite (for example capitol requires castle that requires citadel) - it will try to perform invalid building operation if castle is first prerequisite in prerequisites vector and citadel is not built.

Sample message in vcmi console when this occurs:

"Request to build building 9 in 0 days!"
Make sure AI has lots of resources and try to execute this code in VCAI::buildStructure every day:

if (tryBuildNextStructure(t, std::vector<BuildingID>(goldSource, goldSource + ARRAY_COUNT(goldSource))))
        return;

AI will be stuck trying to build castle every turn after building city hall.
With current code (as of 17.06.2017) without these lines:

if (cb->getDate(Date::DAY_OF_WEEK) > 6) // last 2 days of week - try to focus on growth
{
    if (tryBuildNextStructure(t, std::vector<BuildingID>(unitGrowth, unitGrowth + ARRAY_COUNT(unitGrowth)), 2))
        return;
}

AI would not build fort/citadel/castle at all...
No tags attached.
Issue History
2017-06-17 08:14DydzioNew Issue
2017-06-17 08:14DydzioStatusnew => assigned
2017-06-17 08:14DydzioAssigned To => Warmonger
2017-06-17 08:26DydzioAdditional Information Updatedbug_revision_view_page.php?rev_id=3356#r3356

There are no notes attached to this issue.