Container Class Reference

#include <Container.h>

Inheritance diagram for Container:

Item Object Actor MainActor List of all members.

Public Member Functions

 Container ()
virtual ~Container ()
 ENABLE_RUNTIME_CLASSTYPE ()
virtual bool CanAddItem (Item *item, bool checkwghtvol=false)
virtual bool addItem (Item *item, bool checkwghtvol=false)
virtual bool removeItem (Item *item)
virtual bool moveItemToEnd (Item *item)
void removeContents ()
void destroyContents ()
virtual void setFlagRecursively (uint32 mask)
void containerSearch (UCList *itemlist, const uint8 *loopscript, uint32 scriptsize, bool recurse)
virtual uint32 getTotalWeight ()
virtual uint32 getCapacity ()
virtual uint32 getContentVolume ()
virtual ObjId assignObjId ()
virtual void clearObjId ()
virtual void destroy (bool delnow=false)
virtual void dumpInfo ()
bool loadData (IDataSource *ids, uint32 version)
 INTRINSIC (I_removeContents)
 INTRINSIC (I_destroyContents)

Protected Member Functions

virtual void saveData (ODataSource *ods)

Protected Attributes

std::list< Item * > contents

Friends

class ItemFactory
class ContainerGump
class PaperdollGump

Detailed Description

Definition at line 29 of file Container.h.


Constructor & Destructor Documentation

Container::Container (  ) 

Definition at line 38 of file Container.cpp.

Container::~Container (  )  [virtual]

Definition at line 44 of file Container.cpp.

References contents, and Object::objid.


Member Function Documentation

bool Container::addItem ( Item item,
bool  checkwghtvol = false 
) [virtual]

Add an item to the container. This does NOT update item.

Parameters:
item The item to add
checkwghtvol Need to check weight and volume?
Returns:
true if item was added, false if failed

Reimplemented in MainActor.

Definition at line 144 of file Container.cpp.

References CanAddItem(), contents, Item::getParent(), and Object::objid.

Referenced by MainActor::addItem(), loadData(), and Item::moveToContainer().

ObjId Container::assignObjId (  )  [virtual]

Assign self and contents an objID

Returns:
the assiged ID

Reimplemented from Object.

Reimplemented in Actor.

Definition at line 61 of file Container.cpp.

References Object::assignObjId(), and contents.

Referenced by ItemFactory::createItem().

bool Container::CanAddItem ( Item item,
bool  checkwghtvol = false 
) [virtual]

Check if an item can be added to the container

Parameters:
item The item to check
checkwghtvol Need to check weight and volume?
Returns:
true if item can be added, false if not

Reimplemented in MainActor.

Definition at line 85 of file Container.cpp.

References getCapacity(), getContainer(), getContentVolume(), Actor::getEquip(), getMainActor(), Object::getObjId(), Item::getParent(), Item::getParentAsContainer(), Item::getShape(), Actor::getStr(), Item::getTopItem(), Item::getTotalWeight(), and Item::getVolume().

Referenced by addItem(), MainActor::CanAddItem(), PaperdollGump::DraggingItem(), GameMapGump::DraggingItem(), ContainerGump::DraggingItem(), and Item::moveToContainer().

void Container::clearObjId (  )  [virtual]

Clear objIDs of self and contents.

Reimplemented from Object.

Definition at line 74 of file Container.cpp.

References Object::clearObjId(), and contents.

void Container::containerSearch ( UCList itemlist,
const uint8 loopscript,
uint32  scriptsize,
bool  recurse 
)

Search the container for items matching the given loopscript.

Parameters:
itemlist The matching items are appended to this list
loopscript The loopscript to match items against
scriptsize The size (in bytes) of the loopscript
recurse If true, search through child-containers too

Definition at line 283 of file Container.cpp.

References UCList::append(), containerSearch(), contents, and Object::objid.

Referenced by CurrentMap::areaSearch(), containerSearch(), UCMachine::execProcess(), and MainActor::useInventoryItem().

void Container::destroy ( bool  delnow = false  )  [virtual]

Destroy self.

What do we do with our contents? (in Exult we remove the contents)

Reimplemented from Item.

Definition at line 228 of file Container.cpp.

References Item::destroy(), and removeContents().

Referenced by ActorAnimProcess::doSpecial(), and MonsterEgg::hatch().

void Container::destroyContents (  ) 

Destroy all contents.

Definition at line 206 of file Container.cpp.

