Skip to content

Commit

Permalink
[10607] Handle GAMEOBJECT_TYPE_GENERIC at Use() to trigger despawn of GO
Browse files Browse the repository at this point in the history
In addition, a check is added to prevent unexpected call to Use() at received opcode. Despawn of this type GO can then only be used with explicit call to Use()

Signed-off-by: NoFantasy <nofantasy@nf.no>
  • Loading branch information
Schmoozerd authored and NoFantasy committed Oct 14, 2010
1 parent b8d31dd commit 882611d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/game/GameObject.cpp
Expand Up @@ -974,6 +974,12 @@ void GameObject::Use(Unit* user)

return;
}
case GAMEOBJECT_TYPE_GENERIC: // 5
{
// No known way to exclude some - only different approach is to select despawnable GOs by Entry
SetLootState(GO_JUST_DEACTIVATED);
return;
}
case GAMEOBJECT_TYPE_CHAIR: //7 Sitting: Wooden bench, chairs
{
GameObjectInfo const* info = GetGOInfo();
Expand Down
7 changes: 7 additions & 0 deletions src/game/SpellHandler.cpp
Expand Up @@ -285,6 +285,13 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
if(!obj)
return;

// Never expect this opcode for some type GO's
if (obj->GetGoType() == GAMEOBJECT_TYPE_GENERIC)
{
sLog.outError("HandleGameObjectUseOpcode: CMSG_GAMEOBJ_USE for not allowed GameObject type %u (Entry %u), didn't expect this to happen.", obj->GetGoType(), obj->GetEntry());
return;
}

obj->Use(_player);
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10606"
#define REVISION_NR "10607"
#endif // __REVISION_NR_H__

0 comments on commit 882611d

Please sign in to comment.