From 0aac44e091c3a2be7b91b9135efe1d4af9deea3f Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sat, 22 May 2010 12:03:49 +0200 Subject: [PATCH] [9953] Remove two not needed cast to Creature* and make code more safe Signed-off-by: NoFantasy --- src/game/Player.cpp | 6 ++---- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 55fee16a2..2f7134713 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12564,7 +12564,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) if (pMenuItemBounds.first == pMenuItemBounds.second && menuId == GetDefaultGossipMenuForSource(pSource)) pMenuItemBounds = sObjectMgr.GetGossipMenuItemsMapBounds(0); - bool canTalkToCredit = true; + bool canTalkToCredit = pSource->GetTypeId() == TYPEID_UNIT; for(GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) { @@ -12656,8 +12656,6 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) { GameObject *pGo = (GameObject*)pSource; - canTalkToCredit = false; - switch(itr->second.option_id) { case GOSSIP_OPTION_QUESTGIVER: @@ -12704,7 +12702,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) if (canTalkToCredit) { if (pSource->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - TalkedToCreature(((Creature*)pSource)->GetEntry(), ((Creature*)pSource)->GetGUID()); + TalkedToCreature(pSource->GetEntry(), pSource->GetGUID()); } // some gossips aren't handled in normal way ... so we need to do it this way .. TODO: handle it in normal way ;-) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 5d3a27779..a63281af0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9952" + #define REVISION_NR "9953" #endif // __REVISION_NR_H__