mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
remove unused variables
This commit is contained in:
parent
143b0983e6
commit
c9c79887a7
@ -204,7 +204,6 @@ std::shared_ptr<CCreatureSet> ArmyManager::getArmyAvailableToBuyAsCCreatureSet(
|
||||
TResources availableRes) const
|
||||
{
|
||||
std::vector<creInfo> creaturesInDwellings;
|
||||
int freeHeroSlots = GameConstants::ARMY_SIZE;
|
||||
auto army = std::make_shared<TemporaryArmy>();
|
||||
|
||||
for(int i = dwelling->creatures.size() - 1; i >= 0; i--)
|
||||
@ -497,4 +496,4 @@ ArmyUpgradeInfo ArmyManager::calculateCreaturesUpgrade(
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -54,11 +54,10 @@ private:
|
||||
static SecondarySkillEvaluator scountSkillsScores;
|
||||
|
||||
CCallback * cb; //this is enough, but we downcast from CCallback
|
||||
const Nullkiller * ai;
|
||||
std::map<HeroPtr, HeroRole> heroRoles;
|
||||
|
||||
public:
|
||||
HeroManager(CCallback * CB, const Nullkiller * ai) : cb(CB), ai(ai) {}
|
||||
HeroManager(CCallback * CB, const Nullkiller * ai) : cb(CB) {}
|
||||
const std::map<HeroPtr, HeroRole> & getHeroRoles() const override;
|
||||
HeroRole getHeroRole(const HeroPtr & hero) const override;
|
||||
int selectBestSkill(const HeroPtr & hero, const std::vector<SecondarySkill> & skills) const override;
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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<const CGTownInstance *>(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;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,6 @@ namespace AIPathfinding
|
||||
const AIPathNode * destinationNode = nodeStorage->getAINode(destination.node);
|
||||
auto questObj = dynamic_cast<const IQuestObject *>(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));
|
||||
});
|
||||
}
|
||||
|
@ -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<Res::ERes, float> 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));
|
||||
}
|
||||
|
||||
|
@ -1083,11 +1083,10 @@ void CBattleInterface::stacksAreAttacked(std::vector<StackAttackedInfo> attacked
|
||||
|
||||
std::array<int, 2> 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;
|
||||
|
@ -25,10 +25,8 @@ SubscriptionRegistry<ApplyDamage> * ApplyDamage::getRegistry()
|
||||
}
|
||||
|
||||
CApplyDamage::CApplyDamage(const Environment * env_, BattleStackAttacked * pack_, std::shared_ptr<battle::Unit> target_)
|
||||
: env(env_),
|
||||
pack(pack_),
|
||||
: pack(pack_),
|
||||
target(target_)
|
||||
|
||||
{
|
||||
initalDamage = pack->damageAmount;
|
||||
}
|
||||
|
@ -28,12 +28,8 @@ public:
|
||||
private:
|
||||
int64_t initalDamage;
|
||||
|
||||
const Environment * env;
|
||||
BattleStackAttacked * pack;
|
||||
std::shared_ptr<battle::Unit> target;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user