mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Warnings fixes (#538)
Warnings fixes * Suppress `missing-braces` for Clang * Fixed many C4275 warnings * Fixed almost all Clang/GCC warnings * Silence most frequent MSVC warning. * Fixed some pessimizing-move warnings * Fixed some unused capture warnings
This commit is contained in:
parent
419fee1fb2
commit
b00e935e4d
@ -243,7 +243,7 @@ void CBattleAI::attemptCastingSpell()
|
||||
LOGL("Casting spells sounds like fun. Let's see...");
|
||||
//Get all spells we can cast
|
||||
std::vector<const CSpell*> possibleSpells;
|
||||
vstd::copy_if(VLC->spellh->objects, std::back_inserter(possibleSpells), [this, hero] (const CSpell *s) -> bool
|
||||
vstd::copy_if(VLC->spellh->objects, std::back_inserter(possibleSpells), [hero](const CSpell *s) -> bool
|
||||
{
|
||||
return s->canBeCast(getCbc().get(), spells::Mode::HERO, hero);
|
||||
});
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
Goals::TSubgoal whatToDo(TResources &res, Goals::TSubgoal goal) override;
|
||||
Goals::TSubgoal whatToDo() const override;
|
||||
bool containsObjective(Goals::TSubgoal goal) const;
|
||||
bool containsObjective(Goals::TSubgoal goal) const override;
|
||||
bool hasTasksLeft() const override;
|
||||
bool removeOutdatedObjectives(std::function<bool(const Goals::TSubgoal &)> predicate) override;
|
||||
|
||||
@ -64,7 +64,7 @@ public:
|
||||
void resetPaths() override;
|
||||
|
||||
private:
|
||||
bool notifyGoalCompleted(Goals::TSubgoal goal);
|
||||
bool notifyGoalCompleted(Goals::TSubgoal goal) override;
|
||||
|
||||
void init(CPlayerSpecificInfoCallback * CB) override;
|
||||
void setAI(VCAI * AI) override;
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "../AIUtility.h"
|
||||
#include "../Goals/AbstractGoal.h"
|
||||
|
||||
class AIPathNode;
|
||||
struct AIPathNode;
|
||||
|
||||
class ISpecialAction
|
||||
{
|
||||
|
@ -410,12 +410,11 @@ namespace AIPathfinding
|
||||
class AIMovementToDestinationRule : public MovementToDestinationRule
|
||||
{
|
||||
private:
|
||||
CPlayerSpecificInfoCallback * cb;
|
||||
std::shared_ptr<AINodeStorage> nodeStorage;
|
||||
|
||||
public:
|
||||
AIMovementToDestinationRule(CPlayerSpecificInfoCallback * cb, std::shared_ptr<AINodeStorage> nodeStorage)
|
||||
:cb(cb), nodeStorage(nodeStorage)
|
||||
AIMovementToDestinationRule(std::shared_ptr<AINodeStorage> nodeStorage)
|
||||
: nodeStorage(nodeStorage)
|
||||
{
|
||||
}
|
||||
|
||||
@ -455,12 +454,11 @@ namespace AIPathfinding
|
||||
class AIPreviousNodeRule : public MovementToDestinationRule
|
||||
{
|
||||
private:
|
||||
CPlayerSpecificInfoCallback * cb;
|
||||
std::shared_ptr<AINodeStorage> nodeStorage;
|
||||
|
||||
public:
|
||||
AIPreviousNodeRule(CPlayerSpecificInfoCallback * cb, std::shared_ptr<AINodeStorage> nodeStorage)
|
||||
:cb(cb), nodeStorage(nodeStorage)
|
||||
AIPreviousNodeRule(std::shared_ptr<AINodeStorage> nodeStorage)
|
||||
: nodeStorage(nodeStorage)
|
||||
{
|
||||
}
|
||||
|
||||
@ -501,9 +499,9 @@ namespace AIPathfinding
|
||||
std::vector<std::shared_ptr<IPathfindingRule>> rules = {
|
||||
std::make_shared<AILayerTransitionRule>(cb, ai, nodeStorage),
|
||||
std::make_shared<DestinationActionRule>(),
|
||||
std::make_shared<AIMovementToDestinationRule>(cb, nodeStorage),
|
||||
std::make_shared<AIMovementToDestinationRule>(nodeStorage),
|
||||
std::make_shared<MovementCostRule>(),
|
||||
std::make_shared<AIPreviousNodeRule>(cb, nodeStorage),
|
||||
std::make_shared<AIPreviousNodeRule>(nodeStorage),
|
||||
std::make_shared<AIMovementAfterDestinationRule>(cb, nodeStorage)
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "../VCAI.h"
|
||||
#include "AINodeStorage.h"
|
||||
|
||||
class IPathfindingManager
|
||||
class DLL_EXPORT IPathfindingManager
|
||||
{
|
||||
public:
|
||||
virtual ~IPathfindingManager() = default;
|
||||
@ -28,8 +28,8 @@ public:
|
||||
virtual std::vector<AIPath> getPathsToTile(HeroPtr hero, int3 tile) = 0;
|
||||
virtual bool isTileAccessible(HeroPtr hero, int3 tile) = 0;
|
||||
};
|
||||
|
||||
class PathfindingManager : public IPathfindingManager
|
||||
|
||||
class DLL_EXPORT PathfindingManager : public IPathfindingManager
|
||||
{
|
||||
friend class AIhelper;
|
||||
|
||||
@ -55,9 +55,9 @@ private:
|
||||
void setAI(VCAI * AI) override;
|
||||
|
||||
Goals::TGoalVec findPath(
|
||||
HeroPtr hero,
|
||||
HeroPtr hero,
|
||||
crint3 dest,
|
||||
bool allowGatherArmy,
|
||||
bool allowGatherArmy,
|
||||
const std::function<Goals::TSubgoal(int3)> goalFactory);
|
||||
|
||||
Goals::TSubgoal clearWayTo(HeroPtr hero, int3 firstTileToGet);
|
||||
|
@ -35,7 +35,7 @@ struct DLL_EXPORT ResourceObjective
|
||||
}
|
||||
};
|
||||
|
||||
class IResourceManager //: public: IAbstractManager
|
||||
class DLL_EXPORT IResourceManager //: public: IAbstractManager
|
||||
{
|
||||
public:
|
||||
virtual ~IResourceManager() = default;
|
||||
@ -79,14 +79,14 @@ public:
|
||||
TResource allGold() const override;
|
||||
|
||||
Goals::TSubgoal whatToDo() const override; //peek highest-priority goal
|
||||
Goals::TSubgoal whatToDo(TResources & res, Goals::TSubgoal goal); //can we afford this goal or need to CollectRes?
|
||||
bool containsObjective(Goals::TSubgoal goal) const;
|
||||
Goals::TSubgoal whatToDo(TResources & res, Goals::TSubgoal goal) override; //can we afford this goal or need to CollectRes?
|
||||
bool containsObjective(Goals::TSubgoal goal) const override;
|
||||
bool hasTasksLeft() const override;
|
||||
bool removeOutdatedObjectives(std::function<bool(const Goals::TSubgoal &)> predicate) override;
|
||||
bool notifyGoalCompleted(Goals::TSubgoal goal) override;
|
||||
|
||||
protected: //not-const actions only for AI
|
||||
virtual void reserveResoures(const TResources & res, Goals::TSubgoal goal = Goals::TSubgoal());
|
||||
virtual bool notifyGoalCompleted(Goals::TSubgoal goal);
|
||||
virtual bool updateGoal(Goals::TSubgoal goal); //new goal must have same properties but different priority
|
||||
virtual bool tryPush(const ResourceObjective &o);
|
||||
|
||||
@ -110,4 +110,4 @@ private:
|
||||
h & saving;
|
||||
h & queue;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -2212,7 +2212,7 @@ void VCAI::tryRealize(Goals::BuyArmy & g)
|
||||
throw cannotFulfillGoalException("Can't buy any more creatures!");
|
||||
|
||||
creInfo ci =
|
||||
*boost::max_element(creaturesInDwellings, [&res](const creInfo & lhs, const creInfo & rhs)
|
||||
*boost::max_element(creaturesInDwellings, [](const creInfo & lhs, const creInfo & rhs)
|
||||
{
|
||||
//max value of creatures we can buy with our res
|
||||
int value1 = lhs.cre->AIValue * lhs.count,
|
||||
|
@ -185,7 +185,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32) #so far all *nix compilers support suc
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder")
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags -Wno-unknown-warning-option")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags -Wno-unknown-warning-option -Wno-missing-braces")
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
|
@ -789,12 +789,13 @@ void processCommand(const std::string &message)
|
||||
}
|
||||
else if(cn == "gui")
|
||||
{
|
||||
for(auto child : GH.listInt)
|
||||
for(auto & child : GH.listInt)
|
||||
{
|
||||
if(const CIntObject *obj = dynamic_cast<const CIntObject *>(child.get()))
|
||||
const auto childPtr = child.get();
|
||||
if(const CIntObject * obj = dynamic_cast<const CIntObject *>(childPtr))
|
||||
printInfoAboutIntObject(obj, 0);
|
||||
else
|
||||
std::cout << typeid(*child).name() << std::endl;
|
||||
std::cout << typeid(childPtr).name() << std::endl;
|
||||
}
|
||||
}
|
||||
else if(cn=="tell")
|
||||
|
@ -44,7 +44,6 @@ public:
|
||||
class CRegion
|
||||
: public CIntObject
|
||||
{
|
||||
CBonusSelection * owner;
|
||||
std::shared_ptr<CPicture> graphicsNotSelected;
|
||||
std::shared_ptr<CPicture> graphicsSelected;
|
||||
std::shared_ptr<CPicture> graphicsStriped;
|
||||
|
@ -172,7 +172,7 @@ void CMapHandler::initTerrainGraphics()
|
||||
"lavrvr"
|
||||
};
|
||||
|
||||
auto loadFlipped = [this](int types, TFlippedAnimations & animation, TFlippedCache & cache, const std::vector<std::string> & files)
|
||||
auto loadFlipped = [](int types, TFlippedAnimations & animation, TFlippedCache & cache, const std::vector<std::string> & files)
|
||||
{
|
||||
animation.resize(types);
|
||||
cache.resize(types);
|
||||
|
@ -77,6 +77,7 @@ void CHeroSwitcher::clickLeft(tribool down, bool previousState)
|
||||
#if 0
|
||||
owner->update(hero, true);
|
||||
#else
|
||||
UNUSED(owner);
|
||||
const CGHeroInstance * buf = hero;
|
||||
GH.popInts(1);
|
||||
GH.pushIntT<CHeroWindow>(buf);
|
||||
|
@ -302,14 +302,12 @@ bool CGameInfoCallback::getHeroInfo(const CGObjectInstance * hero, InfoAboutHero
|
||||
|
||||
//DISGUISED bonus implementation
|
||||
|
||||
bool disguiseFlag = (infoLevel == InfoAboutHero::EInfoLevel::DETAILED);
|
||||
|
||||
if(getPlayerRelations(getLocalPlayer(), hero->tempOwner) == PlayerRelations::ENEMIES)
|
||||
{
|
||||
//todo: bonus cashing
|
||||
int disguiseLevel = h->valOfBonuses(Selector::typeSubtype(Bonus::DISGUISED, 0));
|
||||
|
||||
auto doBasicDisguise = [disguiseLevel](InfoAboutHero & info)
|
||||
auto doBasicDisguise = [](InfoAboutHero & info)
|
||||
{
|
||||
int maxAIValue = 0;
|
||||
const CCreature * mostStrong = nullptr;
|
||||
@ -332,7 +330,7 @@ bool CGameInfoCallback::getHeroInfo(const CGObjectInstance * hero, InfoAboutHero
|
||||
}
|
||||
};
|
||||
|
||||
auto doAdvancedDisguise = [disguiseFlag, &doBasicDisguise](InfoAboutHero & info)
|
||||
auto doAdvancedDisguise = [&doBasicDisguise](InfoAboutHero & info)
|
||||
{
|
||||
doBasicDisguise(info);
|
||||
|
||||
|
@ -306,7 +306,7 @@ public:
|
||||
|
||||
std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
||||
|
||||
void beforeValidate(JsonNode & object);
|
||||
void beforeValidate(JsonNode & object) override;
|
||||
void loadObject(std::string scope, std::string name, const JsonNode & data) override;
|
||||
void loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) override;
|
||||
void afterLoadFinalization() override;
|
||||
|
@ -142,7 +142,7 @@ std::set<si32> CTown::getAllBuildings() const
|
||||
res.insert(b.first.num);
|
||||
}
|
||||
|
||||
return std::move(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@ struct Bonus;
|
||||
|
||||
///High level interface for BonusTypeHandler
|
||||
|
||||
class IBonusTypeHandler
|
||||
class DLL_LINKAGE IBonusTypeHandler
|
||||
{
|
||||
public:
|
||||
virtual ~IBonusTypeHandler(){};
|
||||
|
@ -140,7 +140,7 @@ struct ClientPlayer
|
||||
}
|
||||
};
|
||||
|
||||
struct LobbyState
|
||||
struct DLL_LINKAGE LobbyState
|
||||
{
|
||||
std::shared_ptr<StartInfo> si;
|
||||
std::shared_ptr<CMapInfo> mi;
|
||||
|
@ -127,6 +127,7 @@
|
||||
<Linker>
|
||||
<Add directory="../" />
|
||||
</Linker>
|
||||
<Unit filename="../CMakeLists.txt" />
|
||||
<Unit filename="../Global.h" />
|
||||
<Unit filename="../Version.h" />
|
||||
<Unit filename="../include/vstd/CLoggerBase.h" />
|
||||
|
@ -108,7 +108,7 @@ std::set<boost::filesystem::path> CFilesystemList::getResourceNames(const Resour
|
||||
paths.insert(rn->string());
|
||||
}
|
||||
}
|
||||
return std::move(paths);
|
||||
return paths;
|
||||
}
|
||||
|
||||
void CFilesystemList::updateFilteredFiles(std::function<bool(const std::string &)> filter) const
|
||||
|
@ -115,6 +115,6 @@ std::unique_ptr<COutputStream> CZipSaver::addFile(const std::string & archiveFil
|
||||
throw std::runtime_error("CZipSaver::addFile: stream already opened");
|
||||
|
||||
std::unique_ptr<COutputStream> stream(new CZipOutputStream(this, handle, archiveFilename));
|
||||
return std::move(stream);
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
@ -105,11 +105,11 @@ public:
|
||||
switch(formula)
|
||||
{
|
||||
case DIST_2D:
|
||||
return dist2d(o);
|
||||
return static_cast<ui32>(dist2d(o));
|
||||
case DIST_MANHATTAN:
|
||||
return mandist2d(o);
|
||||
return static_cast<ui32>(mandist2d(o));
|
||||
case DIST_CHEBYSHEV:
|
||||
return chebdist2d(o);
|
||||
return static_cast<ui32>(chebdist2d(o));
|
||||
case DIST_2DSQ:
|
||||
return dist2dSQ(o);
|
||||
default:
|
||||
|
@ -228,7 +228,7 @@ std::vector<std::string> CLogManager::getRegisteredDomains() const
|
||||
{
|
||||
domains.push_back(pair.second->getDomain().getName());
|
||||
}
|
||||
return std::move(domains);
|
||||
return domains;
|
||||
}
|
||||
|
||||
CLogFormatter::CLogFormatter()
|
||||
|
@ -756,7 +756,7 @@ CVisitInfo CGBonusingObject::getVisitInfo(int index, const CGHeroInstance *h) co
|
||||
vi.message.addTxt(MetaString::ADVOB_TXT, 138);
|
||||
vi.reward.extraComponents.push_back(Component(
|
||||
Component::CREATURE, CreatureID::CHAMPION, 0, 1));
|
||||
return std::move(vi);
|
||||
return vi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void CHeroInstanceConstructor::afterLoadFinalization()
|
||||
{
|
||||
for (auto entry : filtersJson.Struct())
|
||||
{
|
||||
filters[entry.first] = LogicalExpression<HeroTypeID>(entry.second, [this](const JsonNode & node)
|
||||
filters[entry.first] = LogicalExpression<HeroTypeID>(entry.second, [](const JsonNode & node)
|
||||
{
|
||||
return HeroTypeID(VLC->modh->identifiers.getIdentifier("hero", node.Vector()[0]).get());
|
||||
});
|
||||
|
@ -319,7 +319,7 @@ namespace TriggeredEventsDetail
|
||||
if(!data.isNull())
|
||||
asVector.push_back(data);
|
||||
|
||||
return std::move(json);
|
||||
return json;
|
||||
}
|
||||
}//namespace TriggeredEventsDetail
|
||||
|
||||
@ -393,7 +393,7 @@ void CMapFormatJson::serializeHeader(JsonSerializeFormat & handler)
|
||||
handler.serializeInt("heroLevelLimit", mapHeader->levelLimit, 0);
|
||||
|
||||
//todo: support arbitrary percentage
|
||||
handler.serializeEnum("difficulty", mapHeader->difficulty, HeaderDetail::difficultyMap);
|
||||
handler.serializeEnum("difficulty", mapHeader->difficulty, HeaderDetail::difficultyDefault, HeaderDetail::difficultyMap);
|
||||
|
||||
serializePlayerInfo(handler);
|
||||
|
||||
@ -870,7 +870,7 @@ std::unique_ptr<CMap> CMapLoaderJson::loadMap()
|
||||
map = result.get();
|
||||
mapHeader = map;
|
||||
readMap();
|
||||
return std::move(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<CMapHeader> CMapLoaderJson::loadMapHeader()
|
||||
@ -880,7 +880,7 @@ std::unique_ptr<CMapHeader> CMapLoaderJson::loadMapHeader()
|
||||
std::unique_ptr<CMapHeader> result = std::unique_ptr<CMapHeader>(new CMapHeader());
|
||||
mapHeader = result.get();
|
||||
readHeader(false);
|
||||
return std::move(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
JsonNode CMapLoaderJson::getFromArchive(const std::string & archiveFilename)
|
||||
@ -894,7 +894,7 @@ JsonNode CMapLoaderJson::getFromArchive(const std::string & archiveFilename)
|
||||
|
||||
JsonNode res(reinterpret_cast<char*>(data.first.get()), data.second);
|
||||
|
||||
return std::move(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
void CMapLoaderJson::readMap()
|
||||
@ -1330,7 +1330,7 @@ JsonNode CMapSaverJson::writeTerrainLevel(const int index)
|
||||
row.Vector()[pos.x].String() = writeTerrainTile(map->getTile(pos));
|
||||
}
|
||||
|
||||
return std::move(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
void CMapSaverJson::writeTerrain()
|
||||
|
@ -58,6 +58,7 @@
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wno-unused-parameter" />
|
||||
<Add directory="$(#zlib.include)" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
|
@ -1072,7 +1072,7 @@ extern int MINIZIP_EXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* fil
|
||||
int err = ZIP_OK;
|
||||
|
||||
# ifdef NOCRYPT
|
||||
(crcForCrypting);
|
||||
//(crcForCrypting);
|
||||
if (password != NULL)
|
||||
return ZIP_PARAMERROR;
|
||||
# endif
|
||||
|
@ -522,9 +522,9 @@ void CMapGenerator::createDirectConnections()
|
||||
{
|
||||
if (isBlocked(tile)) //tiles may be occupied by subterranean gates already placed
|
||||
continue;
|
||||
foreachDirectNeighbour (tile, [&guardPos, tile, &otherZoneTiles, &middleTiles, this, zoneBid](int3 &pos) //must be direct since paths also also generated between direct neighbours
|
||||
foreachDirectNeighbour(tile, [tile, &middleTiles, this, zoneBid](int3 & pos) //must be direct since paths also also generated between direct neighbours
|
||||
{
|
||||
if (getZoneID(pos) == zoneBid)
|
||||
if(getZoneID(pos) == zoneBid)
|
||||
middleTiles.push_back(tile);
|
||||
});
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ do not leave zone border
|
||||
//try any nearby tiles, even if its not closer than current
|
||||
float lastDistance = 2 * distance; //start with significantly larger value
|
||||
|
||||
auto processNeighbours2 = [this, ¤tPos, dst, &lastDistance, &anotherPos, &end, clearedTiles](int3 &pos)
|
||||
auto processNeighbours2 = [this, ¤tPos, dst, &lastDistance, &anotherPos, clearedTiles](int3 &pos)
|
||||
{
|
||||
if (currentPos.dist2dSQ(dst) < lastDistance) //try closest tiles from all surrounding unused tiles
|
||||
{
|
||||
@ -544,7 +544,7 @@ bool CRmgTemplateZone::createRoad(const int3& src, const int3& dst)
|
||||
//A* algorithm taken from Wiki http://en.wikipedia.org/wiki/A*_search_algorithm
|
||||
|
||||
std::set<int3> closed; // The set of nodes already evaluated.
|
||||
auto pq = std::move(createPiorityQueue()); // The set of tentative nodes to be evaluated, initially containing the start node
|
||||
auto pq = createPiorityQueue(); // The set of tentative nodes to be evaluated, initially containing the start node
|
||||
std::map<int3, int3> cameFrom; // The map of navigated nodes.
|
||||
std::map<int3, float> distances;
|
||||
|
||||
@ -634,7 +634,7 @@ bool CRmgTemplateZone::connectPath(const int3& src, bool onlyStraight)
|
||||
//A* algorithm taken from Wiki http://en.wikipedia.org/wiki/A*_search_algorithm
|
||||
|
||||
std::set<int3> closed; // The set of nodes already evaluated.
|
||||
auto open = std::move(createPiorityQueue()); // The set of tentative nodes to be evaluated, initially containing the start node
|
||||
auto open = createPiorityQueue(); // The set of tentative nodes to be evaluated, initially containing the start node
|
||||
std::map<int3, int3> cameFrom; // The map of navigated nodes.
|
||||
std::map<int3, float> distances;
|
||||
|
||||
@ -711,7 +711,7 @@ bool CRmgTemplateZone::connectWithCenter(const int3& src, bool onlyStraight)
|
||||
//A* algorithm taken from Wiki http://en.wikipedia.org/wiki/A*_search_algorithm
|
||||
|
||||
std::set<int3> closed; // The set of nodes already evaluated.
|
||||
auto open = std::move(createPiorityQueue()); // The set of tentative nodes to be evaluated, initially containing the start node
|
||||
auto open = createPiorityQueue(); // The set of tentative nodes to be evaluated, initially containing the start node
|
||||
std::map<int3, int3> cameFrom; // The map of navigated nodes.
|
||||
std::map<int3, float> distances;
|
||||
|
||||
@ -1108,7 +1108,7 @@ void CRmgTemplateZone::initTownType ()
|
||||
{
|
||||
for (auto blockedTile : town->getBlockedPos())
|
||||
{
|
||||
gen->foreach_neighbour(blockedTile, [this, town](const int3& pos)
|
||||
gen->foreach_neighbour(blockedTile, [this](const int3 & pos)
|
||||
{
|
||||
if (gen->isPossible(pos))
|
||||
gen->setOccupied(pos, ETileType::FREE);
|
||||
@ -2269,10 +2269,9 @@ void CRmgTemplateZone::addAllPossibleObjects()
|
||||
{
|
||||
if (temp.canBePlacedAt(terrainType))
|
||||
{
|
||||
oi.generateObject = [temp, secondaryID, dwellingHandler]() -> CGObjectInstance *
|
||||
oi.generateObject = [temp, secondaryID]() -> CGObjectInstance *
|
||||
{
|
||||
auto obj = VLC->objtypeh->getHandlerFor(Obj::CREATURE_GENERATOR1, secondaryID)->create(temp);
|
||||
//dwellingHandler->configureObject(obj, gen->rand);
|
||||
obj->tempOwner = PlayerColor::NEUTRAL;
|
||||
return obj;
|
||||
};
|
||||
|
@ -187,14 +187,14 @@ struct VectorizedIDType
|
||||
};
|
||||
|
||||
/// Base class for deserializers
|
||||
class IBinaryReader : public virtual CSerializer
|
||||
class DLL_LINKAGE IBinaryReader : public virtual CSerializer
|
||||
{
|
||||
public:
|
||||
virtual int read(void * data, unsigned size) = 0;
|
||||
};
|
||||
|
||||
/// Base class for serializers
|
||||
class IBinaryWriter : public virtual CSerializer
|
||||
class DLL_LINKAGE IBinaryWriter : public virtual CSerializer
|
||||
{
|
||||
public:
|
||||
virtual int write(const void * data, unsigned size) = 0;
|
||||
|
@ -543,7 +543,7 @@ Target BattleSpellMechanics::transformSpellTarget(const Target & aimPoint) const
|
||||
if(spellTarget.empty())
|
||||
spellTarget.push_back(Destination(BattleHex::INVALID));
|
||||
|
||||
return std::move(spellTarget);
|
||||
return spellTarget;
|
||||
}
|
||||
|
||||
std::vector<AimType> BattleSpellMechanics::getTargetTypes() const
|
||||
|
@ -620,7 +620,7 @@ std::vector<JsonNode> CSpellHandler::loadLegacyData(size_t dataSize)
|
||||
}
|
||||
};
|
||||
|
||||
auto read = [&,this](bool combat, bool ability)
|
||||
auto read = [&](bool combat, bool ability)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
@ -79,9 +79,8 @@ namespace spells
|
||||
class ObstacleCasterProxy : public Caster
|
||||
{
|
||||
public:
|
||||
ObstacleCasterProxy(const CGameHandler * gh_, const PlayerColor owner_, const CGHeroInstance * hero_, const SpellCreatedObstacle * obs_)
|
||||
: gh(gh_),
|
||||
owner(owner_),
|
||||
ObstacleCasterProxy(const PlayerColor owner_, const CGHeroInstance * hero_, const SpellCreatedObstacle * obs_)
|
||||
: owner(owner_),
|
||||
hero(hero_),
|
||||
obs(obs_)
|
||||
{
|
||||
@ -163,7 +162,6 @@ public:
|
||||
|
||||
private:
|
||||
const CGHeroInstance * hero;
|
||||
const CGameHandler * gh;
|
||||
const PlayerColor owner;
|
||||
const SpellCreatedObstacle * obs;
|
||||
};
|
||||
@ -4804,7 +4802,7 @@ bool CGameHandler::handleDamageFromObstacle(const CStack * curStack, bool stackI
|
||||
if(!(spellObstacle->hidden && gs->curB->battleIsObstacleVisibleForSide(*obstacle, (BattlePerspective::BattlePerspective)side)))
|
||||
{
|
||||
const CGHeroInstance * hero = gs->curB->battleGetFightingHero(spellObstacle->casterSide);
|
||||
spells::ObstacleCasterProxy caster(this, gs->curB->sides.at(spellObstacle->casterSide).color, hero, spellObstacle);
|
||||
spells::ObstacleCasterProxy caster(gs->curB->sides.at(spellObstacle->casterSide).color, hero, spellObstacle);
|
||||
|
||||
const CSpell * sp = SpellID(spellObstacle->ID).toSpell();
|
||||
if(!sp)
|
||||
|
@ -90,7 +90,7 @@ static JsonNode getFromArchive(CZipLoader & archive, const std::string & archive
|
||||
|
||||
JsonNode res(reinterpret_cast<char*>(data.first.get()), data.second);
|
||||
|
||||
return std::move(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static void addToArchive(CZipSaver & saver, const JsonNode & data, const std::string & filename)
|
||||
|
Loading…
Reference in New Issue
Block a user