1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Diagnostics for #924.

This commit is contained in:
Michał W. Urbańczyk 2012-04-10 02:30:43 +00:00
parent 8baec8b093
commit d55d48b978

View File

@ -799,7 +799,20 @@ void CGHeroInstance::initArmy(IArmyDescriptor *dst /*= NULL*/)
for(int stackNo=0; stackNo < howManyStacks; stackNo++)
{
int creID = (VLC->creh->nameToID[type->refTypeStack[stackNo]]);
int creID = 0;
auto creItr = VLC->creh->nameToID.find(type->refTypeStack[stackNo]);
if(creItr == VLC->creh->nameToID.end())
{
tlog1 << "Cannot find a creature named " << type->refTypeStack[stackNo] << std::endl;
tlog1 << "Available creatures: \n";
BOOST_FOREACH(auto i, VLC->creh->nameToID)
{
tlog1 << boost::format("\t%s => %d\n") % i.first % i.second;
}
}
else
creID = creItr->second;
int range = type->highStack[stackNo] - type->lowStack[stackNo];
int count = ran()%(range+1) + type->lowStack[stackNo];