[Client] Remove redundant container methods from CellController

0.6.3
David Cernat 7 years ago
parent 365f485e8d
commit d8b48f6cf4

@ -11,6 +11,7 @@
#include <components/openmw-mp/Log.hpp> #include <components/openmw-mp/Log.hpp>
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/LocalPlayer.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/WorldEvent.hpp"
#include "../mwmp/CellController.hpp" #include "../mwmp/CellController.hpp"
/* /*
@ -217,7 +218,7 @@ namespace MWGui
Mark this container as open for multiplayer logic purposes Mark this container as open for multiplayer logic purposes
*/ */
mwmp::Main::get().getCellController()->openContainer(container); mwmp::Main::get().getLocalPlayer()->storeCurrentContainer(container);
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -269,7 +270,8 @@ namespace MWGui
Mark this container as closed for multiplayer logic purposes Mark this container as closed for multiplayer logic purposes
*/ */
mwmp::Main::get().getCellController()->closeContainer(mPtr); mwmp::Main::get().getLocalPlayer()->clearCurrentContainer();
mwmp::Main::get().getLocalPlayer()->updateInventory();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -345,48 +345,6 @@ bool CellController::isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCel
return false; return false;
} }
void CellController::openContainer(const MWWorld::Ptr &container)
{
// Record this as the player's current open container
Main::get().getLocalPlayer()->storeCurrentContainer(container);
const auto &cellRef = container.getCellRef();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is opened",
cellRef.getRefId().c_str(), cellRef.getRefNum().mIndex);
for (const auto &ptr : container.getClass().getContainerStore(container))
{
int count = ptr.getRefData().getCount();
const std::string &name = ptr.getCellRef().getRefId();
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d", name.c_str(), count);
/*if (::Misc::StringUtils::ciEqual(name, "gold_001"))
cont.remove("gold_001", count, container);*/
}
}
void CellController::closeContainer(const MWWorld::Ptr &container)
{
Main::get().getLocalPlayer()->clearCurrentContainer();
// If the player died while in a container, the container's Ptr could be invalid now
if (!container.isEmpty())
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is closed.", container.getCellRef().getRefId().c_str(),
container.getCellRef().getRefNum().mIndex);
MWWorld::ContainerStore &cont = container.getClass().getContainerStore(container);
for (const auto &ptr : cont)
{
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d", ptr.getCellRef().getRefId().c_str(),
ptr.getRefData().getCount());
}
}
Main::get().getLocalPlayer()->updateInventory();
}
int CellController::getCellSize() const int CellController::getCellSize() const
{ {
return 8192; return 8192;

@ -60,9 +60,6 @@ namespace mwmp
bool isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCell); bool isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCell);
void openContainer(const MWWorld::Ptr& container);
void closeContainer(const MWWorld::Ptr& container);
int getCellSize() const; int getCellSize() const;
private: private:

Loading…
Cancel
Save