[General] Remove owner var from ContainerItem because it is always empty

pull/163/head
David Cernat 8 years ago
parent fd4827b3a7
commit 4f2b88df8a

@ -138,12 +138,6 @@ int WorldFunctions::GetContainerItemGoldValue(unsigned int objectIndex, unsigned
.containerChanges.items.at(itemIndex).goldValue;
}
const char *WorldFunctions::GetContainerItemOwner(unsigned int objectIndex, unsigned int itemIndex) noexcept
{
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(objectIndex)
.containerChanges.items.at(itemIndex).owner.c_str();
}
void WorldFunctions::SetBaseEventCell(const char* cellDescription) noexcept
{
std::string description = cellDescription;

@ -27,7 +27,6 @@
{"GetContainerItemCount", WorldFunctions::GetContainerItemCount},\
{"GetContainerItemCharge", WorldFunctions::GetContainerItemCharge},\
{"GetContainerItemGoldValue", WorldFunctions::GetContainerItemGoldValue},\
{"GetContainerItemOwner", WorldFunctions::GetContainerItemOwner},\
\
{"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\
{"SetBaseEventAction", WorldFunctions::SetBaseEventAction},\
@ -91,7 +90,6 @@ public:
static int GetContainerItemCount(unsigned int objectIndex, unsigned int itemIndex) noexcept;
static int GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept;
static int GetContainerItemGoldValue(unsigned int objectIndex, unsigned int itemIndex) noexcept;
static const char *GetContainerItemOwner(unsigned int objectIndex, unsigned int itemIndex) noexcept;
static void SetBaseEventCell(const char* cellDescription) noexcept;
static void SetBaseEventAction(int action) noexcept;

@ -117,7 +117,6 @@ namespace MWGui
containerItem.count = itemPtr.getRefData().getCount();
containerItem.charge = itemPtr.getCellRef().getCharge();
containerItem.goldValue = itemPtr.getCellRef().getGoldValue();
containerItem.owner = itemPtr.getCellRef().getOwner();
containerItem.actionCount = count;
worldObject.containerChanges.items.push_back(containerItem);
@ -180,7 +179,6 @@ namespace MWGui
containerItem.charge = itemPtr.getCellRef().getCharge();
containerItem.goldValue = itemPtr.getCellRef().getGoldValue();
containerItem.owner = itemPtr.getCellRef().getOwner();
worldObject.containerChanges.items.push_back(containerItem);
event->addObject(worldObject);

@ -68,7 +68,6 @@ void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
containerItem.count = itemPtr.getRefData().getCount();
containerItem.charge = itemPtr.getCellRef().getCharge();
containerItem.goldValue = itemPtr.getCellRef().getGoldValue();
containerItem.owner = itemPtr.getCellRef().getOwner();
worldObject.containerChanges.items.push_back(containerItem);
}
@ -109,10 +108,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
for (unsigned int i = 0; i < worldObject.containerChanges.count; i++)
{
ContainerItem containerItem = worldObject.containerChanges.items.at(i);
MWWorld::Ptr ownerPtr = MWBase::Environment::get().getWorld()->searchPtr(containerItem.owner, false);
if (ownerPtr.isEmpty())
ownerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr ownerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
if (action == BaseEvent::ADD || action == BaseEvent::SET)
{
@ -140,8 +136,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
{
if (iter->getCellRef().getCharge() == containerItem.charge &&
iter->getCellRef().getGoldValue() == containerItem.goldValue &&
iter->getRefData().getCount() == containerItem.count &&
iter->getCellRef().getOwner() == containerItem.owner)
iter->getRefData().getCount() == containerItem.count)
{
containerStore.remove(*iter, containerItem.actionCount, ownerPtr);
}

@ -14,7 +14,6 @@ namespace mwmp
int charge;
int goldValue;
std::string owner;
int actionCount;
inline bool operator==(const ContainerItem& rhs)

@ -61,7 +61,6 @@ void PacketContainer::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
RW(containerItem.count, send);
RW(containerItem.charge, send);
RW(containerItem.goldValue, send);
RW(containerItem.owner, send);
RW(containerItem.actionCount, send);
if (!send)

Loading…
Cancel
Save