From 57d7dc97bf6474d2c3066781a42d1639ee6d728f Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 3 Aug 2023 14:21:15 +0300 Subject: [PATCH] Fix assertion failure on swiping during spellcast --- client/gui/CursorHandler.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/client/gui/CursorHandler.h b/client/gui/CursorHandler.h index 4ef4fe8a5..531594b3a 100644 --- a/client/gui/CursorHandler.h +++ b/client/gui/CursorHandler.h @@ -31,8 +31,6 @@ namespace Cursor }; enum class Combat { - INVALID = -1, - BLOCKED = 0, MOVE = 1, FLY = 2, @@ -157,12 +155,16 @@ public: template Index get() { - assert((std::is_same::value )|| type != Cursor::Type::DEFAULT ); - assert((std::is_same::value )|| type != Cursor::Type::ADVENTURE ); - assert((std::is_same::value )|| type != Cursor::Type::COMBAT ); - assert((std::is_same::value )|| type != Cursor::Type::SPELLBOOK ); + bool typeValid = true; - return static_cast(frame); + typeValid &= (std::is_same::value )|| type != Cursor::Type::DEFAULT; + typeValid &= (std::is_same::value )|| type != Cursor::Type::ADVENTURE; + typeValid &= (std::is_same::value )|| type != Cursor::Type::COMBAT; + typeValid &= (std::is_same::value )|| type != Cursor::Type::SPELLBOOK; + + if (typeValid) + return static_cast(frame); + return Index::POINTER; } Point getPivotOffsetDefault(size_t index);