فهرست منبع

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

Ivan Savenko 1 سال پیش
والد
کامیت
3fc4383153
1فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 12 0
      lib/spells/AdventureSpellMechanics.cpp

+ 12 - 0
lib/spells/AdventureSpellMechanics.cpp

@@ -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;
 }