mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Merge pull request #1075 from Nordsoft91/town-entrance-fix
[1069] Fix bug related to town entrance
This commit is contained in:
commit
c32d44190e
@ -1148,7 +1148,14 @@ void CGameState::placeCampaignHeroes()
|
|||||||
|
|
||||||
void CGameState::placeStartingHero(PlayerColor playerColor, HeroTypeID heroTypeId, int3 townPos)
|
void CGameState::placeStartingHero(PlayerColor playerColor, HeroTypeID heroTypeId, int3 townPos)
|
||||||
{
|
{
|
||||||
townPos.x -= 2; //FIXME: use actual visitable offset of town
|
for(auto town : map->towns)
|
||||||
|
{
|
||||||
|
if(town->getPosition() == townPos)
|
||||||
|
{
|
||||||
|
townPos = town->visitablePos();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CGObjectInstance * hero = createObject(Obj::HERO, heroTypeId.getNum(), townPos, playerColor);
|
CGObjectInstance * hero = createObject(Obj::HERO, heroTypeId.getNum(), townPos, playerColor);
|
||||||
hero->pos += hero->getVisitableOffset();
|
hero->pos += hero->getVisitableOffset();
|
||||||
@ -1866,8 +1873,8 @@ void CGameState::initVisitingAndGarrisonedHeroes()
|
|||||||
{
|
{
|
||||||
for(CGTownInstance *t : k->second.towns)
|
for(CGTownInstance *t : k->second.towns)
|
||||||
{
|
{
|
||||||
int3 vistile = t->pos; vistile.x--; //tile next to the entrance
|
int3 vistile = t->visitablePos(); vistile.x++; //tile next to the entrance
|
||||||
if(vistile == h->pos || h->pos==t->pos)
|
if(vistile == h->pos || h->pos==t->visitablePos())
|
||||||
{
|
{
|
||||||
t->setVisitingHero(h);
|
t->setVisitingHero(h);
|
||||||
if(h->pos == t->pos) //visiting hero placed in the editor has same pos as the town - we need to correct it
|
if(h->pos == t->pos) //visiting hero placed in the editor has same pos as the town - we need to correct it
|
||||||
|
Loading…
Reference in New Issue
Block a user