[Client] Remove urm's broken (by his own admission) cell reset attempt

pull/593/head
David Cernat 4 years ago
parent c6852f49ba
commit fc26e9bbc1

@ -448,22 +448,6 @@ void WorldstateFunctions::SendCellReset(unsigned short pid, bool sendToOtherPlay
{
packet->Send(false);
}
CellController * cellController = CellController::get();
for (ESM::Cell cell : writeWorldstate.cellsToReset)
{
if (sendToOtherPlayers)
{
TPlayers * players = Players::getPlayers();
for (TPlayers::iterator iter = players->begin(); iter != players->end(); iter++)
{
cellController->getCell(&cell)->removePlayer((*iter).second, true);
}
}
else
cellController->getCell(&cell)->removePlayer(Players::getPlayer(pid), true);
}
}
void WorldstateFunctions::SendWorldDestinationOverride(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept

@ -597,16 +597,6 @@ namespace MWBase
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to reload active cells (e.g. for CellReset)
*/
virtual void reloadCells(std::vector<ESM::Cell> *cells) = 0;
/*
End of tes3mp addition
*/
virtual void getActorsStandingOn (const MWWorld::ConstPtr& object, std::vector<MWWorld::Ptr> &actors) = 0; ///< get a list of actors standing on \a object
virtual bool getPlayerStandingOn (const MWWorld::ConstPtr& object) = 0; ///< @return true if the player is standing on \a object
virtual bool getActorStandingOn (const MWWorld::ConstPtr& object) = 0; ///< @return true if any actor is standing on \a object

@ -21,14 +21,7 @@ namespace mwmp
CellController* cellController = Main::get().getCellController();
MWBase::World * world = MWBase::Environment::get().getWorld();
world->reloadCells(&worldstate.cellsToReset);
/*for (ESM::Cell cell : worldstate.cellsToReset)
{
Main::get().getLocalPlayer()->storeCellState(cell, CellState::LOAD);
}
Main::get().getLocalPlayer()->sendCellStates();
Main::get().getLocalPlayer()->clearCellStates();*/
//world->reloadCells(&worldstate.cellsToReset);
}
};
}

@ -635,41 +635,6 @@ namespace MWWorld
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to get mMovedHere in the CellStore from elsewhere in the code
*/
std::vector<Ptr> CellStore::getMovedHere()
{
std::vector<Ptr> hereVector;
for (CellStore::MovedRefTracker::iterator iter = mMovedHere.begin(); iter != mMovedHere.end(); ++iter)
{
hereVector.push_back(Ptr(iter->first, iter->second));
}
return hereVector;
}
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to return all NPCs back to this cell from elsewhere in the code
*/
void CellStore::returnFromOtherCells()
{
for (CellStore::MovedRefTracker::iterator iter = mMovedToAnotherCell.begin(); iter != mMovedToAnotherCell.end(); ++iter)
{
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Returning actor from %d, %d!", iter->second->getCell()->getGridX(), iter->second->getCell()->getGridY());
iter->second->moveTo(iter->first, this);
}
}
/*
End of tes3mp addition
*/
float CellStore::getWaterLevel() const
{
if (isExterior())
@ -1365,66 +1330,4 @@ namespace MWWorld
|| enchantment->mData.mType == ESM::Enchantment::WhenStrikes)
mRechargingItems.emplace_back(ptr.getBase(), static_cast<float>(enchantment->mData.mCharge));
}
/*
Start of tes3mp addition
Make it possible to clear cell data (e.g. to reset cells)
*/
void CellStore::clear()
{
if (mState != State_Unloaded)
{
mState = State_Unloaded;
mIds.clear();
mActivators.mList.clear();
mPotions.mList.clear();
mAppas.mList.clear();
mArmors.mList.clear();
mBooks.mList.clear();
mClothes.mList.clear();
mContainers.mList.clear();
mDoors.mList.clear();
mIngreds.mList.clear();
mCreatureLists.mList.clear();
mItemLists.mList.clear();
mLights.mList.clear();
mLockpicks.mList.clear();
mMiscItems.mList.clear();
mProbes.mList.clear();
mRepairs.mList.clear();
mStatics.mList.clear();
mWeapons.mList.clear();
mBodyParts.mList.clear();
mwmp::CellController * cellController = mwmp::Main::get().getCellController();
for (std::list<LiveCellRef<ESM::Creature>>::iterator ref = mCreatures.mList.begin(); ref != mCreatures.mList.end(); ref++)
{
if (!cellController->isDedicatedActor(MWWorld::Ptr(&*ref, this)))
{
mCreatures.mList.erase(ref);
}
}
for (std::list<LiveCellRef<ESM::NPC>>::iterator ref = mNpcs.mList.begin(); ref != mNpcs.mList.end(); ref++)
{
if (!cellController->isDedicatedActor(MWWorld::Ptr(&*ref, this)))
{
mNpcs.mList.erase(ref);
}
}
mMovedHere.clear();
mMovedToAnotherCell.clear();
mMergedRefs.clear();
mFogState = NULL;
}
}
/*
End of tes3mp addition
*/
}

