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());
|
logAi->debug("The error message was: %s", e.what());
|
||||||
|
|
||||||
//erase base goal if we failed to execute decomposed goal
|
//erase base goal if we failed to execute decomposed goal
|
||||||
for (auto basicGoal : ultimateGoalsFromBasic[elementarGoal])
|
for (auto basicGoalToRemove : ultimateGoalsFromBasic[elementarGoal])
|
||||||
goalsToRemove.push_back(basicGoal);
|
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));
|
int curx = pos.w / 2 - (16 * resources.size()) - (8 * (resources.size() - 1));
|
||||||
//reverse to display gold as first resource
|
//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));
|
currentRes.second.first->moveBy(Point(curx, 22));
|
||||||
res.second.second->moveBy(Point(curx, 22));
|
currentRes.second.second->moveBy(Point(curx, 22));
|
||||||
curx += 48;
|
curx += 48;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,9 +277,9 @@ void CHeroList::update(const CGHeroInstance * hero)
|
|||||||
listBox->resize(LOCPLINT->wanderingHeroes.size());
|
listBox->resize(LOCPLINT->wanderingHeroes.size());
|
||||||
if (adventureInt->selection)
|
if (adventureInt->selection)
|
||||||
{
|
{
|
||||||
auto hero = dynamic_cast<const CGHeroInstance *>(adventureInt->selection);
|
auto selectedHero = dynamic_cast<const CGHeroInstance *>(adventureInt->selection);
|
||||||
if (hero)
|
if (selectedHero)
|
||||||
select(hero);
|
select(selectedHero);
|
||||||
}
|
}
|
||||||
CList::update();
|
CList::update();
|
||||||
}
|
}
|
||||||
|
@ -377,10 +377,10 @@ QStringList CModListView::findInvalidDependencies(QString mod)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CModListView::findBlockingMods(QString mod)
|
QStringList CModListView::findBlockingMods(QString modUnderTest)
|
||||||
{
|
{
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
auto required = modModel->getRequirements(mod);
|
auto required = modModel->getRequirements(modUnderTest);
|
||||||
|
|
||||||
for(QString name : modModel->getModList())
|
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)
|
// find mods unknown to mod list (not present in repo and not installed)
|
||||||
QStringList findInvalidDependencies(QString mod);
|
QStringList findInvalidDependencies(QString mod);
|
||||||
// find mods that block enabling of this mod: conflicting with this mod or one of required mods
|
// 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
|
// find mods that depend on this one
|
||||||
QStringList findDependentMods(QString mod, bool excludeDisabled);
|
QStringList findDependentMods(QString mod, bool excludeDisabled);
|
||||||
|
|
||||||
|
@ -556,9 +556,9 @@ EBuildingState::EBuildingState CGameInfoCallback::canBuildStructure( const CGTow
|
|||||||
const PlayerState *ps = getPlayer(t->tempOwner, false);
|
const PlayerState *ps = getPlayer(t->tempOwner, false);
|
||||||
if(ps)
|
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
|
return EBuildingState::HAVE_CAPITAL; //no more than one capitol
|
||||||
}
|
}
|
||||||
|
@ -160,15 +160,15 @@ std::vector<std::string> ZipArchive::listFiles(boost::filesystem::path filename)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
unz_file_info64 info;
|
unz_file_info64 info;
|
||||||
std::vector<char> filename;
|
std::vector<char> zipFilename;
|
||||||
|
|
||||||
unzGetCurrentFileInfo64 (file, &info, nullptr, 0, nullptr, 0, nullptr, 0);
|
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
|
// 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);
|
while (unzGoToNextFile(file) == UNZ_OK);
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,8 @@ void CFilesystemGenerator::loadJsonMap(const std::string &mountPoint, const Json
|
|||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
auto configData = CResourceHandler::get("initial")->load(ResourceID(URI, EResType::TEXT))->readAll();
|
auto configData = CResourceHandler::get("initial")->load(ResourceID(URI, EResType::TEXT))->readAll();
|
||||||
const JsonNode config((char*)configData.first.get(), configData.second);
|
const JsonNode configInitial((char*)configData.first.get(), configData.second);
|
||||||
filesystem->addLoader(new CMappedFileLoader(mountPoint, config), false);
|
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
|
//find object closest to free path, then connect it to the middle of the zone
|
||||||
|
|
||||||
int3 closestTile = int3(-1,-1,-1);
|
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
|
for (auto visitablePos : info.visitableFromBottomPositions) //objects that are not visitable from top must be accessible from bottom or side
|
||||||
{
|
{
|
||||||
int3 closestFreeTile = findClosestTile(freePaths, visitablePos);
|
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
|
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
|
for (auto visitablePos : info.visitableFromTopPositions) //all objects are accessible from any direction
|
||||||
{
|
{
|
||||||
int3 closestFreeTile = findClosestTile(freePaths, visitablePos);
|
int3 closestFreeTile = findClosestTile(freePaths, visitablePos);
|
||||||
if (closestFreeTile.dist2d(visitablePos) < minDistance)
|
if (closestFreeTile.dist2d(visitablePos) < minTreasureDistance)
|
||||||
{
|
{
|
||||||
closestTile = visitablePos;
|
closestTile = visitablePos;
|
||||||
minDistance = closestFreeTile.dist2d(visitablePos);
|
minTreasureDistance = closestFreeTile.dist2d(visitablePos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert (closestTile.valid());
|
assert (closestTile.valid());
|
||||||
|
@ -528,13 +528,13 @@ Target BattleSpellMechanics::transformSpellTarget(const Target & aimPoint) const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const Destination & primary = aimPoint.at(0);
|
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
|
//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)
|
for(auto & hex : spellRange)
|
||||||
spellTarget.push_back(Destination(hex));
|
spellTarget.push_back(Destination(hex));
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ bool Catapult::applicable(Problem & problem, const Mechanics * m) const
|
|||||||
return true;
|
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
|
//start with all destructible parts
|
||||||
static const std::set<EWallPart::EWallPart> possibleTargets =
|
static const std::set<EWallPart::EWallPart> possibleTargets =
|
||||||
|
Loading…
Reference in New Issue
Block a user