Esempio n. 1
0
 void operator() (const BuildingInfo::ReligionNode& node)
 {
     if (node.prereqReligion != NO_RELIGION && !city_.getCvCity()->isHasReligion(node.prereqReligion))
     {
         for (int i = 0, count = gGlobals.getNumUnitClassInfos(); i < count; ++i)
         {
             UnitTypes unitType = getPlayerVersion(player_.getPlayerID(), (UnitClassTypes)i);
             if (unitType != NO_UNIT && gGlobals.getUnitInfo(unitType).getReligionSpreads(node.prereqReligion) > 0)
             {
                 pTactic_->addDependency(IDependentTacticPtr(new ReligiousDependency(node.prereqReligion, unitType)));
                 break;
             }
         }                
     }
 }
Esempio n. 2
0
        bool operator() (const UnitInfo::UpgradeNode& node) const
        {
            for (size_t i = 0, count = node.upgrades.size(); i < count; ++i)
            {
                UnitTypes upgradeUnit = getPlayerVersion(player_.getPlayerID(), node.upgrades[i]);
                if (upgradeUnit == NO_UNIT)  // can't upgrade
                {
                    return false;
                }

                if (!couldConstructUnit(player_, 0, player_.getAnalysis()->getUnitInfo(upgradeUnit), false))
                {
                    return false;
                }
            }
            return !node.upgrades.empty();  // can construct all upgrades, and there are some
        }