[Client] Fix logic for mwmp::Cell initialization

0.6.1
David Cernat 8 years ago
parent 89a8ace41c
commit 3d6dc74bdc

@ -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;
mwmp::Cell *mpCell = new mwmp::Cell(cellStore);
// If this key doesn't exist, create it
if (cellsActive.count(mapIndex) == 0)
{
MWWorld::CellStore *cellStore = getCell(cell);
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Initialized mwmp::Cell %s", mpCell->getDescription().c_str());
if (!cellStore) return;
mpCell->initializeLocalActors();
mwmp::Cell *mpCell = new mwmp::Cell(cellStore);
cellsActive[mapIndex] = mpCell;
std::string mapIndex = mpCell->getDescription();
cellsActive[mapIndex] = mpCell;
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Initialized mwmp::Cell %s", mpCell->getDescription().c_str());
}
}
void CellController::readCellFrame(WorldEvent& worldEvent)
void CellController::initializeLocalActors(const ESM::Cell& cell)
{
std::string mapIndex = worldEvent.cell.getDescription();
std::string mapIndex = cell.getDescription();
// If this key doesn't exist, create it
if (cellsActive.count(mapIndex) == 0)
initializeCell(cell);
// If this now exists, initialize local actors in it
if (cellsActive.count(mapIndex) > 0)
{
MWWorld::CellStore *cellStore = getCell(worldEvent.cell);
cellsActive[mapIndex]->uninitializeDedicatedActors();
cellsActive[mapIndex]->initializeLocalActors();
}
}
if (!cellStore) return;
void CellController::readCellFrame(WorldEvent& worldEvent)
{
std::string mapIndex = worldEvent.cell.getDescription();
mwmp::Cell *mpCell = new mwmp::Cell(cellStore);
cellsActive[mapIndex] = mpCell;
}
initializeCell(worldEvent.cell);
// If this now exists, send it the data
if (cellsActive.count(mapIndex) > 0)

@ -19,7 +19,8 @@ namespace mwmp
void updateLocal();
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 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());
//Main::get().getCellController()->initializeCellLocal(worldEvent.cell);
//Main::get().getCellController()->initializeLocalActors(worldEvent.cell);
break;
}

Loading…
Cancel
Save