#include <Container.h>
Inheritance diagram for Container:
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 |
Definition at line 29 of file Container.h.
Container::Container | ( | ) |
Definition at line 38 of file Container.cpp.
Container::~Container | ( | ) | [virtual] |
bool Container::addItem | ( | Item * | item, | |
bool | checkwghtvol = false | |||
) | [virtual] |
Add an item to the container. This does NOT update item.
item | The item to add | |
checkwghtvol | Need to check weight and volume? |
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
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
item | The item to check | |
checkwghtvol | Need to check weight and volume? |
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.
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 | ( | ) |
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
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
item | The item to move |
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.
item | The item to remove |
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().
friend class ContainerGump [friend] |
Definition at line 32 of file Container.h.
friend class ItemFactory [friend] |
friend class PaperdollGump [friend] |
Definition at line 33 of file Container.h.
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().