mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Fixed CID 1243181, CID 1197449, CID 1366374, CID 1366377, CID 1366359
This commit is contained in:
parent
b880e2b586
commit
db40e125eb
@ -1309,7 +1309,7 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const std::function<void(CM
|
||||
selectFName("Maps/Arrogance");
|
||||
else
|
||||
selectFName(settings["session"]["lastMap"].String());
|
||||
|
||||
|
||||
break;
|
||||
case CMenuScreen::campaignList:
|
||||
select(0);
|
||||
|
@ -41,6 +41,7 @@ void ClickableArea::addCallback(std::function<void()> callback)
|
||||
void ClickableArea::setArea(CIntObject * object)
|
||||
{
|
||||
delete area;
|
||||
area = object;
|
||||
addChild(area);
|
||||
pos.w = object->pos.w;
|
||||
pos.h = object->pos.h;
|
||||
|
@ -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<ui32>(10, attacker->count);
|
||||
for (int g=0; g<howManyToAv; ++g)
|
||||
{
|
||||
valuesToAverage[g] = rand.nextInt(range.first, range.second);
|
||||
}
|
||||
ui32 sum = 0;
|
||||
ui32 howManyToAv = std::min<ui32>(10, attacker->count);
|
||||
for(int g=0; g<howManyToAv; ++g)
|
||||
sum += (ui32)rand.nextInt(range.first, range.second);
|
||||
|
||||
return std::accumulate(valuesToAverage, valuesToAverage + howManyToAv, 0) / howManyToAv;
|
||||
return sum / howManyToAv;
|
||||
}
|
||||
else
|
||||
return range.first;
|
||||
|
@ -46,10 +46,13 @@ int CCreature::estimateCreatureCount(ui32 countID)
|
||||
{
|
||||
static const int creature_count[] = { 0, 3, 8, 15, 35, 75, 175, 375, 750, 2500 };
|
||||
|
||||
if (countID > 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
|
||||
|
@ -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);
|
||||
|
@ -2374,8 +2374,6 @@ ObjectInfo CRmgTemplateZone::getRandomObject(CMapGenerator* gen, CTreasurePileIn
|
||||
});
|
||||
return *(it->second);
|
||||
}
|
||||
|
||||
return ObjectInfo(); // unreachable
|
||||
}
|
||||
|
||||
void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)
|
||||
|
Loading…
x
Reference in New Issue
Block a user