diff --git a/AI/Nullkiller/Analyzers/ArmyManager.cpp b/AI/Nullkiller/Analyzers/ArmyManager.cpp index fef7fcce6..48e2f3169 100644 --- a/AI/Nullkiller/Analyzers/ArmyManager.cpp +++ b/AI/Nullkiller/Analyzers/ArmyManager.cpp @@ -204,7 +204,6 @@ std::shared_ptr ArmyManager::getArmyAvailableToBuyAsCCreatureSet( TResources availableRes) const { std::vector creaturesInDwellings; - int freeHeroSlots = GameConstants::ARMY_SIZE; auto army = std::make_shared(); for(int i = dwelling->creatures.size() - 1; i >= 0; i--) @@ -497,4 +496,4 @@ ArmyUpgradeInfo ArmyManager::calculateCreaturesUpgrade( } return result; -} \ No newline at end of file +} diff --git a/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp b/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp index 0b168227c..72314e61d 100644 --- a/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp +++ b/AI/Nullkiller/Analyzers/BuildAnalyzer.cpp @@ -129,8 +129,6 @@ void BuildAnalyzer::update() { logAi->trace("Checking town %s", town->name); - auto townInfo = town->town; - developmentInfos.push_back(TownDevelopmentInfo(town)); TownDevelopmentInfo & developmentInfo = developmentInfos.back(); @@ -399,4 +397,4 @@ std::string BuildingInfo::toString() const + ", creature: " + std::to_string(creatureGrows) + " x " + std::to_string(creatureLevel) + " x " + creatureCost.toString() + ", daily: " + dailyIncome.toString(); -} \ No newline at end of file +} diff --git a/AI/Nullkiller/Analyzers/HeroManager.h b/AI/Nullkiller/Analyzers/HeroManager.h index 8ade6cf7c..8248a2b0b 100644 --- a/AI/Nullkiller/Analyzers/HeroManager.h +++ b/AI/Nullkiller/Analyzers/HeroManager.h @@ -54,11 +54,10 @@ private: static SecondarySkillEvaluator scountSkillsScores; CCallback * cb; //this is enough, but we downcast from CCallback - const Nullkiller * ai; std::map heroRoles; public: - HeroManager(CCallback * CB, const Nullkiller * ai) : cb(CB), ai(ai) {} + HeroManager(CCallback * CB, const Nullkiller * ai) : cb(CB) {} const std::map & getHeroRoles() const override; HeroRole getHeroRole(const HeroPtr & hero) const override; int selectBestSkill(const HeroPtr & hero, const std::vector & skills) const override; diff --git a/AI/Nullkiller/Behaviors/BuildingBehavior.cpp b/AI/Nullkiller/Behaviors/BuildingBehavior.cpp index 22386683e..5fc50c213 100644 --- a/AI/Nullkiller/Behaviors/BuildingBehavior.cpp +++ b/AI/Nullkiller/Behaviors/BuildingBehavior.cpp @@ -53,8 +53,6 @@ Goals::TGoalVec BuildingBehavior::decompose() const for(auto & developmentInfo : developmentInfos) { - auto town = developmentInfo.town; - for(auto & buildingInfo : developmentInfo.toBuild) { if(goldPreasure < MAX_GOLD_PEASURE || buildingInfo.dailyIncome[Res::GOLD] > 0) diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.cpp b/AI/Nullkiller/Engine/PriorityEvaluator.cpp index cd4e05035..58f97b837 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.cpp +++ b/AI/Nullkiller/Engine/PriorityEvaluator.cpp @@ -645,7 +645,6 @@ public: } auto heroPtr = task->hero; - auto day = ai->cb->getDate(Date::DAY); auto hero = heroPtr.get(ai->cb.get()); bool checkGold = evaluationContext.danger == 0; auto army = path.heroArmy; @@ -670,11 +669,8 @@ public: class ClusterEvaluationContextBuilder : public IEvaluationContextBuilder { -private: - const Nullkiller * ai; - public: - ClusterEvaluationContextBuilder(const Nullkiller * ai) : ai(ai) {} + ClusterEvaluationContextBuilder(const Nullkiller * ai) {} virtual void buildEvaluationContext(EvaluationContext & evaluationContext, Goals::TSubgoal task) const override { @@ -699,7 +695,6 @@ public: for(auto objInfo : objects) { auto target = objInfo.first; - auto day = ai->cb->getDate(Date::DAY); bool checkGold = objInfo.second.danger == 0; auto army = hero; @@ -718,9 +713,6 @@ public: if(boost > 8) break; } - - const AIPath & pathToCenter = clusterGoal.getPathToCenter(); - } }; diff --git a/AI/Nullkiller/Pathfinding/Actions/BoatActions.h b/AI/Nullkiller/Pathfinding/Actions/BoatActions.h index 0db5ff781..4b2812b21 100644 --- a/AI/Nullkiller/Pathfinding/Actions/BoatActions.h +++ b/AI/Nullkiller/Pathfinding/Actions/BoatActions.h @@ -24,9 +24,6 @@ namespace AIPathfinding class SummonBoatAction : public VirtualBoatAction { - private: - const CGHeroInstance * hero; - public: virtual void execute(const CGHeroInstance * hero) const override; @@ -71,4 +68,4 @@ namespace AIPathfinding virtual const CGObjectInstance * targetObject() const override; }; -} \ No newline at end of file +} diff --git a/AI/Nullkiller/Pathfinding/Actors.cpp b/AI/Nullkiller/Pathfinding/Actors.cpp index 68d10fecc..e6806a0b2 100644 --- a/AI/Nullkiller/Pathfinding/Actors.cpp +++ b/AI/Nullkiller/Pathfinding/Actors.cpp @@ -269,8 +269,6 @@ ExchangeResult HeroExchangeMap::tryExchangeNoLock(const ChainActor * other) return result; // already inserted } - auto position = inserted.first; - auto differentMasks = (actor->chainMask & other->chainMask) == 0; if(!differentMasks) return result; @@ -461,15 +459,6 @@ CCreatureSet * DwellingActor::getDwellingCreatures(const CGDwelling * dwelling, continue; auto creature = creatureInfo.second.back().toCreature(); - auto count = creatureInfo.first; - - if(waitForGrowth) - { - const CGTownInstance * town = dynamic_cast(dwelling); - - count += town ? town->creatureGrowth(creature->level) : creature->growth; - } - dwellingCreatures->addToSlot( dwellingCreatures->getSlotFor(creature), creature->idNumber, @@ -487,4 +476,4 @@ TownGarrisonActor::TownGarrisonActor(const CGTownInstance * town, uint64_t chain std::string TownGarrisonActor::toString() const { return town->name; -} \ No newline at end of file +} diff --git a/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp b/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp index 8ffcf1be7..68aab0c35 100644 --- a/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp +++ b/AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.cpp @@ -126,7 +126,6 @@ namespace AIPathfinding const AIPathNode * destinationNode = nodeStorage->getAINode(destination.node); auto questObj = dynamic_cast(destination.nodeObject); auto questInfo = QuestInfo(questObj->quest, destination.nodeObject, destination.coord); - auto nodeHero = pathfinderHelper->hero; QuestAction questAction(questInfo); if(destination.nodeObject->ID == Obj::QUEST_GUARD && questObj->quest->missionType == CQuest::MISSION_NONE) @@ -157,8 +156,6 @@ namespace AIPathfinding nodeStorage->updateAINode(destination.node, [&](AIPathNode * node) { - auto questInfo = QuestInfo(questObj->quest, destination.nodeObject, destination.coord); - node->specialAction.reset(new QuestAction(questAction)); }); } diff --git a/AI/VCAI/ResourceManager.cpp b/AI/VCAI/ResourceManager.cpp index 60289124e..d676c4488 100644 --- a/AI/VCAI/ResourceManager.cpp +++ b/AI/VCAI/ResourceManager.cpp @@ -120,14 +120,12 @@ Goals::TSubgoal ResourceManager::collectResourcesForOurGoal(ResourceObjective &o return o.goal; } - float goalPriority = 10; //arbitrary, will be divided for (const resPair p : missingResources) { if (!income[p.first]) //prioritize resources with 0 income { resourceType = p.first; amountToCollect = p.second; - goalPriority /= amountToCollect; //need more resources -> lower priority break; } } @@ -138,7 +136,7 @@ Goals::TSubgoal ResourceManager::collectResourcesForOurGoal(ResourceObjective &o std::map daysToEarn; for (auto it : missingResources) daysToEarn[it.first] = (float)missingResources[it.first] / income[it.first]; - auto incomeComparer = [&income](const timePair & lhs, const timePair & rhs) -> bool + auto incomeComparer = [](const timePair & lhs, const timePair & rhs) -> bool { //theoretically income can be negative, but that falls into this comparison return lhs.second < rhs.second; @@ -146,12 +144,9 @@ Goals::TSubgoal ResourceManager::collectResourcesForOurGoal(ResourceObjective &o resourceType = boost::max_element(daysToEarn, incomeComparer)->first; amountToCollect = missingResources[resourceType]; - goalPriority /= daysToEarn[resourceType]; //more days - lower priority } - if (resourceType == Res::GOLD) - goalPriority *= 1000; - //this is abstract goal and might take soem time to complete + //this is abstract goal and might take some time to complete return Goals::sptr(Goals::CollectRes(resourceType, amountToCollect).setisAbstract(true)); } diff --git a/client/battle/CBattleInterface.cpp b/client/battle/CBattleInterface.cpp index 50d41a8c3..016d161dd 100644 --- a/client/battle/CBattleInterface.cpp +++ b/client/battle/CBattleInterface.cpp @@ -1083,11 +1083,10 @@ void CBattleInterface::stacksAreAttacked(std::vector attacked std::array killedBySide = {0, 0}; - int targets = 0, damage = 0; + int targets = 0; for(const StackAttackedInfo & attackedInfo : attackedInfos) { ++targets; - damage += (int)attackedInfo.dmg; ui8 side = attackedInfo.defender->side; killedBySide.at(side) += attackedInfo.amountKilled; diff --git a/lib/events/ApplyDamage.cpp b/lib/events/ApplyDamage.cpp index 8ba3de747..93b387899 100644 --- a/lib/events/ApplyDamage.cpp +++ b/lib/events/ApplyDamage.cpp @@ -25,10 +25,8 @@ SubscriptionRegistry * ApplyDamage::getRegistry() } CApplyDamage::CApplyDamage(const Environment * env_, BattleStackAttacked * pack_, std::shared_ptr target_) - : env(env_), - pack(pack_), + : pack(pack_), target(target_) - { initalDamage = pack->damageAmount; } diff --git a/lib/events/ApplyDamage.h b/lib/events/ApplyDamage.h index c56d730fe..178d12224 100644 --- a/lib/events/ApplyDamage.h +++ b/lib/events/ApplyDamage.h @@ -28,12 +28,8 @@ public: private: int64_t initalDamage; - const Environment * env; BattleStackAttacked * pack; std::shared_ptr target; }; } - - - diff --git a/lib/rmg/Zone.cpp b/lib/rmg/Zone.cpp index 7323a27fd..6b2f977f2 100644 --- a/lib/rmg/Zone.cpp +++ b/lib/rmg/Zone.cpp @@ -193,11 +193,7 @@ void Zone::fractalize() rmg::Area clearedTiles(dAreaFree); rmg::Area possibleTiles(dAreaPossible); rmg::Area tilesToIgnore; //will be erased in this iteration - - //the more treasure density, the greater distance between paths. Scaling is experimental. - int totalDensity = 0; - for(auto ti : treasureInfo) - totalDensity += ti.density; + const float minDistance = 10 * 10; //squared if(type != ETemplateZoneType::JUNCTION)