3alola1
I don't have time
I was having a problem earlier after implementing inbox system from tfs 1.4.2
the inbox is working nice every thing is fine except the depot chest.
When adding any item inside the depot chest it is telling me there is no enough room
I copied the whole depotchest.cpp and depotchest.h to my server and I know the reason why it is not adding more items because the depotchest in 10.98 isnt allowing that(the reason why I did this because iologin saves the depot items by itself doesnt need depotchest save items function)
Adding this in cpp fix the problem but......
there is no return button and when removing it the return button
comes again but the depot chest can't add more items
Any clue how to fix that?
the inbox is working nice every thing is fine except the depot chest.
When adding any item inside the depot chest it is telling me there is no enough room
I copied the whole depotchest.cpp and depotchest.h to my server and I know the reason why it is not adding more items because the depotchest in 10.98 isnt allowing that(the reason why I did this because iologin saves the depot items by itself doesnt need depotchest save items function)
Adding this in cpp fix the problem but......
C++:
/*Cylinder* DepotChest::getParent() const
{
if (parent) {
return parent->getParent();
}
return nullptr;
}*/
there is no return button and when removing it the return button

Any clue how to fix that?
Depotchest.cpp
C++:
// Copyright 2022 The Forgotten Server Authors. All rights reserved.
// Use of this source code is governed by the GPL-2.0 License that can be found in the LICENSE file.
#include "otpch.h"
#include "depotchest.h"
#include "tools.h"
DepotChest::DepotChest(uint16_t type) :
Container(type), maxDepotItems(2000) {
}
ReturnValue DepotChest::queryAdd(int32_t index, const Thing& thing, uint32_t count,
uint32_t flags, Creature* actor/* = nullptr*/) const
{
const Item* item = thing.getItem();
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;
}*/
Depotchest.h
C++:
// Copyright 2022 The Forgotten Server Authors. All rights reserved.
// Use of this source code is governed by the GPL-2.0 License that can be found in the LICENSE file.
#ifndef FS_DEPOTCHEST_H_6538526014684E3DBC92CC12815B6766
#define FS_DEPOTCHEST_H_6538526014684E3DBC92CC12815B6766
#include "container.h"
class DepotChest final : public Container
{
public:
explicit DepotChest(uint16_t type);
//serialization
void setMaxDepotItems(uint32_t maxitems) {
maxDepotItems = maxitems;
}
//cylinder implementations
ReturnValue queryAdd(int32_t index, const Thing& thing, uint32_t count,
uint32_t flags, Creature* actor = nullptr) const override;
void postAddNotification(Thing* thing, const Cylinder* oldParent, int32_t index, cylinderlink_t link = LINK_OWNER) override;
void postRemoveNotification(Thing* thing, const Cylinder* newParent, int32_t index, cylinderlink_t link = LINK_OWNER) override;
//overrides
bool canRemove() const override {
return false;
}
/*Cylinder* getParent() const override;
Cylinder* getRealParent() const override {
return parent;
}*/
private:
uint32_t maxDepotItems;
};
#endif