Browse Source

Fix bug in ef3a57b7 (#5732)

pull/5732/merge
Eric Robinson 3 years ago committed by GitHub
parent
commit
049f75515b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      Source/msg.cpp
  2. 2
      Source/panels/spell_list.cpp
  3. 2
      Source/spelldat.h

8
Source/msg.cpp

@ -1462,7 +1462,7 @@ size_t OnSpellWall(const TCmd *pCmd, Player &player)
if (wParam1 > SPL_LAST) if (wParam1 > SPL_LAST)
return sizeof(message); return sizeof(message);
const uint16_t wParam2 = SDL_SwapLE16(message.wParam2); const uint16_t wParam2 = SDL_SwapLE16(message.wParam2);
if (wParam2 > static_cast<uint8_t>(SpellType::LAST)) if (wParam2 > static_cast<uint8_t>(SpellType::Invalid))
return sizeof(message); return sizeof(message);
auto spell = static_cast<spell_id>(wParam1); auto spell = static_cast<spell_id>(wParam1);
@ -1503,7 +1503,7 @@ size_t OnSpellTile(const TCmd *pCmd, Player &player)
if (wParam1 > SPL_LAST) if (wParam1 > SPL_LAST)
return sizeof(message); return sizeof(message);
const uint16_t wParam2 = SDL_SwapLE16(message.wParam2); const uint16_t wParam2 = SDL_SwapLE16(message.wParam2);
if (wParam2 > static_cast<uint8_t>(SpellType::LAST)) if (wParam2 > static_cast<uint8_t>(SpellType::Invalid))
return sizeof(message); return sizeof(message);
auto spell = static_cast<spell_id>(wParam1); auto spell = static_cast<spell_id>(wParam1);
@ -1653,7 +1653,7 @@ size_t OnSpellMonster(const TCmd *pCmd, Player &player)
if (wParam2 > SPL_LAST) if (wParam2 > SPL_LAST)
return sizeof(message); return sizeof(message);
const uint16_t wParam3 = SDL_SwapLE16(message.wParam3); const uint16_t wParam3 = SDL_SwapLE16(message.wParam3);
if (wParam3 > static_cast<uint8_t>(SpellType::LAST)) if (wParam3 > static_cast<uint8_t>(SpellType::Invalid))
return sizeof(message); return sizeof(message);
auto spell = static_cast<spell_id>(wParam2); auto spell = static_cast<spell_id>(wParam2);
@ -1692,7 +1692,7 @@ size_t OnSpellPlayer(const TCmd *pCmd, Player &player)
if (wParam2 > SPL_LAST) if (wParam2 > SPL_LAST)
return sizeof(message); return sizeof(message);
const uint16_t wParam3 = SDL_SwapLE16(message.wParam3); const uint16_t wParam3 = SDL_SwapLE16(message.wParam3);
if (wParam3 > static_cast<uint8_t>(SpellType::LAST)) if (wParam3 > static_cast<uint8_t>(SpellType::Invalid))
return sizeof(message); return sizeof(message);
auto spell = static_cast<spell_id>(wParam2); auto spell = static_cast<spell_id>(wParam2);

2
Source/panels/spell_list.cpp

@ -215,7 +215,7 @@ std::vector<SpellListItem> GetSpellListItems()
case SpellType::Charges: case SpellType::Charges:
mask = myPlayer._pISpells; mask = myPlayer._pISpells;
break; break;
case SpellType::Invalid: default:
break; break;
} }
int8_t j = SPL_FIREBOLT; int8_t j = SPL_FIREBOLT;

2
Source/spelldat.h

@ -19,8 +19,8 @@ enum class SpellType : uint8_t {
Spell, Spell,
Scroll, Scroll,
Charges, Charges,
LAST = Charges,
Invalid, Invalid,
LAST = Invalid,
}; };
enum spell_id : int8_t { enum spell_id : int8_t {

Loading…
Cancel
Save