[9953] Remove two not needed cast to Creature* and make code more safe

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-05-22 12:03:49 +02:00
parent f758fac6f7
commit 0aac44e091
2 changed files with 3 additions and 5 deletions

View file

@ -12564,7 +12564,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
if (pMenuItemBounds.first == pMenuItemBounds.second && menuId == GetDefaultGossipMenuForSource(pSource)) if (pMenuItemBounds.first == pMenuItemBounds.second && menuId == GetDefaultGossipMenuForSource(pSource))
pMenuItemBounds = sObjectMgr.GetGossipMenuItemsMapBounds(0); pMenuItemBounds = sObjectMgr.GetGossipMenuItemsMapBounds(0);
bool canTalkToCredit = true; bool canTalkToCredit = pSource->GetTypeId() == TYPEID_UNIT;
for(GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) 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; GameObject *pGo = (GameObject*)pSource;
canTalkToCredit = false;
switch(itr->second.option_id) switch(itr->second.option_id)
{ {
case GOSSIP_OPTION_QUESTGIVER: case GOSSIP_OPTION_QUESTGIVER:
@ -12704,7 +12702,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
if (canTalkToCredit) if (canTalkToCredit)
{ {
if (pSource->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) 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 ;-) // some gossips aren't handled in normal way ... so we need to do it this way .. TODO: handle it in normal way ;-)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9952" #define REVISION_NR "9953"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__