forked from mirror/openmw-tes3mp
[Client] Fix logic for mwmp::Cell initialization
This commit is contained in:
parent
89a8ace41c
commit
3d6dc74bdc
3 changed files with 28 additions and 20 deletions
|
@ -55,36 +55,43 @@ void CellController::updateDedicated(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellController::initializeCellLocal(const ESM::Cell& cell)
|
void CellController::initializeCell(const ESM::Cell& cell)
|
||||||
{
|
{
|
||||||
MWWorld::CellStore *cellStore = getCell(cell);
|
std::string mapIndex = cell.getDescription();
|
||||||
|
|
||||||
if (!cellStore) return;
|
// If this key doesn't exist, create it
|
||||||
|
if (cellsActive.count(mapIndex) == 0)
|
||||||
|
{
|
||||||
|
MWWorld::CellStore *cellStore = getCell(cell);
|
||||||
|
|
||||||
mwmp::Cell *mpCell = new mwmp::Cell(cellStore);
|
if (!cellStore) return;
|
||||||
|
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Initialized mwmp::Cell %s", mpCell->getDescription().c_str());
|
mwmp::Cell *mpCell = new mwmp::Cell(cellStore);
|
||||||
|
cellsActive[mapIndex] = mpCell;
|
||||||
|
|
||||||
mpCell->initializeLocalActors();
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Initialized mwmp::Cell %s", mpCell->getDescription().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string mapIndex = mpCell->getDescription();
|
void CellController::initializeLocalActors(const ESM::Cell& cell)
|
||||||
cellsActive[mapIndex] = mpCell;
|
{
|
||||||
|
std::string mapIndex = cell.getDescription();
|
||||||
|
|
||||||
|
initializeCell(cell);
|
||||||
|
|
||||||
|
// If this now exists, initialize local actors in it
|
||||||
|
if (cellsActive.count(mapIndex) > 0)
|
||||||
|
{
|
||||||
|
cellsActive[mapIndex]->uninitializeDedicatedActors();
|
||||||
|
cellsActive[mapIndex]->initializeLocalActors();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellController::readCellFrame(WorldEvent& worldEvent)
|
void CellController::readCellFrame(WorldEvent& worldEvent)
|
||||||
{
|
{
|
||||||
std::string mapIndex = worldEvent.cell.getDescription();
|
std::string mapIndex = worldEvent.cell.getDescription();
|
||||||
|
|
||||||
// If this key doesn't exist, create it
|
initializeCell(worldEvent.cell);
|
||||||
if (cellsActive.count(mapIndex) == 0)
|
|
||||||
{
|
|
||||||
MWWorld::CellStore *cellStore = getCell(worldEvent.cell);
|
|
||||||
|
|
||||||
if (!cellStore) return;
|
|
||||||
|
|
||||||
mwmp::Cell *mpCell = new mwmp::Cell(cellStore);
|
|
||||||
cellsActive[mapIndex] = mpCell;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this now exists, send it the data
|
// If this now exists, send it the data
|
||||||
if (cellsActive.count(mapIndex) > 0)
|
if (cellsActive.count(mapIndex) > 0)
|
||||||
|
|
|
@ -19,7 +19,8 @@ namespace mwmp
|
||||||
void updateLocal();
|
void updateLocal();
|
||||||
void updateDedicated(float dt);
|
void updateDedicated(float dt);
|
||||||
|
|
||||||
void initializeCellLocal(const ESM::Cell& cell);
|
void initializeCell(const ESM::Cell& cell);
|
||||||
|
void initializeLocalActors(const ESM::Cell& cell);
|
||||||
void readCellFrame(mwmp::WorldEvent& worldEvent);
|
void readCellFrame(mwmp::WorldEvent& worldEvent);
|
||||||
|
|
||||||
void setLocalActorRecord(std::string actorIndex, std::string cellIndex);
|
void setLocalActorRecord(std::string actorIndex, std::string cellIndex);
|
||||||
|
|
|
@ -859,7 +859,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||||
{
|
{
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received ID_ACTOR_AUTHORITY about %s", worldEvent.cell.getDescription().c_str());
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received ID_ACTOR_AUTHORITY about %s", worldEvent.cell.getDescription().c_str());
|
||||||
|
|
||||||
//Main::get().getCellController()->initializeCellLocal(worldEvent.cell);
|
//Main::get().getCellController()->initializeLocalActors(worldEvent.cell);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue