mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Added new type-safe cast functions.
This, when properly used, should get rid of most memory corruption issues, currently, casting types C-style with no checks leads to some abstract crashing. Functionality is same as with dynamic_cast<>, but with no RTTI check - so when casting into invalid type you will receive NULL, and most probably crash. At the same time, i took the liberty to convert most Player* casts to ToPlayer(). Still needs crapload of casts being moved to new facility. --HG-- branch : trunk
This commit is contained in:
@@ -314,7 +314,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
if(mover->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
// not have spell in spellbook or spell passive and not casted by client
|
||||
if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )
|
||||
if (!mover->ToPlayer()->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )
|
||||
{
|
||||
//cheater? kick? ban?
|
||||
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
|
||||
|
||||
Reference in New Issue
Block a user