mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Apply suggestions from code review
Co-authored-by: Andrey Filipenkov <decapitator@ukr.net>
This commit is contained in:
parent
1b6f4a5cf3
commit
60264aae29
@ -655,8 +655,9 @@ void CModInfo::loadLocalData(const JsonNode & data)
|
|||||||
|
|
||||||
//check compatibility
|
//check compatibility
|
||||||
bool wasEnabled = enabled;
|
bool wasEnabled = enabled;
|
||||||
enabled &= vcmiCompatibleMin.isNull() || Version::GameVersion().compatible(vcmiCompatibleMin);
|
enabled = enabled && (vcmiCompatibleMin.isNull() || Version::GameVersion().compatible(vcmiCompatibleMin));
|
||||||
enabled &= vcmiCompatibleMax.isNull() || vcmiCompatibleMax.compatible(Version::GameVersion());
|
enabled = enabled && (vcmiCompatibleMax.isNull() || vcmiCompatibleMax.compatible(Version::GameVersion()));
|
||||||
|
|
||||||
if(wasEnabled && !enabled)
|
if(wasEnabled && !enabled)
|
||||||
logGlobal->warn("Mod %s is incompatible with current version of VCMI and cannot be enabled", name);
|
logGlobal->warn("Mod %s is incompatible with current version of VCMI and cannot be enabled", name);
|
||||||
|
|
||||||
|
@ -212,7 +212,8 @@ public:
|
|||||||
/// version of the mod
|
/// version of the mod
|
||||||
Version version;
|
Version version;
|
||||||
|
|
||||||
///The vcmi versions compatible with the mod
|
/// vcmi versions compatible with the mod
|
||||||
|
|
||||||
Version vcmiCompatibleMin, vcmiCompatibleMax;
|
Version vcmiCompatibleMin, vcmiCompatibleMax;
|
||||||
|
|
||||||
/// list of mods that should be loaded before this one
|
/// list of mods that should be loaded before this one
|
||||||
@ -364,7 +365,8 @@ public:
|
|||||||
if(h.saving)
|
if(h.saving)
|
||||||
{
|
{
|
||||||
h & activeMods;
|
h & activeMods;
|
||||||
for(auto & m : activeMods)
|
for(const auto & m : activeMods)
|
||||||
|
|
||||||
h & allMods[m].version;
|
h & allMods[m].version;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -171,10 +171,7 @@ void ObstacleProxy::finalInsertion(CMapEditManager * manager, std::set<CGObjectI
|
|||||||
|
|
||||||
std::pair<bool, bool> ObstacleProxy::verifyCoverage(const int3 & t) const
|
std::pair<bool, bool> ObstacleProxy::verifyCoverage(const int3 & t) const
|
||||||
{
|
{
|
||||||
std::pair<bool, bool> result(false, false);
|
return {blockedArea.contains(t), false};
|
||||||
if(blockedArea.contains(t))
|
|
||||||
result.first = true;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObstacleProxy::placeObject(rmg::Object & object, std::set<CGObjectInstance*> & instances)
|
void ObstacleProxy::placeObject(rmg::Object & object, std::set<CGObjectInstance*> & instances)
|
||||||
@ -230,12 +227,7 @@ void ObstaclePlacer::init()
|
|||||||
|
|
||||||
std::pair<bool, bool> ObstaclePlacer::verifyCoverage(const int3 & t) const
|
std::pair<bool, bool> ObstaclePlacer::verifyCoverage(const int3 & t) const
|
||||||
{
|
{
|
||||||
std::pair<bool, bool> result(false, false);
|
return {map.shouldBeBlocked(t), zone.areaPossible().contains(t)};
|
||||||
if(map.shouldBeBlocked(t))
|
|
||||||
result.first = true;
|
|
||||||
if(zone.areaPossible().contains(t))
|
|
||||||
result.second = true;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObstaclePlacer::placeObject(rmg::Object & object, std::set<CGObjectInstance*> &)
|
void ObstaclePlacer::placeObject(rmg::Object & object, std::set<CGObjectInstance*> &)
|
||||||
@ -248,9 +240,10 @@ void ObstaclePlacer::postProcess(const rmg::Object & object)
|
|||||||
//river processing
|
//river processing
|
||||||
if(riverManager)
|
if(riverManager)
|
||||||
{
|
{
|
||||||
if(object.instances().front()->object().typeName == "mountain")
|
const auto objTypeName = object.instances().front()->object().typeName;
|
||||||
|
if(objTypeName == "mountain")
|
||||||
riverManager->riverSource().unite(object.getArea());
|
riverManager->riverSource().unite(object.getArea());
|
||||||
if(object.instances().front()->object().typeName == "lake")
|
else if(objTypeName == "lake")
|
||||||
riverManager->riverSink().unite(object.getArea());
|
riverManager->riverSink().unite(object.getArea());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user