1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

#1579 - check z coord as well

This commit is contained in:
Andrii Danylchenko 2023-02-17 18:34:49 +02:00
parent 27ef876bd6
commit 47b253e837

View File

@ -1865,6 +1865,9 @@ void CGameState::placeHeroesInTowns()
{ {
for(CGTownInstance *t : k->second.towns) for(CGTownInstance *t : k->second.towns)
{ {
if(h->visitablePos().z != t->visitablePos().z)
continue;
bool heroOnTownBlockableTile = t->blockingAt(h->visitablePos().x, h->visitablePos().y); bool heroOnTownBlockableTile = t->blockingAt(h->visitablePos().x, h->visitablePos().y);
// current hero position is at one of blocking tiles of current town // current hero position is at one of blocking tiles of current town
@ -1896,6 +1899,9 @@ void CGameState::initVisitingAndGarrisonedHeroes()
{ {
for(CGTownInstance *t : k->second.towns) for(CGTownInstance *t : k->second.towns)
{ {
if(h->visitablePos().z != t->visitablePos().z)
continue;
if (t->visitableAt(h->visitablePos().x, h->visitablePos().y)) if (t->visitableAt(h->visitablePos().x, h->visitablePos().y))
{ {
assert(t->visitingHero == nullptr); assert(t->visitingHero == nullptr);