From bbc728a327a1871afd1487bac8cbf2e145f231af Mon Sep 17 00:00:00 2001 From: staphen Date: Sun, 1 Jun 2025 08:03:18 -0400 Subject: [PATCH] Remove overzealous validation logic in spell message handlers --- Source/diablo.cpp | 2 +- Source/msg.cpp | 6 ------ Source/player.cpp | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 924079352..f91f7039c 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -2713,7 +2713,7 @@ bool TryIconCurs() if (IsWallSpell(spellID)) { Direction sd = GetDirection(myPlayer.position.tile, cursPosition); NetSendCmdLocParam4(true, CMD_SPELLXYD, cursPosition, static_cast(spellID), static_cast(spellType), static_cast(sd), spellFrom); - } else if (pcursmonst != -1) { + } else if (pcursmonst != -1 && leveltype != DTYPE_TOWN) { NetSendCmdParam4(true, CMD_SPELLID, pcursmonst, static_cast(spellID), static_cast(spellType), spellFrom); } else if (PlayerUnderCursor != nullptr && !myPlayer.friendlyMode) { NetSendCmdParam4(true, CMD_SPELLPID, PlayerUnderCursor->getId(), static_cast(spellID), static_cast(spellType), spellFrom); diff --git a/Source/msg.cpp b/Source/msg.cpp index 4ed6e8cf7..887557432 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1730,8 +1730,6 @@ size_t OnSpellWall(const TCmdLocParam4 &message, Player &player) return sizeof(message); if (!player.isOnActiveLevel()) return sizeof(message); - if (leveltype == DTYPE_TOWN) - return sizeof(message); if (!InDungeonBounds(position)) return sizeof(message); const int16_t wParamDirection = SDL_SwapLE16(message.wParam3); @@ -1759,8 +1757,6 @@ size_t OnSpellTile(const TCmdLocParam3 &message, Player &player) return sizeof(message); if (!player.isOnActiveLevel()) return sizeof(message); - if (leveltype == DTYPE_TOWN) - return sizeof(message); if (!InDungeonBounds(position)) return sizeof(message); @@ -1889,8 +1885,6 @@ size_t OnSpellPlayer(const TCmdParam4 &message, Player &player) return sizeof(message); if (!player.isOnActiveLevel()) return sizeof(message); - if (leveltype == DTYPE_TOWN) - return sizeof(message); const uint16_t playerIdx = SDL_SwapLE16(message.wParam1); if (playerIdx >= Players.size()) return sizeof(message); diff --git a/Source/player.cpp b/Source/player.cpp index 0d0980c25..e8d479f45 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -3142,7 +3142,7 @@ void CheckPlrSpell(bool isShiftHeld, SpellID spellID, SpellType spellType) LastMouseButtonAction = MouseActionType::Spell; Direction sd = GetDirection(myPlayer.position.tile, cursPosition); NetSendCmdLocParam4(true, CMD_SPELLXYD, cursPosition, static_cast(spellID), static_cast(spellType), static_cast(sd), spellFrom); - } else if (pcursmonst != -1 && !isShiftHeld) { + } else if (pcursmonst != -1 && !isShiftHeld && leveltype != DTYPE_TOWN) { LastMouseButtonAction = MouseActionType::SpellMonsterTarget; NetSendCmdParam4(true, CMD_SPELLID, pcursmonst, static_cast(spellID), static_cast(spellType), spellFrom); } else if (PlayerUnderCursor != nullptr && !isShiftHeld && !myPlayer.friendlyMode) {