Pol  Rev 533
UContainer Class Reference

#include <containr.h>

+ Inheritance diagram for UContainer:
+ Collaboration diagram for UContainer:

List of all members.

Public Types

typedef ULockable base
typedef Contents::const_iterator const_iterator
typedef std::vector< Item * > Contents
typedef Contents::iterator iterator
enum  MoveType { MT_PLAYER = 0, MT_CORE_MOVED = 1, MT_CORE_CREATED = 2 }

Public Member Functions

virtual ~UContainer ()
virtual void add (Item *item)
void add_at_random_location (Item *item)
virtual void add_bulk (int item_count_delta, int weight_delta)
void add_bulk (const Item *item)
iterator begin ()
const_iterator begin () const
virtual void builtin_on_use (Client *client)
virtual bool can_add (const Item &item) const
virtual bool can_add (unsigned short more_weight) const
bool can_add_bulk (int tli_diff, int item_count_diff, int weight_diff) const
virtual bool can_add_to_slot (u8 &slotIndex)
bool can_insert_add_item (Character *mob, MoveType move, Item *new_item)
bool can_insert_increase_stack (Character *mob, MoveType move, Item *existing_item, unsigned short amt_to_add, Item *adding_item)
bool can_swap (const UContainer &cont) const
bool check_can_remove_script (Character *chr, Item *item, MoveType move=MT_PLAYER)
void consume_sumof_objtype_noninuse (u32 objtype, unsigned int amount)
unsigned count () const
const ContainerDesc & descriptor () const
virtual void destroy ()
void destroy_contents ()
iterator end ()
const_iterator end () const
void enumerate_contents (class ObjArray *arr, int flags)
void extract (Contents &cnt)
Item * find (u32 serial) const
Item * find_addable_stack (const Item *adding_item) const
UContainer * find_container (u32 serial) const
bool find_empty_slot (u8 &slotIndex)
Item * find_objtype_noninuse (u32 objtype) const
unsigned int find_sumof_objtype_noninuse (u32 objtype) const
unsigned int find_sumof_objtype_noninuse (u32 objtype, u32 amtToGet, Contents &saveItemsTo, int flags) const
Item * find_toplevel (u32 serial) const
Item * find_toplevel_objtype (u32 objtype) const
Item * find_toplevel_objtype (u32 objtype, unsigned short maxamount) const
Item * find_toplevel_objtype_noninuse (u32 objtype) const
Item * find_toplevel_objtype_noninuse (u32 objtype, unsigned short maxamount) const
Item * find_toplevel_polclass (unsigned int polclass) const
virtual void for_each_item (void(*f)(Item *item, void *a), void *arg)
virtual Character * get_chr_owner ()
void get_random_location (u16 *px, u16 *py) const
u16 gump () const
bool is_legal_posn (const Item *item, u16 x, u16 y) const
bool is_slot_empty (u8 &slotIndex)
virtual unsigned int item_count () const
void on_insert_add_item (Character *mob, MoveType move, Item *new_item)
void on_insert_increase_stack (Character *mob, MoveType move, Item *existing_item, unsigned short amt_added)
void on_remove (Character *chr, Item *item, MoveType move=MT_PLAYER)
virtual void readProperties (ConfigElem &elem)
Item * remove (u32 serial, UContainer **found_in=NULL)
void remove (Item *item)
void remove (iterator itr)
void remove_bulk (const Item *item)
virtual bool script_isa (unsigned isatype) const
virtual void spill_contents (UMulti *supporting_multi)
void swap (UContainer &cont)
Item * system_find (u32 serial) const
virtual unsigned int weight () const

Protected Member Functions

 UContainer (const ContainerDesc &descriptor)
 UContainer (u32 objtype, UOBJ_CLASS pol_class)
Item * find (u32 serial, iterator &where_in_container)
Item * operator[] (unsigned idx) const
void printContents (std::ostream &os) const
virtual void printOn (std::ostream &os) const
virtual void printSelfOn (std::ostream &os) const

Protected Attributes

Contents contents_
const ContainerDesc & desc
unsigned int held_item_count_
u16 held_weight_

