From db40e125eb297c128843512c75e60b26a9888abe Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Thu, 24 Nov 2016 20:34:37 +0300 Subject: [PATCH] Fixed CID 1243181, CID 1197449, CID 1366374, CID 1366377, CID 1366359 --- client/CPreGame.cpp | 2 +- client/widgets/Buttons.cpp | 1 + lib/BattleState.cpp | 12 +++++------- lib/CCreatureHandler.cpp | 11 +++++++---- lib/rmg/CRmgTemplateStorage.cpp | 2 +- lib/rmg/CRmgTemplateZone.cpp | 2 -- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index c42f7ceeb..86182029b 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -1309,7 +1309,7 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const std::function callback) void ClickableArea::setArea(CIntObject * object) { delete area; + area = object; addChild(area); pos.w = object->pos.w; pos.h = object->pos.h; diff --git a/lib/BattleState.cpp b/lib/BattleState.cpp index caad2cc06..1d345ff56 100644 --- a/lib/BattleState.cpp +++ b/lib/BattleState.cpp @@ -102,14 +102,12 @@ ui32 BattleInfo::calculateDmg( const CStack* attacker, const CStack* defender, if(range.first != range.second) { - int valuesToAverage[10]; - int howManyToAv = std::min(10, attacker->count); - for (int g=0; g(10, attacker->count); + for(int g=0; g 9) - assert("Wrong countID!"); - - return creature_count[countID]; + if(countID > 9) + { + logGlobal->error("Wrong countID %d!", countID); + return 0; + } + else + return creature_count[countID]; } bool CCreature::isDoubleWide() const diff --git a/lib/rmg/CRmgTemplateStorage.cpp b/lib/rmg/CRmgTemplateStorage.cpp index 2d12e4ce5..531e86dd5 100644 --- a/lib/rmg/CRmgTemplateStorage.cpp +++ b/lib/rmg/CRmgTemplateStorage.cpp @@ -251,7 +251,7 @@ CRmgTemplate::CSize CRmgTemplateStorage::parseMapTemplateSize(const std::string if(it == mapSizeMapping.end()) { // Map size is given as a number representation - const auto & numericalRep = parts[0]; + const std::string numericalRep = parts[0]; parts.clear(); boost::split(parts, numericalRep, boost::is_any_of("x")); assert(parts.size() == 3); diff --git a/lib/rmg/CRmgTemplateZone.cpp b/lib/rmg/CRmgTemplateZone.cpp index 646db5396..96b792424 100644 --- a/lib/rmg/CRmgTemplateZone.cpp +++ b/lib/rmg/CRmgTemplateZone.cpp @@ -2374,8 +2374,6 @@ ObjectInfo CRmgTemplateZone::getRandomObject(CMapGenerator* gen, CTreasurePileIn }); return *(it->second); } - - return ObjectInfo(); // unreachable } void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)