diff --git a/CvGameCoreDLL_Expansion2/CvAStar.cpp b/CvGameCoreDLL_Expansion2/CvAStar.cpp index e422685600..9ba2979670 100644 --- a/CvGameCoreDLL_Expansion2/CvAStar.cpp +++ b/CvGameCoreDLL_Expansion2/CvAStar.cpp @@ -1552,7 +1552,7 @@ int PathValid(const CvAStarNode* parent, const CvAStarNode* node, const SPathFin //if there are no enemies here or they have been killed in tactsim (hypothetically) if (!kToNodeCacheData.bIsVisibleEnemyCombatUnit && !kToNodeCacheData.bIsVisibleEnemyUnit && !kToNodeCacheData.bIsVisibleNeutralCombatUnit) { - if (!canEnterTerritoryAndTerrain(pUnit, pToPlot, kToNodeCacheData.iMoveFlags)) + if (!canEnterTerritoryAndTerrain(pUnit, pToPlot, kToNodeCacheData.iMoveFlags) || (kToNodeCacheData.bIsNonEnemyCity && !pUnit->IsCivilianUnit())) return FALSE; } else diff --git a/CvGameCoreDLL_Expansion2/CvDangerPlots.cpp b/CvGameCoreDLL_Expansion2/CvDangerPlots.cpp index 3d79c2c98c..c1481f579c 100644 --- a/CvGameCoreDLL_Expansion2/CvDangerPlots.cpp +++ b/CvGameCoreDLL_Expansion2/CvDangerPlots.cpp @@ -780,8 +780,8 @@ int CvDangerPlotContents::GetDanger(const CvUnit* pUnit, const UnitIdContainer& CvCity* pFriendlyCity = m_pPlot->isFriendlyCity(*pUnit) ? m_pPlot->getPlotCity() : NULL; - // Civilians can be captured - unless they would need to be embarked on this plot - if (!pUnit->IsCombatUnit() && pUnit->isNativeDomain(m_pPlot)) + // Civilians can be captured + if (pUnit->IsCivilianUnit()) { // If plot contains an enemy unit, mark it as max danger if (m_pPlot->isEnemyUnit(pUnit->getOwner(),true,true)) diff --git a/CvGameCoreDLL_Expansion2/CvHomelandAI.cpp b/CvGameCoreDLL_Expansion2/CvHomelandAI.cpp index cd8931ffea..9d3db7d26b 100644 --- a/CvGameCoreDLL_Expansion2/CvHomelandAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvHomelandAI.cpp @@ -1281,7 +1281,6 @@ bool CvHomelandAI::SendUnitGift(DomainTypes eDomain) if (eBestGiftTarget != NO_PLAYER) { vector vUnitIDs; - bool bFoundOne = false; int iLoop = 0; for (CvUnit* pUnit = m_pPlayer->firstUnit(&iLoop); pUnit != NULL; pUnit = m_pPlayer->nextUnit(&iLoop)) { @@ -1313,11 +1312,10 @@ bool CvHomelandAI::SendUnitGift(DomainTypes eDomain) } vUnitIDs.push_back(pUnit->GetID()); - bFoundOne = true; } } } - if (bFoundOne) + if (!vUnitIDs.empty()) { CvUnit* pGiftedUnit = NULL; int GiftedUnitID = -1; diff --git a/CvGameCoreDLL_Expansion2/CvPlot.cpp b/CvGameCoreDLL_Expansion2/CvPlot.cpp index 5ba8027a27..2143166457 100644 --- a/CvGameCoreDLL_Expansion2/CvPlot.cpp +++ b/CvGameCoreDLL_Expansion2/CvPlot.cpp @@ -4780,7 +4780,7 @@ bool CvPlot::isNeutralUnit(PlayerTypes ePlayer, bool bCombat, bool bCheckVisibil if(pLoopUnit && !pLoopUnit->isInvisible(eTeam, false) && !pLoopUnit->IsDead()) { //airplanes not included - if (bCombat && (!pLoopUnit->IsCanDefend() || !pLoopUnit->isNativeDomain(this))) + if (bCombat && !pLoopUnit->IsCanDefend()) continue; if (bIgnoreMinors && GET_PLAYER(pLoopUnit->getOwner()).isMinorCiv()) diff --git a/CvGameCoreDLL_Expansion2/CvTacticalAI.cpp b/CvGameCoreDLL_Expansion2/CvTacticalAI.cpp index 14e6a5ad1e..8a4859abd8 100644 --- a/CvGameCoreDLL_Expansion2/CvTacticalAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvTacticalAI.cpp @@ -7317,14 +7317,14 @@ void ScoreAttack(const CvTacticalPlot& tactPlot, const CvUnit* pUnit, const CvTa } else { - iExtraScore += 300; //capturing a city is important + iExtraScore += 600; //capturing a city is important result.eAssignmentType = A_MELEEKILL; } } else //enemy unit killed { //tbd: same bonus for melee kill and range kill? do we have a preference? what about move-after-attack? - iExtraScore += 30; + iExtraScore += 200; if (pTestPlot->getNumUnits() > 1 && !pTestPlot->isNeutralUnit(pUnit->getOwner(), false, false)) iExtraScore += 20; //even more points for a double kill @@ -9127,8 +9127,8 @@ bool CvTacticalPosition::addFinishMovesIfAcceptable(bool bEarlyFinish) if (!pInitial) return false; //something wrong - //if the unit is blocked but has movement left and can flee, let's assume that is ok. also if we never moved it. - if (unit.eLastAssignment == A_BLOCKED && (unit.iMovesLeft>GC.getMOVE_DENOMINATOR() || unit.iPlotIndex==pInitial->iToPlotIndex)) + //if the unit is blocked but has movement left and can flee, let's assume that is ok + if (unit.eLastAssignment == A_BLOCKED && unit.iMovesLeft>GC.getMOVE_DENOMINATOR()) continue; //if we have a restart pending, that can also be ok if we're not planning to stay @@ -9157,6 +9157,15 @@ bool CvTacticalPosition::addFinishMovesIfAcceptable(bool bEarlyFinish) return false; } + //try to enforce some sort of sparsity, we should use only the minimum amount of units. + //so give a bonus for unmoved units. especially important in earlyFinish situations with many units. + for (size_t i = 0; i < availableUnits.size(); i++) + { + const SUnitStats& unit = availableUnits[i]; + if (unit.eLastAssignment == A_INITIAL) + iTotalScore += 30; + } + //scores look good and target was killed, we're done if (bEarlyFinish) { diff --git a/CvGameCoreDLL_Expansion2/CvTacticalAnalysisMap.cpp b/CvGameCoreDLL_Expansion2/CvTacticalAnalysisMap.cpp index 7d0252af4e..d705f4c231 100644 --- a/CvGameCoreDLL_Expansion2/CvTacticalAnalysisMap.cpp +++ b/CvGameCoreDLL_Expansion2/CvTacticalAnalysisMap.cpp @@ -479,7 +479,7 @@ eTacticalPosture CvTacticalDominanceZone::SelectPostureSingleZone(int iDominance } case TACTICAL_TERRITORY_FRIENDLY: { - m_ePosture = (eOverallDominance == TACTICAL_DOMINANCE_ENEMY) ? TACTICAL_POSTURE_HEDGEHOG : TACTICAL_POSTURE_COUNTERATTACK; + m_ePosture = TACTICAL_POSTURE_COUNTERATTACK; break; } }