1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +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: case GET_OBJ:
{ {
auto obj = cb->getObjInstance(ObjectInstanceID(objid)); auto obj = cb->getObjInstance(ObjectInstanceID(objid));
if (obj) if(obj)
desc = "GET OBJ " + obj->getObjectName(); desc = "GET OBJ " + obj->getObjectName();
} }
break;
case FIND_OBJ: case FIND_OBJ:
desc = "FIND OBJ " + boost::lexical_cast<std::string>(objid); desc = "FIND OBJ " + boost::lexical_cast<std::string>(objid);
break; break;

View File

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

View File

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