Core/Cleanup: remove C-style cast to (Bag*):

* add ToBag() methods for Item class;
* add GetBagByPos() method for Player class.
This commit is contained in:
Azazel
2011-03-18 15:58:08 +06:00
parent 90a3fee232
commit e49b5b44d6
9 changed files with 156 additions and 183 deletions
+9
View File
@@ -281,6 +281,15 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
return true;
}
// Returns true if Item is a bag AND it is not empty.
// Returns false if Item is not a bag OR it is an empty bag.
bool Item::IsNotEmptyBag() const
{
if (const Bag* pBag = ToBag())
return !pBag->IsEmpty();
return false;
}
void Item::UpdateDuration(Player* owner, uint32 diff)
{
if (!GetUInt32Value(ITEM_FIELD_DURATION))