Explorar o código

Do not summon boat from another boat, fixes #2294 (#353)

Piotr %!s(int64=8) %!d(string=hai) anos
pai
achega
069f295165
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      lib/spells/AdventureSpellMechanics.cpp

+ 10 - 0
lib/spells/AdventureSpellMechanics.cpp

@@ -136,6 +136,16 @@ SummonBoatMechanics::SummonBoatMechanics(const CSpell * s):
 
 ESpellCastResult SummonBoatMechanics::applyAdventureEffects(const SpellCastEnvironment * env, const AdventureSpellCastParameters & parameters) const
 {
+	if(parameters.caster->boat)
+	{
+		InfoWindow iw;
+		iw.player = parameters.caster->tempOwner;
+		iw.text.addTxt(MetaString::GENERAL_TXT, 333);//%s is already in boat
+		iw.text.addReplacement(parameters.caster->name);
+		env->sendAndApply(&iw);
+		return ESpellCastResult::CANCEL;
+	}
+
 	int3 summonPos = parameters.caster->bestLocation();
 	if(summonPos.x < 0)
 	{