瀏覽代碼

Dimension door movement points fix

When hero with one move point make dimension doors then he can have on
graphics full move points. Caused by substraction that make unsigned
variable < 0.
FeniksFire 8 年之前
父節點
當前提交
f331386b6f
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      lib/spells/AdventureSpellMechanics.cpp

+ 4 - 1
lib/spells/AdventureSpellMechanics.cpp

@@ -322,7 +322,10 @@ ESpellCastResult DimensionDoorMechanics::applyAdventureEffects(const SpellCastEn
 	{
 		SetMovePoints smp;
 		smp.hid = parameters.caster->id;
-		smp.val = std::max<ui32>(0, parameters.caster->movement - movementCost);
+		if(movementCost < parameters.caster->movement)
+			smp.val = parameters.caster->movement - movementCost;
+		else
+			smp.val = 0;
 		env->sendAndApply(&smp);
 	}
 	return ESpellCastResult::OK;