@ -308,26 +308,6 @@ namespace MWWorld
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to get the mContainers in the CellStore from elsewhere in the code
*/
std::vector<Ptr> getMovedHere();
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to get mMovedHere in the CellStore from elsewhere in the code
*/
void returnFromOtherCells();
/*
End of tes3mp addition
*/
float getWaterLevel() const;
bool movedHere(const MWWorld::Ptr& ptr) const;
@ -477,16 +457,6 @@ namespace MWWorld
void respawn ();
///< Check mLastRespawn and respawn references if necessary. This is a no-op if the cell is not loaded.
/*
Start of tes3mp addition
Make it possible to clear cell data (e.g. to reset cells).
*/
void clear ();
/*
End of tes3mp addition
*/
private:
/// Run through references and store IDs

@ -2931,87 +2931,6 @@ namespace MWWorld
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to reload active cells (e.g. for CellReset)
*/
void World::reloadCells(std::vector<ESM::Cell> * cells)
{
mwmp::CellController* cellController = mwmp::Main::get().getCellController();
MWWorld::Scene::CellStoreCollection activeCells = (*mWorldScene).getActiveCells();
MWWorld::Scene::CellStoreCollection activeToReset;
for (MWWorld::Scene::CellStoreCollection::iterator iter = activeCells.begin(); iter != activeCells.end(); iter++)
{
ESM::Cell iterCell = *(*iter)->getCell();
for (ESM::Cell cell : *cells)
{
if (cellController->isSameCell(iterCell, cell))
{
activeToReset.insert(*iter);
break;
}
}
}
if (!activeToReset.empty())
{
typedef std::pair<Ptr, CellStore*> returnPtr;
std::map<Ptr, CellStore*> moveBack;
for (MWWorld::Scene::CellStoreCollection::iterator iter = activeToReset.begin(); iter != activeToReset.end(); iter++)
{
ESM::Cell iterCell = *(*iter)->getCell();
MWWorld::CellStore * cellStore = cellController->getCellStore(iterCell);
cellStore->returnFromOtherCells();
std::vector<Ptr> movedRefs = cellStore->getMovedHere();
for (Ptr ref : movedRefs)
{
moveBack.insert(returnPtr(ref, cellStore));
}
}
for (MWWorld::Scene::CellStoreCollection::iterator iter = activeCells.begin(); iter != activeCells.end(); iter++)
{
ESM::Cell iterCell = *(*iter)->getCell();
MWWorld::CellStore * cellStore = cellController->getCellStore(iterCell);
mWorldScene->unloadCell(iter);
cellController->getCell(iterCell)->uninitializeLocalActors();
cellController->getCell(iterCell)->uninitializeDedicatedActors();
if (activeToReset.count(*iter) > 0)
{
cellStore->clear();
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Resetting cell %s!", iterCell.getDescription().c_str());
}
}
ESM::CellId pCellId = getPlayerPtr().getCell()->getCell()->getCellId();
changeToCell(pCellId, getPlayerPtr().getRefData().getPosition(), false, true);
for (returnPtr ret : moveBack)
{
ret.first.getCell()->moveTo(ret.first, ret.second);
cellController->getCell(*ret.second->getCell())->initializeDedicatedActor(ret.first);
}
}
else
{
for (ESM::Cell cell : *cells)
{
MWWorld::CellStore * cellStore = cellController->getCellStore(cell);
cellStore->clear();
}
}
}
/*
End of tes3mp addition
*/
bool World::getPlayerStandingOn (const MWWorld::ConstPtr& object)
{
MWWorld::Ptr player = getPlayerPtr();

@ -681,16 +681,6 @@ namespace MWWorld
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to reload active cells (e.g. for CellReset)
*/
void reloadCells(std::vector<ESM::Cell> * cells) override;
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition

Loading…
Cancel
Save