1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fixed a few CWE-457

This commit is contained in:
AlexVinS 2016-11-27 22:37:41 +03:00
parent c0ed22c99e
commit 609c6f81bd
7 changed files with 19 additions and 10 deletions

View File

@ -217,7 +217,9 @@ CMapHeader::~CMapHeader()
}
CMap::CMap() : checksum(0), grailPos(-1, -1, -1), grailRadius(0), terrain(nullptr)
CMap::CMap()
: checksum(0), grailPos(-1, -1, -1), grailRadius(0), terrain(nullptr),
guardingCreaturePositions(nullptr)
{
allHeroes.resize(allowedHeroes.size());
allowedAbilities = VLC->heroh->getDefaultAllowedAbilities();

View File

@ -37,7 +37,9 @@ void CMapGenerator::foreachDirectNeighbour(const int3& pos, std::function<void(i
CMapGenerator::CMapGenerator() :
zonesTotal(0), monolithIndex(0)
mapGenOptions(nullptr), randomSeed(0), editManager(nullptr),
zonesTotal(0), tiles(nullptr), prisonsRemaining(0),
monolithIndex(0)
{
}
@ -639,7 +641,7 @@ void CMapGenerator::createConnections2()
}
}
}
if (!continueOuterLoop) //we didn't find ANY tile - break outer loop
if (!continueOuterLoop) //we didn't find ANY tile - break outer loop
break;
}
if (!guardPos.valid()) //cleanup? is this safe / enough?
@ -751,7 +753,7 @@ TRmgTemplateZoneId CMapGenerator::getZoneID(const int3& tile) const
return zoneColouring[tile.z][tile.x][tile.y];
}
void CMapGenerator::setZoneID(const int3& tile, TRmgTemplateZoneId zid)
void CMapGenerator::setZoneID(const int3& tile, TRmgTemplateZoneId zid)
{
checkIsOnMap(tile);

View File

@ -24,7 +24,9 @@ CPlacedZone::CPlacedZone(const CRmgTemplateZone * zone)
}
CZonePlacer::CZonePlacer(CMapGenerator * Gen) : gen(Gen)
CZonePlacer::CZonePlacer(CMapGenerator * Gen)
: width(0), height(0), scaleX(0), scaleY(0), mapSize(0), gravityConstant(0), stiffnessConstant(0),
gen(Gen)
{
}
@ -153,7 +155,7 @@ void CZonePlacer::placeZones(const CMapGenOptions * mapGenOptions, CRandomGenera
}
void CZonePlacer::prepareZones(TZoneMap &zones, TZoneVector &zonesVector, const bool underground, CRandomGenerator * rand)
{
{
std::vector<float> totalSize = { 0, 0 }; //make sure that sum of zone sizes on surface and uderground match size of the map
const float radius = 0.4f;
@ -168,7 +170,7 @@ void CZonePlacer::prepareZones(TZoneMap &zones, TZoneVector &zonesVector, const
//first pass - determine fixed surface for zones
for (auto zone : zonesVector)
{
{
if (!underground) //this step is ignored
zonesToPlace.push_back(zone);
else //place players depending on their factions

View File

@ -95,10 +95,11 @@ CSpell::LevelInfo::~LevelInfo()
///CSpell
CSpell::CSpell():
id(SpellID::NONE), level(0),
power(0),
combatSpell(false), creatureAbility(false),
positiveness(ESpellPositiveness::NEUTRAL),
defaultProbability(0),
isRising(false), isDamage(false), isOffensive(false),
isRising(false), isDamage(false), isOffensive(false), isSpecial(true),
targetType(ETargetType::NO_TARGET),
mechanics(),
adventureMechanics()

View File

@ -6277,6 +6277,8 @@ CGameHandler::FinishingBattleHelper::FinishingBattleHelper(std::shared_ptr<const
CGameHandler::FinishingBattleHelper::FinishingBattleHelper()
{
winnerHero = loserHero = nullptr;
duel = false;
remainingBattleQueriesCount = 0;
}
CRandomGenerator & CGameHandler::getRandomGenerator()

View File

@ -83,7 +83,6 @@ public:
enum EVisitDest {VISIT_DEST, DONT_VISIT_DEST};
enum ELEaveTile {LEAVING_TILE, REMAINING_ON_TILE};
CVCMIServer *s;
std::map<PlayerColor, CConnection*> connections; //player color -> connection to client with interface of that player
PlayerStatuses states; //player color -> player state
std::set<CConnection*> conns;

View File

@ -239,8 +239,9 @@ CBattleQuery::CBattleQuery(const BattleInfo *Bi)
}
CBattleQuery::CBattleQuery()
:bi(nullptr)
{
belligerents[0] = belligerents[1] = nullptr;
}
bool CBattleQuery::blocksPack(const CPack *pack) const