Friends

Item * Item::create (const ItemDesc &itemdesc, u32 serial)
bool send_vendorsell (Client *client, NPC *merchant, UContainer *sellfrom, bool send_aos_tooltip)
bool send_vendorwindow_contents (Client *client, UContainer *for_sale, bool send_aos_tooltip)
class UContainerIterator
class WornItemsContainer

Detailed Description

Definition at line 50 of file containr.h.


Member Typedef Documentation

Reimplemented from ULockable.

Reimplemented in UCorpse.

Definition at line 53 of file containr.h.

typedef Contents::const_iterator UContainer::const_iterator

Definition at line 61 of file containr.h.

typedef std::vector<Item*> UContainer::Contents

Definition at line 59 of file containr.h.

typedef Contents::iterator UContainer::iterator

Definition at line 60 of file containr.h.


Member Enumeration Documentation

Enumerator:
MT_PLAYER 
MT_CORE_MOVED 
MT_CORE_CREATED 

Definition at line 116 of file containr.h.


Constructor & Destructor Documentation

UContainer::~UContainer ( ) [virtual]

Definition at line 67 of file containr.cpp.

References contents_, and passert_always.

UContainer::UContainer ( const ContainerDesc &  descriptor) [explicit, protected]

Definition at line 59 of file containr.cpp.

UContainer::UContainer ( u32  objtype,
UOBJ_CLASS  pol_class 
) [protected]

Member Function Documentation

Definition at line 283 of file containr.cpp.

References add(), get_random_location(), UObject::x, UObject::y, and UObject::z.

Referenced by _create_item_in_container(), Character::die(), drop_item_on_mobile(), equip_loaded_item(), oldBuyHandler(), return_traded_items(), Item::script_method_id(), and undo_get_item().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UContainer::add_bulk ( int  item_count_delta,
int  weight_delta 
) [virtual]

Reimplemented in Spellbook.

Definition at line 209 of file containr.cpp.

References add_bulk(), Item::container, held_item_count_, and held_weight_.

Referenced by add(), add_bulk(), extract(), UCorpse::PutItemOnLayer(), WornItemsContainer::PutItemOnLayer(), remove_bulk(), Item::setamount(), and swap().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UContainer::add_bulk ( const Item *  item)

Definition at line 200 of file containr.cpp.

References add_bulk(), and Item::weight().

+ Here is the call graph for this function:

Definition at line 630 of file containr.cpp.

References contents_.

void UContainer::builtin_on_use ( Client *  client) [virtual]

Reimplemented from Item.

Definition at line 648 of file containr.cpp.

References ULockable::locked_, Client::pause(), Client::restart(), send_container_contents(), send_open_gump(), and send_sysmessage().

Referenced by doubleclick().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool UContainer::can_add ( unsigned short  more_weight) const [virtual]

Definition at line 167 of file containr.cpp.

References can_add_bulk().

+ Here is the call graph for this function:

bool UContainer::can_add_bulk ( int  tli_diff,
int  item_count_diff,
int  weight_diff 
) const
bool UContainer::can_insert_increase_stack ( Character *  mob,
MoveType  move,
Item *  existing_item,
unsigned short  amt_to_add,
Item *  adding_item 
)

Definition at line 768 of file containr.cpp.

References call_script(), ContainerDesc::can_insert_script, Item::create(), desc, ScriptDef::empty(), INSERT_INCREASE_STACK, Item::make_ref(), and Character::make_ref().

Referenced by _create_item_in_container(), add_item_to_stack(), drop_item_on_object(), and oldBuyHandler().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool UContainer::can_swap ( const UContainer &  cont) const

Definition at line 301 of file containr.cpp.

References can_add_bulk(), item_count(), and weight().

Referenced by change_trade_status(), and swap().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UContainer::consume_sumof_objtype_noninuse ( u32  objtype,
unsigned int  amount 
)

Definition at line 452 of file containr.cpp.

References find_objtype_noninuse(), Item::getamount(), passert_always, and subtract_amount_from_item().

