Schlangemann
New Member
(TFS 1.3)
Hey!
i have been following guides on this forum
([TFS 1.x] Global depots 10.9+ (https://otland.net/threads/tfs-1-x-global-depots-10-9.241626/))
(TFS 1.X+ - [TFS 1.3] How to add depot containers (https://otland.net/threads/tfs-1-3-how-to-add-depot-containers.263512/))
to add depot boxes to the depot chest.
i have gotten it to work kinda, the depot chest now contains 17 depot boxes and only one page of them.
i do not want pages inside depot boxes and that works as it should.
however, whenever i login to a character it adds 17 items to depot storage (the item boxes), they are not displayed but clearly use up depot storage.
(i check this by stepping on depot tile to see amount of depot storage items used)
is there a way to hinder the creation of more boxes once the boxes has been added once?
my player.cpp code:
My depotchest.cpp code:
Any suggestions are appreciated!
Regards, Schlangemann.
Hey!
i have been following guides on this forum
([TFS 1.x] Global depots 10.9+ (https://otland.net/threads/tfs-1-x-global-depots-10-9.241626/))
(TFS 1.X+ - [TFS 1.3] How to add depot containers (https://otland.net/threads/tfs-1-3-how-to-add-depot-containers.263512/))
to add depot boxes to the depot chest.
i have gotten it to work kinda, the depot chest now contains 17 depot boxes and only one page of them.
i do not want pages inside depot boxes and that works as it should.
however, whenever i login to a character it adds 17 items to depot storage (the item boxes), they are not displayed but clearly use up depot storage.
(i check this by stepping on depot tile to see amount of depot storage items used)
is there a way to hinder the creation of more boxes once the boxes has been added once?
my player.cpp code:
C++:
DepotChest* Player::getDepotChest(uint32_t depotId, bool autoCreate)
{
auto it = depotChests.find(depotId);
if (it != depotChests.end()) {
return it->second;
}
if (!autoCreate) {
return nullptr;
}
DepotChest* depotChest = new DepotChest(ITEM_DEPOT);
depotChest->incrementReferenceCounter();
depotChest->internalAddThing(Item::CreateItem(25469)); // id of the last, need to be in this order because the items will be created in the reverse order
depotChest->internalAddThing(Item::CreateItem(25468));
depotChest->internalAddThing(Item::CreateItem(25467));
depotChest->internalAddThing(Item::CreateItem(25466));
depotChest->internalAddThing(Item::CreateItem(25465));
depotChest->internalAddThing(Item::CreateItem(25464));
depotChest->internalAddThing(Item::CreateItem(25463));
depotChest->internalAddThing(Item::CreateItem(25462));
depotChest->internalAddThing(Item::CreateItem(25461));
depotChest->internalAddThing(Item::CreateItem(25460));
depotChest->internalAddThing(Item::CreateItem(25459));
depotChest->internalAddThing(Item::CreateItem(25458));
depotChest->internalAddThing(Item::CreateItem(25457));
depotChest->internalAddThing(Item::CreateItem(25456));
depotChest->internalAddThing(Item::CreateItem(25455));
depotChest->internalAddThing(Item::CreateItem(25454));
depotChest->internalAddThing(Item::CreateItem(25453));
depotChest->setMaxDepotItems(getMaxDepotItems());
depotChests[depotId] = depotChest;
return depotChest;
}
My depotchest.cpp code:
C++:
DepotChest::DepotChest(uint16_t type) :
Container(type, 17, true, false), maxDepotItems(10000) {
}
ReturnValue DepotChest::queryAdd(int32_t index, const Thing& thing, uint32_t count,
uint32_t flags, Creature* actor/* = nullptr*/) const
{
const Item* item = thing.getItem();
if (item == nullptr) {
return RETURNVALUE_NOTPOSSIBLE;
}
bool skipLimit = hasBitSet(FLAG_NOLIMIT, flags);
if (!skipLimit) {
int32_t addCount = 0;
if ((item->isStackable() && item->getItemCount() != count)) {
addCount = 1;
}
if (item->getTopParent() != this) {
if (const Container* container = item->getContainer()) {
addCount = container->getItemHoldingCount() + 1;
} else {
addCount = 1;
}
}
if (getItemHoldingCount() + addCount > maxDepotItems) {
return RETURNVALUE_DEPOTISFULL;
}
}
return Container::queryAdd(index, thing, count, flags, actor);
}
void DepotChest::postAddNotification(Thing* thing, const Cylinder* oldParent, int32_t index, cylinderlink_t)
{
Cylinder* parent = getParent();
if (parent != nullptr) {
parent->postAddNotification(thing, oldParent, index, LINK_PARENT);
}
}
void DepotChest::postRemoveNotification(Thing* thing, const Cylinder* newParent, int32_t index, cylinderlink_t)
{
Cylinder* parent = getParent();
if (parent != nullptr) {
parent->postRemoveNotification(thing, newParent, index, LINK_PARENT);
}
}
Cylinder* DepotChest::getParent() const
{
if (parent) {
return parent->getParent();
}
return nullptr;
}
Any suggestions are appreciated!
Regards, Schlangemann.