1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Show popup dialog instead of server error when using TP from water

This commit is contained in:
Ivan Savenko 2024-04-10 19:04:09 +03:00
parent 6c45353aa7
commit 3fc4383153

View File

@ -535,6 +535,18 @@ ESpellCastResult TownPortalMechanics::applyAdventureEffects(SpellCastEnvironment
return ESpellCastResult::ERROR;
}
const TerrainTile & from = env->getMap()->getTile(parameters.caster->getHeroCaster()->visitablePos());
const TerrainTile & dest = env->getMap()->getTile(destination->visitablePos());
if(!dest.isClear(&from))
{
InfoWindow iw;
iw.player = parameters.caster->getCasterOwner();
iw.text.appendLocalString(EMetaText::GENERAL_TXT, 135);
env->apply(&iw);
return ESpellCastResult::ERROR;
}
return ESpellCastResult::OK;
}