mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Allow town portal to ally town.
fixes mantiss 0002064
This commit is contained in:
@@ -707,7 +707,14 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
|
||||
//todo: move to mechanics
|
||||
|
||||
std::vector <int> availableTowns;
|
||||
std::vector <const CGTownInstance*> Towns = LOCPLINT->cb->getTownsInfo(true);
|
||||
std::vector <const CGTownInstance*> Towns = LOCPLINT->cb->getTownsInfo(false);
|
||||
|
||||
vstd::erase_if(Towns, [](const CGTownInstance * t)
|
||||
{
|
||||
const auto relations = LOCPLINT->cb->getPlayerRelations(t->tempOwner, LOCPLINT->playerID);
|
||||
return relations == PlayerRelations::ENEMIES;
|
||||
});
|
||||
|
||||
if (Towns.empty())
|
||||
{
|
||||
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[124]);
|
||||
|
||||
@@ -203,9 +203,12 @@ bool TownPortalMechanics::applyAdventureEffects(const SpellCastEnvironment * env
|
||||
}
|
||||
|
||||
CGTownInstance * town = static_cast<CGTownInstance*>(tile.visitableObjects.back());
|
||||
if (town->tempOwner != parameters.caster->tempOwner)
|
||||
|
||||
const auto relations = env->getCb()->getPlayerRelations(town->tempOwner, parameters.caster->tempOwner);
|
||||
|
||||
if(relations == PlayerRelations::ENEMIES)
|
||||
{
|
||||
env->complain("Can't teleport to another player!");
|
||||
env->complain("Can't teleport to enemy!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user