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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user