mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fixed CID 1243181, CID 1197449, CID 1366374, CID 1366377, CID 1366359
This commit is contained in:
@@ -1309,7 +1309,7 @@ SelectionTab::SelectionTab(CMenuScreen::EState Type, const std::function<void(CM
|
|||||||
selectFName("Maps/Arrogance");
|
selectFName("Maps/Arrogance");
|
||||||
else
|
else
|
||||||
selectFName(settings["session"]["lastMap"].String());
|
selectFName(settings["session"]["lastMap"].String());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CMenuScreen::campaignList:
|
case CMenuScreen::campaignList:
|
||||||
select(0);
|
select(0);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ void ClickableArea::addCallback(std::function<void()> callback)
|
|||||||
void ClickableArea::setArea(CIntObject * object)
|
void ClickableArea::setArea(CIntObject * object)
|
||||||
{
|
{
|
||||||
delete area;
|
delete area;
|
||||||
|
area = object;
|
||||||
addChild(area);
|
addChild(area);
|
||||||
pos.w = object->pos.w;
|
pos.w = object->pos.w;
|
||||||
pos.h = object->pos.h;
|
pos.h = object->pos.h;
|
||||||
|
|||||||
@@ -102,14 +102,12 @@ ui32 BattleInfo::calculateDmg( const CStack* attacker, const CStack* defender,
|
|||||||
|
|
||||||
if(range.first != range.second)
|
if(range.first != range.second)
|
||||||
{
|
{
|
||||||
int valuesToAverage[10];
|
ui32 sum = 0;
|
||||||
int howManyToAv = std::min<ui32>(10, attacker->count);
|
ui32 howManyToAv = std::min<ui32>(10, attacker->count);
|
||||||
for (int g=0; g<howManyToAv; ++g)
|
for(int g=0; g<howManyToAv; ++g)
|
||||||
{
|
sum += (ui32)rand.nextInt(range.first, range.second);
|
||||||
valuesToAverage[g] = rand.nextInt(range.first, range.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::accumulate(valuesToAverage, valuesToAverage + howManyToAv, 0) / howManyToAv;
|
return sum / howManyToAv;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return range.first;
|
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 };
|
static const int creature_count[] = { 0, 3, 8, 15, 35, 75, 175, 375, 750, 2500 };
|
||||||
|
|
||||||
if (countID > 9)
|
if(countID > 9)
|
||||||
assert("Wrong countID!");
|
{
|
||||||
|
logGlobal->error("Wrong countID %d!", countID);
|
||||||
return creature_count[countID];
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return creature_count[countID];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCreature::isDoubleWide() const
|
bool CCreature::isDoubleWide() const
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ CRmgTemplate::CSize CRmgTemplateStorage::parseMapTemplateSize(const std::string
|
|||||||
if(it == mapSizeMapping.end())
|
if(it == mapSizeMapping.end())
|
||||||
{
|
{
|
||||||
// Map size is given as a number representation
|
// Map size is given as a number representation
|
||||||
const auto & numericalRep = parts[0];
|
const std::string numericalRep = parts[0];
|
||||||
parts.clear();
|
parts.clear();
|
||||||
boost::split(parts, numericalRep, boost::is_any_of("x"));
|
boost::split(parts, numericalRep, boost::is_any_of("x"));
|
||||||
assert(parts.size() == 3);
|
assert(parts.size() == 3);
|
||||||
|
|||||||
@@ -2374,8 +2374,6 @@ ObjectInfo CRmgTemplateZone::getRandomObject(CMapGenerator* gen, CTreasurePileIn
|
|||||||
});
|
});
|
||||||
return *(it->second);
|
return *(it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ObjectInfo(); // unreachable
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)
|
void CRmgTemplateZone::addAllPossibleObjects(CMapGenerator* gen)
|
||||||
|
|||||||
Reference in New Issue
Block a user