1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Removed CGHeroInstance::convertPosition method

This commit is contained in:
Ivan Savenko
2022-12-07 22:51:32 +02:00
parent 49cbd5adc9
commit d85ee019ec
11 changed files with 30 additions and 39 deletions

View File

@ -1074,7 +1074,7 @@ void CGMonolith::onHeroVisit( const CGHeroInstance * h ) const
auto exits = cb->getTeleportChannelExits(channel);
for(auto exit : exits)
{
td.exits.push_back(std::make_pair(exit, h->convertPosition(cb->getObj(exit)->visitablePos(), true)));
td.exits.push_back(std::make_pair(exit, cb->getObj(exit)->visitablePos() + h->getVisitableOffset()));
}
}
@ -1106,7 +1106,7 @@ void CGMonolith::teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer,
else if(vstd::isValidIndex(exits, answer))
dPos = exits[answer].second;
else
dPos = hero->convertPosition(cb->getObj(randomExit)->visitablePos(), true);
dPos = cb->getObj(randomExit)->visitablePos() + hero->getVisitableOffset();
cb->moveHero(hero->id, dPos, true);
}
@ -1150,7 +1150,7 @@ void CGSubterraneanGate::onHeroVisit( const CGHeroInstance * h ) const
else
{
auto exit = getRandomExit(h);
td.exits.push_back(std::make_pair(exit, h->convertPosition(cb->getObj(exit)->visitablePos(), true)));
td.exits.push_back(std::make_pair(exit, cb->getObj(exit)->visitablePos() + h->getVisitableOffset()));
}
cb->showTeleportDialog(&td);
@ -1259,7 +1259,7 @@ void CGWhirlpool::onHeroVisit( const CGHeroInstance * h ) const
{
auto blockedPosList = cb->getObj(exit)->getBlockedPos();
for(auto bPos : blockedPosList)
td.exits.push_back(std::make_pair(exit, h->convertPosition(bPos, true)));
td.exits.push_back(std::make_pair(exit, bPos + h->getVisitableOffset()));
}
}
@ -1283,7 +1283,7 @@ void CGWhirlpool::teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer
auto obj = cb->getObj(exit);
std::set<int3> tiles = obj->getBlockedPos();
dPos = hero->convertPosition(*RandomGeneratorUtil::nextItem(tiles, CRandomGenerator::getDefault()), true);
dPos = *RandomGeneratorUtil::nextItem(tiles, CRandomGenerator::getDefault()) + hero->getVisitableOffset();
}
cb->moveHero(hero->id, dPos, true);