References contents, and destroyContents().

Referenced by destroyContents(), Actor::die(), and Item::leaveFastArea().

void Container::dumpInfo (  )  [virtual]

dump some info about this item to pout

Reimplemented from Item.

Reimplemented in Actor.

Definition at line 307 of file Container.cpp.

References Item::dumpInfo(), getCapacity(), getContentVolume(), getTotalWeight(), and pout.

Referenced by Actor::dumpInfo().

Container::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented from Item.

Reimplemented in Actor, and MainActor.

uint32 Container::getCapacity (  )  [virtual]

Get the container's capacity.

Definition at line 263 of file Container.cpp.

References Item::getShapeInfo(), and ShapeInfo::volume.

Referenced by CanAddItem(), and dumpInfo().

uint32 Container::getContentVolume (  )  [virtual]

Get the total volume used up by the container's current contents.

Definition at line 270 of file Container.cpp.

References contents.

Referenced by CanAddItem(), and dumpInfo().

uint32 Container::getTotalWeight (  )  [virtual]

Get the weight of the container and its contents

Returns:
weight

Reimplemented from Item.

Definition at line 238 of file Container.cpp.

References contents, Item::getShape(), and Item::getTotalWeight().

Referenced by dumpInfo(), PaperdollGump::PaintStats(), U8Game::writeSaveInfo(), and RemorseGame::writeSaveInfo().

Container::INTRINSIC ( I_destroyContents   ) 

Container::INTRINSIC ( I_removeContents   ) 

bool Container::loadData ( IDataSource ids,
uint32  version 
)

Reimplemented from Item.

Reimplemented in Actor, and MainActor.

Definition at line 325 of file Container.cpp.

References addItem(), ObjectManager::get_instance(), Item::loadData(), and Object::objid.

Referenced by Actor::loadData().

bool Container::moveItemToEnd ( Item item  )  [virtual]

Move an item to the end of the contents list

Parameters:
item The item to move
Returns:
true if succesful, false if item isn't in this container

Definition at line 167 of file Container.cpp.

References contents.

Referenced by ContainerGump::DropItem().

void Container::removeContents (  ) 

Remove all contents, moving them to this container's parent. (Or into the world if this container has no parent.) Note: not yet implemented

Definition at line 185 of file Container.cpp.

References contents, Item::getParentAsContainer(), Item::parent, Item::x, Item::y, and Item::z.

Referenced by destroy().

bool Container::removeItem ( Item item  )  [virtual]

Remove an item from the container. This does NOT update item.

Parameters:
item The item to remove
Returns:
true if succesful, false if item wasn't in container

Reimplemented in Actor.

Definition at line 154 of file Container.cpp.

References contents.

Referenced by Item::destroy(), Item::move(), Item::moveToContainer(), Item::moveToEtherealVoid(), and Actor::removeItem().

void Container::saveData ( ODataSource ods  )  [protected, virtual]

save Container data

Reimplemented from Item.

Reimplemented in Actor, and MainActor.

Definition at line 315 of file Container.cpp.

References contents, Item::saveData(), and ODataSource::write4().

Referenced by Actor::saveData().

void Container::setFlagRecursively ( uint32  mask  )  [virtual]

Set flag on container and all its contents recursively.

Reimplemented from Item.

Definition at line 216 of file Container.cpp.

References contents, Item::setFlag(), and setFlagRecursively().

Referenced by setFlagRecursively().


Friends And Related Function Documentation

friend class ContainerGump [friend]

Definition at line 32 of file Container.h.

friend class ItemFactory [friend]

Reimplemented from Item.

Definition at line 31 of file Container.h.

friend class PaperdollGump [friend]

Definition at line 33 of file Container.h.


Member Data Documentation

std::list<Item*> Container::contents [protected]

Definition at line 113 of file Container.h.

Referenced by addItem(), assignObjId(), Actor::assignObjId(), MainActor::CanAddItem(), clearObjId(), PaperdollGump::Close(), ContainerGump::Close(), containerSearch(), destroyContents(), MainActor::getArmourClass(), getContentVolume(), MainActor::getDefenseType(), Actor::getEquip(), getTotalWeight(), moveItemToEnd(), ContainerGump::PaintThis(), removeContents(), removeItem(), saveData(), Actor::setEquip(), setFlagRecursively(), ContainerGump::TraceObjId(), and ~Container().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:28:53 2007 for pentagram by  doxygen 1.4.7