Make typecasting methods *really* safe and get rid of redundant typeId/Typemask checks, thanks Zor and Machiavelli for help

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-08-05 17:01:25 +02:00
parent 30194bdd61
commit c94046b065
6 changed files with 98 additions and 8 deletions
+10
View File
@@ -257,6 +257,16 @@ Item::Item()
m_paidExtendedCost = 0;
}
inline Bag* Item::ToBag()
{
return dynamic_cast<Bag*>(this);
}
inline const Bag* Item::ToBag() const
{
return dynamic_cast<const Bag*>(this);
}
bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
{
Object::_Create(guidlow, 0, HIGHGUID_ITEM);
+3
View File
@@ -347,6 +347,9 @@ class Item : public Object
void BuildUpdate(UpdateDataMapType&);
Bag* ToBag();
const Bag* ToBag() const;
private:
std::string m_text;
uint8 m_slot;