2016-11-15 17:13:36 +00:00
|
|
|
#include <components/esm/cellid.hpp>
|
2016-11-15 16:42:52 +00:00
|
|
|
#include <components/openmw-mp/Log.hpp>
|
2017-04-07 05:12:50 +00:00
|
|
|
#include <components/openmw-mp/Utils.hpp>
|
2017-04-08 09:54:38 +00:00
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
|
2016-12-16 09:27:19 +00:00
|
|
|
#include "../mwworld/containerstore.hpp"
|
|
|
|
#include "../mwworld/class.hpp"
|
2017-04-08 09:54:38 +00:00
|
|
|
#include "../mwworld/worldimp.hpp"
|
2016-11-15 16:42:52 +00:00
|
|
|
|
2017-04-05 09:00:21 +00:00
|
|
|
#include "CellController.hpp"
|
2016-11-15 16:42:52 +00:00
|
|
|
#include "Main.hpp"
|
2017-04-07 07:16:23 +00:00
|
|
|
#include "LocalActor.hpp"
|
2016-12-16 10:13:44 +00:00
|
|
|
#include "LocalPlayer.hpp"
|
2017-04-05 21:49:20 +00:00
|
|
|
using namespace mwmp;
|
|
|
|
|
2017-04-23 13:53:24 +00:00
|
|
|
std::map<std::string, mwmp::Cell *> CellController::cellsInitialized;
|
2017-04-07 05:12:50 +00:00
|
|
|
std::map<std::string, std::string> CellController::localActorsToCells;
|
2017-04-08 04:46:33 +00:00
|
|
|
std::map<std::string, std::string> CellController::dedicatedActorsToCells;
|
2016-11-15 16:42:52 +00:00
|
|
|
|
2017-04-05 09:00:21 +00:00
|
|
|
mwmp::CellController::CellController()
|
2016-11-15 16:42:52 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2017-06-27 13:56:40 +00:00
|
|
|
|
2017-04-10 14:10:18 +00:00
|
|
|
void CellController::updateLocal(bool forceUpdate)
|
2017-04-05 21:49:20 +00:00
|
|
|
{
|
2017-05-04 23:46:16 +00:00
|
|
|
// Loop through Cells, deleting inactive ones and updating LocalActors in active ones
|
2017-04-23 13:53:24 +00:00
|
|
|
for (std::map<std::string, mwmp::Cell *>::iterator it = cellsInitialized.begin(); it != cellsInitialized.end();)
|
2017-04-05 21:49:20 +00:00
|
|
|
{
|
2017-04-07 02:52:07 +00:00
|
|
|
mwmp::Cell *mpCell = it->second;
|
2017-04-05 21:49:20 +00:00
|
|
|
|
2017-04-06 01:00:50 +00:00
|
|
|
if (!MWBase::Environment::get().getWorld()->isCellActive(mpCell->getCellStore()))
|
2017-04-05 21:49:20 +00:00
|
|
|
{
|
2017-04-06 01:59:55 +00:00
|
|
|
mpCell->uninitializeLocalActors();
|
2017-04-08 04:46:33 +00:00
|
|
|
mpCell->uninitializeDedicatedActors();
|
2017-04-30 01:19:28 +00:00
|
|
|
delete it->second;
|
2017-04-23 13:53:24 +00:00
|
|
|
cellsInitialized.erase(it++);
|
2017-04-05 21:49:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-04-10 14:10:18 +00:00
|
|
|
mpCell->updateLocal(forceUpdate);
|
2017-04-05 21:49:20 +00:00
|
|
|
++it;
|
|
|
|
}
|
|
|
|
}
|
2017-05-04 23:46:16 +00:00
|
|
|
|
|
|
|
// Loop through Cells and initialize new LocalActors for eligible ones
|
|
|
|
//
|
|
|
|
// Note: This cannot be combined with the above loop because initializing LocalActors in a Cell before they are
|
|
|
|
// deleted from their previous one can make their records stay deleted
|
2017-06-27 14:27:02 +00:00
|
|
|
for (auto &cell : cellsInitialized)
|
2017-05-04 23:46:16 +00:00
|
|
|
{
|
2017-06-27 13:56:40 +00:00
|
|
|
mwmp::Cell *mpCell = cell.second;
|
2017-05-04 23:46:16 +00:00
|
|
|
if (mpCell->shouldInitializeActors == true)
|
|
|
|
{
|
|
|
|
mpCell->shouldInitializeActors = false;
|
|
|
|
mpCell->initializeLocalActors();
|
|
|
|
}
|
|
|
|
}
|
2017-04-05 21:49:20 +00:00
|
|
|
}
|
|
|
|
|
2017-04-07 12:51:34 +00:00
|
|
|
void CellController::updateDedicated(float dt)
|
|
|
|
{
|
2017-06-27 14:27:02 +00:00
|
|
|
for (const auto &cell : cellsInitialized)
|
2017-06-27 13:56:40 +00:00
|
|
|
cell.second->updateDedicated(dt);
|
2017-04-07 12:51:34 +00:00
|
|
|
}
|
|
|
|
|
2017-04-08 09:33:41 +00:00
|
|
|
void CellController::initializeCell(const ESM::Cell& cell)
|
2017-04-05 21:49:20 +00:00
|
|
|
{
|
2017-04-08 09:33:41 +00:00
|
|
|
std::string mapIndex = cell.getDescription();
|
2017-04-05 21:49:20 +00:00
|
|
|
|
2017-04-08 09:33:41 +00:00
|
|
|
// If this key doesn't exist, create it
|
2017-04-23 13:53:24 +00:00
|
|
|
if (cellsInitialized.count(mapIndex) == 0)
|
2017-04-08 09:33:41 +00:00
|
|
|
{
|
2017-04-10 14:30:57 +00:00
|
|
|
MWWorld::CellStore *cellStore = getCellStore(cell);
|
2017-04-07 02:52:07 +00:00
|
|
|
|
2017-04-08 09:33:41 +00:00
|
|
|
if (!cellStore) return;
|
2017-04-05 21:49:20 +00:00
|
|
|
|
2017-04-08 09:33:41 +00:00
|
|
|
mwmp::Cell *mpCell = new mwmp::Cell(cellStore);
|
2017-04-23 13:53:24 +00:00
|
|
|
cellsInitialized[mapIndex] = mpCell;
|
2017-04-07 02:52:07 +00:00
|
|
|
|
2017-04-08 09:33:41 +00:00
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Initialized mwmp::Cell %s", mpCell->getDescription().c_str());
|
|
|
|
}
|
2017-04-05 21:49:20 +00:00
|
|
|
}
|
|
|
|
|
2017-04-10 14:10:18 +00:00
|
|
|
void CellController::readPositions(ActorList& actorList)
|
2017-04-08 09:33:41 +00:00
|
|
|
{
|
2017-04-09 13:32:44 +00:00
|
|
|
std::string mapIndex = actorList.cell.getDescription();
|
2017-04-06 08:46:56 +00:00
|
|
|
|
2017-04-09 13:32:44 +00:00
|
|
|
initializeCell(actorList.cell);
|
2017-04-06 08:46:56 +00:00
|
|
|
|
2017-04-07 02:52:07 +00:00
|
|
|
// If this now exists, send it the data
|
2017-04-23 13:53:24 +00:00
|
|
|
if (cellsInitialized.count(mapIndex) > 0)
|
|
|
|
cellsInitialized[mapIndex]->readPositions(actorList);
|
2017-04-06 08:46:56 +00:00
|
|
|
}
|
|
|
|
|
2017-04-15 07:47:53 +00:00
|
|
|
void CellController::readAnimFlags(ActorList& actorList)
|
2017-04-13 12:26:48 +00:00
|
|
|
{
|
|
|
|
std::string mapIndex = actorList.cell.getDescription();
|
|
|
|
|
|
|
|
initializeCell(actorList.cell);
|
|
|
|
|
|
|
|
// If this now exists, send it the data
|
2017-04-23 13:53:24 +00:00
|
|
|
if (cellsInitialized.count(mapIndex) > 0)
|
|
|
|
cellsInitialized[mapIndex]->readAnimFlags(actorList);
|
2017-04-13 12:26:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-15 10:42:30 +00:00
|
|
|
void CellController::readAnimPlay(ActorList& actorList)
|
|
|
|
{
|
|
|
|
std::string mapIndex = actorList.cell.getDescription();
|
|
|
|
|
|
|
|
initializeCell(actorList.cell);
|
|
|
|
|
|
|
|
// If this now exists, send it the data
|
2017-04-23 13:53:24 +00:00
|
|
|
if (cellsInitialized.count(mapIndex) > 0)
|
|
|
|
cellsInitialized[mapIndex]->readAnimPlay(actorList);
|
2017-04-15 10:42:30 +00:00
|
|
|
}
|
|
|
|
|
2017-04-16 13:42:07 +00:00
|
|
|
void CellController::readStatsDynamic(ActorList& actorList)
|
|
|
|
{
|
|
|
|
std::string mapIndex = actorList.cell.getDescription();
|
|
|
|
|
|
|
|
initializeCell(actorList.cell);
|
|
|
|
|
|
|
|
// If this now exists, send it the data
|
2017-04-23 13:53:24 +00:00
|
|
|
if (cellsInitialized.count(mapIndex) > 0)
|
|
|
|
cellsInitialized[mapIndex]->readStatsDynamic(actorList);
|
2017-04-16 13:42:07 +00:00
|
|
|
}
|
|
|
|
|
2017-05-26 01:37:49 +00:00
|
|
|
void CellController::readEquipment(ActorList& actorList)
|
|
|
|
{
|
|
|
|
std::string mapIndex = actorList.cell.getDescription();
|
|
|
|
|
|
|
|
initializeCell(actorList.cell);
|
|
|
|
|
|
|
|
// If this now exists, send it the data
|
|
|
|
if (cellsInitialized.count(mapIndex) > 0)
|
|
|
|
cellsInitialized[mapIndex]->readEquipment(actorList);
|
|
|
|
}
|
|
|
|
|
2017-04-16 15:43:13 +00:00
|
|
|
void CellController::readSpeech(ActorList& actorList)
|
|
|
|
{
|
|
|
|
std::string mapIndex = actorList.cell.getDescription();
|
|
|
|
|
|
|
|
initializeCell(actorList.cell);
|
|
|
|
|
|
|
|
// If this now exists, send it the data
|
2017-04-23 13:53:24 +00:00
|
|
|
if (cellsInitialized.count(mapIndex) > 0)
|
|
|
|
cellsInitialized[mapIndex]->readSpeech(actorList);
|
2017-04-16 15:43:13 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 19:10:06 +00:00
|
|
|
void CellController::readAttack(ActorList& actorList)
|
|
|
|
{
|
|
|
|
std::string mapIndex = actorList.cell.getDescription();
|
|
|
|
|
|
|
|
initializeCell(actorList.cell);
|
|
|
|
|
|
|
|
// If this now exists, send it the data
|
2017-04-23 13:53:24 +00:00
|
|
|
if (cellsInitialized.count(mapIndex) > 0)
|
|
|
|
cellsInitialized[mapIndex]->readAttack(actorList);
|
2017-04-19 19:10:06 +00:00
|
|
|
}
|
|
|
|
|
2017-04-23 10:59:15 +00:00
|
|
|
void CellController::readCellChange(ActorList& actorList)
|
|
|
|
{
|
|
|
|
std::string mapIndex = actorList.cell.getDescription();
|
|
|
|
|
|
|
|
initializeCell(actorList.cell);
|
|
|
|
|
|
|
|
// If this now exists, send it the data
|
2017-04-23 13:53:24 +00:00
|
|
|
if (cellsInitialized.count(mapIndex) > 0)
|
|
|
|
cellsInitialized[mapIndex]->readCellChange(actorList);
|
2017-04-23 10:59:15 +00:00
|
|
|
}
|
|
|
|
|
2017-04-07 05:12:50 +00:00
|
|
|
void CellController::setLocalActorRecord(std::string actorIndex, std::string cellIndex)
|
|
|
|
{
|
|
|
|
localActorsToCells[actorIndex] = cellIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CellController::removeLocalActorRecord(std::string actorIndex)
|
|
|
|
{
|
|
|
|
localActorsToCells.erase(actorIndex);
|
|
|
|
}
|
|
|
|
|
2017-04-08 11:31:22 +00:00
|
|
|
bool CellController::isLocalActor(MWWorld::Ptr ptr)
|
2017-04-07 05:12:50 +00:00
|
|
|
{
|
2017-06-27 14:49:28 +00:00
|
|
|
if (ptr.mRef == nullptr)
|
2017-04-19 15:20:12 +00:00
|
|
|
return false;
|
|
|
|
|
2017-04-07 05:12:50 +00:00
|
|
|
std::string mapIndex = generateMapIndex(ptr);
|
|
|
|
|
|
|
|
return (localActorsToCells.count(mapIndex) > 0);
|
|
|
|
}
|
|
|
|
|
2017-05-27 13:58:59 +00:00
|
|
|
bool CellController::isLocalActor(int refNumIndex, int mpNum)
|
2017-04-19 15:20:12 +00:00
|
|
|
{
|
2017-05-27 13:58:59 +00:00
|
|
|
std::string mapIndex = generateMapIndex(refNumIndex, mpNum);
|
2017-04-19 15:20:12 +00:00
|
|
|
return (localActorsToCells.count(mapIndex) > 0);
|
|
|
|
}
|
|
|
|
|
2017-04-07 07:16:23 +00:00
|
|
|
LocalActor *CellController::getLocalActor(MWWorld::Ptr ptr)
|
|
|
|
{
|
|
|
|
std::string actorIndex = generateMapIndex(ptr);
|
|
|
|
std::string cellIndex = localActorsToCells.at(actorIndex);
|
|
|
|
|
2017-04-23 13:53:24 +00:00
|
|
|
return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex);
|
2017-04-07 07:16:23 +00:00
|
|
|
}
|
|
|
|
|
2017-05-27 13:58:59 +00:00
|
|
|
LocalActor *CellController::getLocalActor(int refNumIndex, int mpNum)
|
2017-04-19 15:20:12 +00:00
|
|
|
{
|
2017-05-27 13:58:59 +00:00
|
|
|
std::string actorIndex = generateMapIndex(refNumIndex, mpNum);
|
2017-04-19 15:20:12 +00:00
|
|
|
std::string cellIndex = localActorsToCells.at(actorIndex);
|
|
|
|
|
2017-04-23 13:53:24 +00:00
|
|
|
return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex);
|
2017-04-19 15:20:12 +00:00
|
|
|
}
|
|
|
|
|
2017-04-08 04:46:33 +00:00
|
|
|
void CellController::setDedicatedActorRecord(std::string actorIndex, std::string cellIndex)
|
|
|
|
{
|
|
|
|
dedicatedActorsToCells[actorIndex] = cellIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CellController::removeDedicatedActorRecord(std::string actorIndex)
|
|
|
|
{
|
|
|
|
dedicatedActorsToCells.erase(actorIndex);
|
|
|
|
}
|
|
|
|
|
2017-05-27 13:58:59 +00:00
|
|
|
bool CellController::isDedicatedActor(int refNumIndex, int mpNum)
|
2017-04-19 15:20:12 +00:00
|
|
|
{
|
2017-05-27 13:58:59 +00:00
|
|
|
std::string mapIndex = generateMapIndex(refNumIndex, mpNum);
|
2017-04-19 15:20:12 +00:00
|
|
|
return (dedicatedActorsToCells.count(mapIndex) > 0);
|
|
|
|
}
|
|
|
|
|
2017-04-08 11:31:22 +00:00
|
|
|
bool CellController::isDedicatedActor(MWWorld::Ptr ptr)
|
2017-04-08 04:46:33 +00:00
|
|
|
{
|
2017-06-27 14:49:28 +00:00
|
|
|
if (ptr.mRef == nullptr)
|
2017-04-19 15:20:12 +00:00
|
|
|
return false;
|
|
|
|
|
2017-04-08 04:46:33 +00:00
|
|
|
std::string mapIndex = generateMapIndex(ptr);
|
|
|
|
|
|
|
|
return (dedicatedActorsToCells.count(mapIndex) > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
DedicatedActor *CellController::getDedicatedActor(MWWorld::Ptr ptr)
|
|
|
|
{
|
|
|
|
std::string actorIndex = generateMapIndex(ptr);
|
|
|
|
std::string cellIndex = dedicatedActorsToCells.at(actorIndex);
|
|
|
|
|
2017-04-23 13:53:24 +00:00
|
|
|
return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex);
|
2017-04-08 04:46:33 +00:00
|
|
|
}
|
|
|
|
|
2017-05-27 13:58:59 +00:00
|
|
|
DedicatedActor *CellController::getDedicatedActor(int refNumIndex, int mpNum)
|
2017-04-19 15:20:12 +00:00
|
|
|
{
|
2017-05-27 13:58:59 +00:00
|
|
|
std::string actorIndex = generateMapIndex(refNumIndex, mpNum);
|
2017-04-19 15:20:12 +00:00
|
|
|
std::string cellIndex = dedicatedActorsToCells.at(actorIndex);
|
|
|
|
|
2017-04-23 13:53:24 +00:00
|
|
|
return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex);
|
2017-04-19 15:20:12 +00:00
|
|
|
}
|
|
|
|
|
2017-05-27 13:58:59 +00:00
|
|
|
std::string CellController::generateMapIndex(int refNumIndex, int mpNum)
|
2017-04-07 05:12:50 +00:00
|
|
|
{
|
|
|
|
std::string mapIndex = "";
|
2017-05-27 18:20:24 +00:00
|
|
|
mapIndex = Utils::toString(refNumIndex) + "-" + Utils::toString(mpNum);
|
2017-04-07 05:12:50 +00:00
|
|
|
return mapIndex;
|
|
|
|
}
|
|
|
|
|
2017-04-19 15:20:12 +00:00
|
|
|
std::string CellController::generateMapIndex(MWWorld::Ptr ptr)
|
|
|
|
{
|
2017-05-27 13:58:59 +00:00
|
|
|
return generateMapIndex(ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum());
|
2017-04-19 15:20:12 +00:00
|
|
|
}
|
|
|
|
|
2017-04-09 13:32:44 +00:00
|
|
|
std::string CellController::generateMapIndex(BaseActor baseActor)
|
2017-04-07 05:12:50 +00:00
|
|
|
{
|
2017-05-27 13:58:59 +00:00
|
|
|
return generateMapIndex(baseActor.refNumIndex, baseActor.mpNum);
|
2017-04-07 05:12:50 +00:00
|
|
|
}
|
|
|
|
|
2017-05-04 23:46:16 +00:00
|
|
|
bool CellController::hasLocalAuthority(const ESM::Cell& cell)
|
|
|
|
{
|
|
|
|
if (isInitializedCell(cell) && isActiveWorldCell(cell))
|
|
|
|
return getCell(cell)->hasLocalAuthority();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-04-23 13:53:24 +00:00
|
|
|
bool CellController::isInitializedCell(const ESM::Cell& cell)
|
2017-02-26 23:02:59 +00:00
|
|
|
{
|
2017-04-23 13:53:24 +00:00
|
|
|
return (cellsInitialized.count(cell.getDescription()) > 0);
|
2017-04-10 15:13:22 +00:00
|
|
|
}
|
|
|
|
|
2017-04-23 14:12:45 +00:00
|
|
|
bool CellController::isActiveWorldCell(const ESM::Cell& cell)
|
|
|
|
{
|
|
|
|
MWWorld::CellStore *cellStore = getCellStore(cell);
|
|
|
|
|
|
|
|
if (!cellStore) return false;
|
|
|
|
|
|
|
|
return MWBase::Environment::get().getWorld()->isCellActive(cellStore);
|
|
|
|
}
|
|
|
|
|
2017-04-10 15:13:22 +00:00
|
|
|
Cell *CellController::getCell(const ESM::Cell& cell)
|
|
|
|
{
|
2017-04-23 13:53:24 +00:00
|
|
|
return cellsInitialized.at(cell.getDescription());
|
2017-02-26 23:02:59 +00:00
|
|
|
}
|
|
|
|
|
2017-04-10 14:30:57 +00:00
|
|
|
MWWorld::CellStore *CellController::getCellStore(const ESM::Cell& cell)
|
2016-11-15 17:13:36 +00:00
|
|
|
{
|
|
|
|
MWWorld::CellStore *cellStore;
|
|
|
|
|
|
|
|
if (cell.isExterior())
|
|
|
|
cellStore = MWBase::Environment::get().getWorld()->getExterior(cell.mData.mX, cell.mData.mY);
|
|
|
|
else
|
2016-11-15 17:51:05 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
cellStore = MWBase::Environment::get().getWorld()->getInterior(cell.mName);
|
|
|
|
}
|
|
|
|
catch (std::exception&)
|
|
|
|
{
|
2017-06-27 14:49:28 +00:00
|
|
|
cellStore = nullptr;
|
2016-11-15 17:51:05 +00:00
|
|
|
}
|
|
|
|
}
|
2016-11-15 17:13:36 +00:00
|
|
|
|
|
|
|
return cellStore;
|
|
|
|
}
|
2016-12-16 09:27:19 +00:00
|
|
|
|
2017-04-23 09:41:13 +00:00
|
|
|
bool CellController::isSameCell(const ESM::Cell& cell, const ESM::Cell& otherCell)
|
|
|
|
{
|
|
|
|
if (cell.isExterior() && otherCell.isExterior())
|
|
|
|
{
|
|
|
|
if (cell.mData.mX == otherCell.mData.mX && cell.mData.mY == otherCell.mData.mY)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (Misc::StringUtils::ciEqual(cell.mName, otherCell.mName))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2016-12-16 09:27:19 +00:00
|
|
|
|
2017-04-07 05:12:50 +00:00
|
|
|
void CellController::openContainer(const MWWorld::Ptr &container, bool loot)
|
2016-12-16 09:27:19 +00:00
|
|
|
{
|
2017-02-05 16:45:23 +00:00
|
|
|
// Record this as the player's current open container
|
2017-04-07 05:12:50 +00:00
|
|
|
Main::get().getLocalPlayer()->storeCurrentContainer(container, loot);
|
2017-02-05 16:45:23 +00:00
|
|
|
|
2017-06-27 13:56:40 +00:00
|
|
|
const auto &cellRef = container.getCellRef();
|
2017-01-19 11:08:24 +00:00
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is opened. Loot: %s",
|
2017-06-27 13:56:40 +00:00
|
|
|
cellRef.getRefId().c_str(), cellRef.getRefNum().mIndex, loot ? "true" : "false");
|
2016-12-16 09:27:19 +00:00
|
|
|
|
2017-06-27 14:27:02 +00:00
|
|
|
for (const auto &ptr : container.getClass().getContainerStore(container))
|
2016-12-16 09:27:19 +00:00
|
|
|
{
|
2017-06-27 13:56:40 +00:00
|
|
|
int count = ptr.getRefData().getCount();
|
|
|
|
const std::string &name = ptr.getCellRef().getRefId();
|
2016-12-16 09:27:19 +00:00
|
|
|
|
|
|
|
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d", name.c_str(), count);
|
|
|
|
|
2017-05-02 19:47:58 +00:00
|
|
|
/*if (::Misc::StringUtils::ciEqual(name, "gold_001"))
|
2016-12-16 09:27:19 +00:00
|
|
|
cont.remove("gold_001", count, container);*/
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-04-07 05:12:50 +00:00
|
|
|
void CellController::closeContainer(const MWWorld::Ptr &container)
|
2016-12-16 09:27:19 +00:00
|
|
|
{
|
2017-04-07 05:12:50 +00:00
|
|
|
Main::get().getLocalPlayer()->clearCurrentContainer();
|
2017-02-05 16:45:23 +00:00
|
|
|
|
2017-02-22 04:41:25 +00:00
|
|
|
// If the player died while in a container, the container's Ptr could be invalid now
|
|
|
|
if (!container.isEmpty())
|
2016-12-16 09:27:19 +00:00
|
|
|
{
|
2017-03-04 06:55:35 +00:00
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Container \"%s\" (%d) is closed.", container.getCellRef().getRefId().c_str(),
|
|
|
|
container.getCellRef().getRefNum().mIndex);
|
2017-02-22 04:41:25 +00:00
|
|
|
|
|
|
|
MWWorld::ContainerStore &cont = container.getClass().getContainerStore(container);
|
2017-06-27 14:27:02 +00:00
|
|
|
for (const auto &ptr : cont)
|
2017-02-22 04:41:25 +00:00
|
|
|
{
|
2017-06-27 13:56:40 +00:00
|
|
|
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d", ptr.getCellRef().getRefId().c_str(),
|
|
|
|
ptr.getRefData().getCount());
|
2017-02-22 04:41:25 +00:00
|
|
|
}
|
2016-12-16 09:27:19 +00:00
|
|
|
}
|
2017-02-22 04:41:25 +00:00
|
|
|
|
2017-04-07 05:12:50 +00:00
|
|
|
Main::get().getLocalPlayer()->updateInventory();
|
2016-12-16 09:27:19 +00:00
|
|
|
}
|
2017-04-10 15:13:22 +00:00
|
|
|
|
|
|
|
int CellController::getCellSize() const
|
|
|
|
{
|
|
|
|
return 8192;
|
|
|
|
}
|