void Container::addItemBack(Item* item) { addItem(item); updateItemWeight(item->getWeight()); //send change to client if (getParent() && (getParent() != VirtualCylinder::virtualCylinder)) { onAddContainerItem(item); } }
void Container::__addThingBack(Thing* thing) { Item* item = thing->getItem(); if (item == nullptr) { return /*RETURNVALUE_NOTPOSSIBLE*/; } addItem(item); updateItemWeight(item->getWeight()); //send change to client if (getParent() && (getParent() != VirtualCylinder::virtualCylinder)) { onAddContainerItem(item); } }
void Container::addThing(int32_t index, Thing* thing) { if (index >= static_cast<int32_t>(capacity())) { return /*RETURNVALUE_NOTPOSSIBLE*/; } Item* item = thing->getItem(); if (item == nullptr) { return /*RETURNVALUE_NOTPOSSIBLE*/; } item->setParent(this); itemlist.push_front(item); updateItemWeight(item->getWeight()); //send change to client if (getParent() && (getParent() != VirtualCylinder::virtualCylinder)) { onAddContainerItem(item); } }
void Container::__addThingBack(Thing* thing) { Item* item = thing->getItem(); if (item == NULL) { return /*RET_NOTPOSSIBLE*/; } item->setParent(this); itemlist.push_back(item); totalWeight += item->getWeight(); if (Container* parentContainer = getParentContainer()) { parentContainer->updateItemWeight(item->getWeight()); } //send change to client if (getParent() && (getParent() != VirtualCylinder::virtualCylinder)) { onAddContainerItem(item); } }
void Container::__addThing(Creature*, int32_t index, Thing* thing) { if(index >= (int32_t)capacity()) { #ifdef __DEBUG_MOVESYS__ std::clog << "Failure: [Container::__addThing], index:" << index << ", index >= capacity()" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } Item* item = thing->getItem(); if(!item) { #ifdef __DEBUG_MOVESYS__ std::clog << "Failure: [Container::__addThing] item == NULL" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } #ifdef __DEBUG_MOVESYS__ if(index != INDEX_WHEREEVER && size() >= capacity()) { std::clog << "Failure: [Container::__addThing] size() >= capacity()" << std::endl; return /*RET_CONTAINERNOTENOUGHROOM*/; } #endif item->setParent(this); itemlist.push_front(item); totalWeight += item->getWeight(); if(Container* parentContainer = getParentContainer()) parentContainer->updateItemWeight(item->getWeight()); //send change to client if(getParent() && getParent() != VirtualCylinder::virtualCylinder) onAddContainerItem(item); }
void Container::__addThing(int32_t index, Thing* thing) { if (index >= (int32_t)capacity()) { return /*RET_NOTPOSSIBLE*/; } Item* item = thing->getItem(); if (item == nullptr) { return /*RET_NOTPOSSIBLE*/; } item->setParent(this); itemlist.push_front(item); totalWeight += item->getWeight(); if (Container* parentContainer = getParentContainer()) { parentContainer->updateItemWeight(item->getWeight()); } //send change to client if (getParent() && (getParent() != VirtualCylinder::virtualCylinder)) { onAddContainerItem(item); } }