Browse Source

Remove overzealous validation logic in spell message handlers

pull/8034/head
staphen 10 months ago committed by Anders Jenbo
parent
commit
bbc728a327
  1. 2
      Source/diablo.cpp
  2. 6
      Source/msg.cpp
  3. 2
      Source/player.cpp

2
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<int8_t>(spellID), static_cast<uint8_t>(spellType), static_cast<uint16_t>(sd), spellFrom);
} else if (pcursmonst != -1) {
} else if (pcursmonst != -1 && leveltype != DTYPE_TOWN) {
NetSendCmdParam4(true, CMD_SPELLID, pcursmonst, static_cast<int8_t>(spellID), static_cast<uint8_t>(spellType), spellFrom);
} else if (PlayerUnderCursor != nullptr && !myPlayer.friendlyMode) {
NetSendCmdParam4(true, CMD_SPELLPID, PlayerUnderCursor->getId(), static_cast<int8_t>(spellID), static_cast<uint8_t>(spellType), spellFrom);

6
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);

2
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<int8_t>(spellID), static_cast<uint8_t>(spellType), static_cast<uint16_t>(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<int8_t>(spellID), static_cast<uint8_t>(spellType), spellFrom);
} else if (PlayerUnderCursor != nullptr && !isShiftHeld && !myPlayer.friendlyMode) {

Loading…
Cancel
Save