Referenced by UOExecutorModule::mf_ConsumeSubstance(), and Character::spend_gold().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned UContainer::count ( void  ) const [inline]

Reimplemented from ref_counted.

Definition at line 183 of file containr.h.

References contents_.

Referenced by UBoat::hold_empty(), send_vendorsell(), and send_vendorwindow_contents().

+ Here is the caller graph for this function:

const ContainerDesc & UContainer::descriptor ( ) const [inline]

Definition at line 189 of file containr.h.

References desc.

void UContainer::destroy ( ) [virtual]

Reimplemented from UObject.

Definition at line 85 of file containr.cpp.

References UObject::destroy(), and destroy_contents().

Referenced by Character::~Character().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Definition at line 72 of file containr.cpp.

References contents_, and ITEM_ELEM_PTR.

Referenced by destroy(), and NPC::destroy().

+ Here is the caller graph for this function:

Definition at line 634 of file containr.cpp.

References contents_.

void UContainer::enumerate_contents ( class ObjArray *  arr,
int  flags 
)

Definition at line 3106 of file uomod.cpp.

References ObjArray::addElement(), UObject::CLASS_CONTAINER, contents_, end(), enumerate_contents(), ENUMERATE_IGNORE_LOCKED, ENUMERATE_ROOT_ONLY, GET_ITEM_PTR, UObject::isa(), and ULockable::locked_.

Referenced by enumerate_contents().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UContainer::extract ( Contents &  cnt)

Definition at line 295 of file containr.cpp.

References add_bulk(), contents_, held_item_count_, and held_weight_.

Referenced by Character::die(), and return_traded_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item * UContainer::find ( u32  serial) const

Definition at line 573 of file containr.cpp.

References UObject::CLASS_CONTAINER, contents_, find(), GET_ITEM_PTR, UObject::isa(), ULockable::locked_, passert, and UObject::serial.

Referenced by buyhandler(), calculate_cost(), find(), find_legal_item(), find_legal_singleclick_item(), Character::find_wornitem(), oldBuyHandler(), and remove().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item * UContainer::find ( u32  serial,
iterator &  where_in_container 
) [protected]

Definition at line 545 of file containr.cpp.

References UObject::CLASS_CONTAINER, contents_, find(), GET_ITEM_PTR, UObject::isa(), ULockable::locked_, passert, and UObject::serial.

+ Here is the call graph for this function:

Item * UContainer::find_addable_stack ( const Item *  adding_item) const

Definition at line 379 of file containr.cpp.

References Item::can_add_to_self(), contents_, GET_ITEM_PTR, Item::getamount(), Item::itemdesc(), and ItemDesc::stack_limit.

Referenced by oldBuyHandler(), and on_insert_add_item().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Definition at line 526 of file containr.cpp.

References UObject::CLASS_CONTAINER, contents_, find_container(), GET_ITEM_PTR, UObject::isa(), and UObject::serial.

Referenced by doubleclick(), find_container(), and find_legal_container().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool UContainer::find_empty_slot ( u8 &  slotIndex)

Definition at line 248 of file containr.cpp.

References contents_, ServSpecOpt::default_max_slots, desc, GET_ITEM_PTR, held_item_count_, ContainerDesc::max_items, Item::slot_index(), and ssopt.

Referenced by can_add_to_slot().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item * UContainer::find_toplevel ( u32  serial) const

Definition at line 599 of file containr.cpp.

References contents_, GET_ITEM_PTR, passert, and UObject::serial.

Referenced by oldSellHandler(), and sellhandler().

+ Here is the caller graph for this function:

Definition at line 337 of file containr.cpp.

References contents_, GET_ITEM_PTR, and UObject::objtype_.

Referenced by UOExecutorModule::mf_FindObjtypeInContainer().

+ Here is the caller graph for this function:

Item * UContainer::find_toplevel_objtype ( u32  objtype,
unsigned short  maxamount 
) const

Definition at line 358 of file containr.cpp.

References contents_, GET_ITEM_PTR, Item::getamount(), and UObject::objtype_.

+ Here is the call graph for this function:

Definition at line 347 of file containr.cpp.

References contents_, end(), GET_ITEM_PTR, Item::inuse(), and UObject::objtype_.

Referenced by find_objtype_noninuse().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item * UContainer::find_toplevel_objtype_noninuse ( u32  objtype,
unsigned short  maxamount 
) const

Definition at line 368 of file containr.cpp.

References contents_, GET_ITEM_PTR, Item::getamount(), Item::inuse(), and UObject::objtype_.

+ Here is the call graph for this function:

Item * UContainer::find_toplevel_polclass ( unsigned int  polclass) const

Definition at line 326 of file containr.cpp.

References contents_, GET_ITEM_PTR, and Item::script_isa().

Referenced by handle_open_spellbook().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UContainer::for_each_item ( void(*)(Item *item, void *a)  f,
void *  arg 
) [virtual]

Reimplemented in WornItemsContainer.

Definition at line 615 of file containr.cpp.

References begin(), UObject::CLASS_CONTAINER, end(), for_each_item(), GET_ITEM_PTR, and UObject::isa().

Referenced by drop_item_on_ground(), for_each_item(), WornItemsContainer::for_each_item(), UOExecutorModule::internal_MoveContainer(), and UBoat::realm_changed().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual Character* UContainer::get_chr_owner ( ) [inline, virtual]

Reimplemented in WornItemsContainer.

Definition at line 133 of file containr.h.

Referenced by chr_from_wornitems().

+ Here is the caller graph for this function:

void UContainer::get_random_location ( u16 *  px,
u16 *  py 
) const

Definition at line 670 of file containr.cpp.

References desc, ContainerDesc::maxx, ContainerDesc::maxy, ContainerDesc::minx, ContainerDesc::miny, and random_int().

Referenced by add_at_random_location(), drop_item_on_mobile(), drop_item_on_object(), UOExecutorModule::mf_MoveItemToContainer(), and oldSellHandler().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u16 UContainer::gump ( ) const

Definition at line 665 of file containr.cpp.

References desc, and ContainerDesc::gump.

Referenced by send_open_gump().

+ Here is the caller graph for this function:

bool UContainer::is_legal_posn ( const Item *  item,
u16  x,
u16  y 
) const

Definition at line 691 of file containr.cpp.

References desc, ContainerDesc::maxx, ContainerDesc::maxy, ContainerDesc::minx, and ContainerDesc::miny.

Referenced by UOExecutorModule::mf_MoveItemToContainer(), and undo_get_item().

+ Here is the caller graph for this function:

bool UContainer::is_slot_empty ( u8 &  slotIndex)

Definition at line 234 of file containr.cpp.

References contents_, GET_ITEM_PTR, held_item_count_, and Item::slot_index().

Referenced by can_add_to_slot().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int UContainer::item_count ( ) const [virtual]

Reimplemented from Item.

Definition at line 229 of file containr.cpp.

References held_item_count_.

Referenced by can_swap(), change_trade_status(), and swap().

+ Here is the caller graph for this function:

void UContainer::on_insert_increase_stack ( Character *  mob,
MoveType  move,
Item *  existing_item,
unsigned short  amt_added 
)

Definition at line 791 of file containr.cpp.

References call_script(), Item::create(), desc, ScriptDef::empty(), INSERT_INCREASE_STACK, Item::make_ref(), Character::make_ref(), and ContainerDesc::on_insert_script.

Referenced by _create_item_in_container(), add_item_to_stack(), drop_item_on_object(), and oldBuyHandler().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item * UContainer::operator[] ( unsigned  idx) const [inline, protected]

Definition at line 194 of file containr.h.

References contents_, and ITEM_ELEM_PTR.

void UContainer::printContents ( std::ostream &  os) const [protected]

Definition at line 103 of file containr.cpp.

References UObject::clear_dirty(), contents_, dont_save_itemtype(), GET_ITEM_PTR, UObject::objtype_, and Item::saveonexit().

Referenced by WornItemsContainer::print(), Spellbook::printOn(), and printOn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UContainer::printOn ( std::ostream &  os) const [protected, virtual]

Reimplemented from UObject.

Reimplemented in Spellbook.

Definition at line 92 of file containr.cpp.

References printContents(), and UObject::printOn().

+ Here is the call graph for this function:

void UContainer::printSelfOn ( std::ostream &  os) const [protected, virtual]

Reimplemented from UObject.

Reimplemented in Spellbook.

Definition at line 98 of file containr.cpp.

References UObject::printOn().

+ Here is the call graph for this function:

void UContainer::readProperties ( ConfigElem &  elem) [virtual]

Reimplemented from ULockable.

Reimplemented in UCorpse, and Spellbook.

Definition at line 873 of file containr.cpp.

References ULockable::readProperties().

Referenced by UCorpse::readProperties().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item * UContainer::remove ( u32  serial,
UContainer **  found_in = NULL 
)

Definition at line 467 of file containr.cpp.

References Item::container, find(), and remove().

Referenced by Item::extricate(), oldBuyHandler(), oldSellHandler(), remove(), and ItemGivenEvent::~ItemGivenEvent().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Definition at line 515 of file containr.cpp.

References Item::container, contents_, GET_ITEM_PTR, INC_PROFILEVAR, remove_bulk(), and UObject::set_dirty().

+ Here is the call graph for this function:

void UContainer::remove_bulk ( const Item *  item)

Definition at line 204 of file containr.cpp.

References add_bulk(), and Item::weight().

Referenced by remove(), and WornItemsContainer::RemoveItemFromLayer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool UContainer::script_isa ( unsigned  isatype) const [virtual]

Reimplemented from ULockable.

Reimplemented in UCorpse, and Spellbook.

Definition at line 3680 of file uoscrobj.cpp.

References POLCLASS_CONTAINER, and ULockable::script_isa().

Referenced by add_loaded_item(), USpellScroll::get_senditem_amount(), and UCorpse::script_isa().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UContainer::spill_contents ( UMulti *  supporting_multi) [virtual]

Reimplemented from Item.

Reimplemented in UCorpse.

Definition at line 697 of file containr.cpp.

References add_item_to_world(), Item::container, contents_, destroy_item(), ITEM_ELEM_PTR, Item::layer, ULockable::locked_, Item::movable(), move_item(), passert, UMulti::register_object(), UObject::set_dirty(), UObject::x, UObject::y, and UObject::z.

Referenced by UCorpse::spill_contents().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UContainer::swap ( UContainer &  cont)

Definition at line 313 of file containr.cpp.

References add_bulk(), can_swap(), contents_, item_count(), and weight().

Referenced by change_trade_status().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item* UContainer::system_find ( u32  serial) const
unsigned int UContainer::weight ( ) const [virtual]

Reimplemented from Item.

Definition at line 224 of file containr.cpp.

References held_weight_.

Referenced by can_add_bulk(), can_swap(), change_trade_status(), swap(), and Character::weight().

+ Here is the caller graph for this function:


Friends And Related Function Documentation

Item* Item::create ( const ItemDesc &  itemdesc,
u32  serial 
) [friend]

Reimplemented in UCorpse.

bool send_vendorsell ( Client *  client,
NPC *  merchant,
UContainer *  sellfrom,
bool  send_aos_tooltip 
) [friend]

Definition at line 608 of file uomod2.cpp.

bool send_vendorwindow_contents ( Client *  client,
UContainer *  for_sale,
bool  send_aos_tooltip 
) [friend]

Definition at line 155 of file uomod2.cpp.

friend class UContainerIterator [friend]

Definition at line 165 of file containr.h.

friend class WornItemsContainer [friend]

Definition at line 170 of file containr.h.


Member Data Documentation

unsigned int UContainer::held_item_count_ [protected]

Definition at line 158 of file containr.h.

Referenced by add_bulk(), can_add_bulk(), extract(), find_empty_slot(), is_slot_empty(), and item_count().

Definition at line 157 of file containr.h.

Referenced by add_bulk(), can_add_bulk(), extract(), and weight().


The documentation for this class was generated from the following files: