1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
AlexVinS 2018-02-09 22:12:21 +03:00
parent 936a310b0a
commit 0a2b04709f
3 changed files with 32 additions and 26 deletions

View File

@ -64,9 +64,10 @@ std::string Goals::AbstractGoal::name() const //TODO: virtualize
case GET_OBJ:
{
auto obj = cb->getObjInstance(ObjectInstanceID(objid));
if (obj)
if(obj)
desc = "GET OBJ " + obj->getObjectName();
}
break;
case FIND_OBJ:
desc = "FIND OBJ " + boost::lexical_cast<std::string>(objid);
break;

View File

@ -3312,10 +3312,11 @@ bool shouldVisit(HeroPtr h, const CGObjectInstance * obj)
case Obj::TAVERN:
{//TODO: make AI actually recruit heroes
//TODO: only on request
if ((ai->myCb->getHeroesInfo().size() >= VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER) ||
if((ai->myCb->getHeroesInfo().size() >= VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER) ||
(ai->myCb->getResourceAmount()[Res::GOLD] - GOLD_RESERVE < GameConstants::HERO_GOLD_COST))
return false;
}
break;
case Obj::BOAT:
return false;
//Boats are handled by pathfinder

View File

@ -306,8 +306,10 @@ int InfoBoxHeroData::getSubID()
case HERO_PRIMARY_SKILL:
return index;
case HERO_SECONDARY_SKILL:
if (hero->secSkills.size() > index)
if(hero->secSkills.size() > index)
return hero->secSkills[index].first;
else
return 0;
case HERO_SPECIAL:
return hero->type->ID.getNum();
case HERO_MANA:
@ -330,8 +332,10 @@ si64 InfoBoxHeroData::getValue()
case HERO_EXPERIENCE:
return hero->exp;
case HERO_SECONDARY_SKILL:
if (hero->secSkills.size() > index)
if(hero->secSkills.size() > index)
return hero->secSkills[index].second;
else
return 0;
case HERO_SPECIAL:
return 0;
default:
@ -353,7 +357,6 @@ std::string InfoBoxHeroData::getHoverText()
case HERO_SPECIAL:
return CGI->generaltexth->heroscrn[27];
case HERO_SECONDARY_SKILL:
{
if (hero->secSkills.size() > index)
{
std::string level = CGI->generaltexth->levels[hero->secSkills[index].second-1];
@ -361,6 +364,7 @@ std::string InfoBoxHeroData::getHoverText()
return boost::str(boost::format(CGI->generaltexth->heroscrn[21]) % level % skill);
}
else
{
return "";
}
default: