mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Prevent shadowing of function arguments by local vars
This commit is contained in:
parent
e814aca29f
commit
7be9aa4868
@ -2381,8 +2381,8 @@ void VCAI::striveToGoal(Goals::TSubgoal basicGoal)
|
||||
logAi->debug("The error message was: %s", e.what());
|
||||
|
||||
//erase base goal if we failed to execute decomposed goal
|
||||
for (auto basicGoal : ultimateGoalsFromBasic[elementarGoal])
|
||||
goalsToRemove.push_back(basicGoal);
|
||||
for (auto basicGoalToRemove : ultimateGoalsFromBasic[elementarGoal])
|
||||
goalsToRemove.push_back(basicGoalToRemove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,10 +49,10 @@ void CreatureCostBox::createItems(TResources res)
|
||||
{
|
||||
int curx = pos.w / 2 - (16 * resources.size()) - (8 * (resources.size() - 1));
|
||||
//reverse to display gold as first resource
|
||||
for(auto & res : boost::adaptors::reverse(resources))
|
||||
for(auto & currentRes : boost::adaptors::reverse(resources))
|
||||
{
|
||||
res.second.first->moveBy(Point(curx, 22));
|
||||
res.second.second->moveBy(Point(curx, 22));
|
||||
currentRes.second.first->moveBy(Point(curx, 22));
|
||||
currentRes.second.second->moveBy(Point(curx, 22));
|
||||
curx += 48;
|
||||
}
|
||||
}
|
||||
|
@ -277,9 +277,9 @@ void CHeroList::update(const CGHeroInstance * hero)
|
||||
listBox->resize(LOCPLINT->wanderingHeroes.size());
|
||||
if (adventureInt->selection)
|
||||
{
|
||||
auto hero = dynamic_cast<const CGHeroInstance *>(adventureInt->selection);
|
||||
if (hero)
|
||||
select(hero);
|
||||
auto selectedHero = dynamic_cast<const CGHeroInstance *>(adventureInt->selection);
|
||||
if (selectedHero)
|
||||
select(selectedHero);
|
||||
}
|
||||
CList::update();
|
||||
}
|
||||
|
@ -377,10 +377,10 @@ QStringList CModListView::findInvalidDependencies(QString mod)
|
||||
return ret;
|
||||
}
|
||||
|
||||
QStringList CModListView::findBlockingMods(QString mod)
|
||||
QStringList CModListView::findBlockingMods(QString modUnderTest)
|
||||
{
|
||||
QStringList ret;
|
||||
auto required = modModel->getRequirements(mod);
|
||||
auto required = modModel->getRequirements(modUnderTest);
|
||||
|
||||
for(QString name : modModel->getModList())
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ class CModListView : public QWidget
|
||||
// find mods unknown to mod list (not present in repo and not installed)
|
||||
QStringList findInvalidDependencies(QString mod);
|
||||
// find mods that block enabling of this mod: conflicting with this mod or one of required mods
|
||||
QStringList findBlockingMods(QString mod);
|
||||
QStringList findBlockingMods(QString modUnderTest);
|
||||
// find mods that depend on this one
|
||||
QStringList findDependentMods(QString mod, bool excludeDisabled);
|
||||
|
||||
|
@ -556,9 +556,9 @@ EBuildingState::EBuildingState CGameInfoCallback::canBuildStructure( const CGTow
|
||||
const PlayerState *ps = getPlayer(t->tempOwner, false);
|
||||
if(ps)
|
||||
{
|
||||
for(const CGTownInstance *t : ps->towns)
|
||||
for(const CGTownInstance *town : ps->towns)
|
||||
{
|
||||
if(t->hasBuilt(BuildingID::CAPITOL))
|
||||
if(town->hasBuilt(BuildingID::CAPITOL))
|
||||
{
|
||||
return EBuildingState::HAVE_CAPITAL; //no more than one capitol
|
||||
}
|
||||
|
@ -160,15 +160,15 @@ std::vector<std::string> ZipArchive::listFiles(boost::filesystem::path filename)
|
||||
do
|
||||
{
|
||||
unz_file_info64 info;
|
||||
std::vector<char> filename;
|
||||
std::vector<char> zipFilename;
|
||||
|
||||
unzGetCurrentFileInfo64 (file, &info, nullptr, 0, nullptr, 0, nullptr, 0);
|
||||
|
||||
filename.resize(info.size_filename);
|
||||
zipFilename.resize(info.size_filename);
|
||||
// Get name of current file. Contrary to docs "info" parameter can't be null
|
||||
unzGetCurrentFileInfo64 (file, &info, filename.data(), filename.size(), nullptr, 0, nullptr, 0);
|
||||
unzGetCurrentFileInfo64 (file, &info, zipFilename.data(), zipFilename.size(), nullptr, 0, nullptr, 0);
|
||||
|
||||
ret.push_back(std::string(filename.data(), filename.size()));
|
||||
ret.push_back(std::string(zipFilename.data(), zipFilename.size()));
|
||||
}
|
||||
while (unzGoToNextFile(file) == UNZ_OK);
|
||||
}
|
||||
|
@ -113,8 +113,8 @@ void CFilesystemGenerator::loadJsonMap(const std::string &mountPoint, const Json
|
||||
if (filename)
|
||||
{
|
||||
auto configData = CResourceHandler::get("initial")->load(ResourceID(URI, EResType::TEXT))->readAll();
|
||||
const JsonNode config((char*)configData.first.get(), configData.second);
|
||||
filesystem->addLoader(new CMappedFileLoader(mountPoint, config), false);
|
||||
const JsonNode configInitial((char*)configData.first.get(), configData.second);
|
||||
filesystem->addLoader(new CMappedFileLoader(mountPoint, configInitial), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -985,24 +985,24 @@ bool CRmgTemplateZone::createTreasurePile(int3 &pos, float minDistance, const CT
|
||||
//find object closest to free path, then connect it to the middle of the zone
|
||||
|
||||
int3 closestTile = int3(-1,-1,-1);
|
||||
float minDistance = 1e10;
|
||||
float minTreasureDistance = 1e10;
|
||||
|
||||
for (auto visitablePos : info.visitableFromBottomPositions) //objects that are not visitable from top must be accessible from bottom or side
|
||||
{
|
||||
int3 closestFreeTile = findClosestTile(freePaths, visitablePos);
|
||||
if (closestFreeTile.dist2d(visitablePos) < minDistance)
|
||||
if (closestFreeTile.dist2d(visitablePos) < minTreasureDistance)
|
||||
{
|
||||
closestTile = visitablePos + int3 (0, 1, 0); //start below object (y+1), possibly even outside the map, to not make path up through it
|
||||
minDistance = closestFreeTile.dist2d(visitablePos);
|
||||
minTreasureDistance = closestFreeTile.dist2d(visitablePos);
|
||||
}
|
||||
}
|
||||
for (auto visitablePos : info.visitableFromTopPositions) //all objects are accessible from any direction
|
||||
{
|
||||
int3 closestFreeTile = findClosestTile(freePaths, visitablePos);
|
||||
if (closestFreeTile.dist2d(visitablePos) < minDistance)
|
||||
if (closestFreeTile.dist2d(visitablePos) < minTreasureDistance)
|
||||
{
|
||||
closestTile = visitablePos;
|
||||
minDistance = closestFreeTile.dist2d(visitablePos);
|
||||
minTreasureDistance = closestFreeTile.dist2d(visitablePos);
|
||||
}
|
||||
}
|
||||
assert (closestTile.valid());
|
||||
|
@ -528,13 +528,13 @@ Target BattleSpellMechanics::transformSpellTarget(const Target & aimPoint) const
|
||||
else
|
||||
{
|
||||
const Destination & primary = aimPoint.at(0);
|
||||
BattleHex aimPoint = primary.hexValue;
|
||||
BattleHex aimPointHex = primary.hexValue;
|
||||
|
||||
//transform primary spell target with spell range (if it`s valid), leave anything else to effects
|
||||
|
||||
if(aimPoint.isValid())
|
||||
if(aimPointHex.isValid())
|
||||
{
|
||||
auto spellRange = spellRangeInHexes(aimPoint);
|
||||
auto spellRange = spellRangeInHexes(aimPointHex);
|
||||
for(auto & hex : spellRange)
|
||||
spellTarget.push_back(Destination(hex));
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ bool Catapult::applicable(Problem & problem, const Mechanics * m) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void Catapult::apply(BattleStateProxy * battleState, RNG & rng, const Mechanics * m, const EffectTarget & target) const
|
||||
void Catapult::apply(BattleStateProxy * battleState, RNG & rng, const Mechanics * m, const EffectTarget & /* eTarget */) const
|
||||
{
|
||||
//start with all destructible parts
|
||||
static const std::set<EWallPart::EWallPart> possibleTargets =
|
||||
|
Loading…
Reference in New Issue
Block a user