diff --git a/apps/openmw-mp/Script/Functions/Worldstate.cpp b/apps/openmw-mp/Script/Functions/Worldstate.cpp index ec7289d63..c76526f67 100644 --- a/apps/openmw-mp/Script/Functions/Worldstate.cpp +++ b/apps/openmw-mp/Script/Functions/Worldstate.cpp @@ -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 diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 46789332f..b3267da54 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -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 *cells) = 0; - /* - End of tes3mp addition - */ - virtual void getActorsStandingOn (const MWWorld::ConstPtr& object, std::vector &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 diff --git a/apps/openmw/mwmp/processors/worldstate/ProcessorCellReset.hpp b/apps/openmw/mwmp/processors/worldstate/ProcessorCellReset.hpp index b732d4f6b..76cf12c92 100644 --- a/apps/openmw/mwmp/processors/worldstate/ProcessorCellReset.hpp +++ b/apps/openmw/mwmp/processors/worldstate/ProcessorCellReset.hpp @@ -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); } }; } diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 0ced6fe11..7cb87541f 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -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 CellStore::getMovedHere() - { - std::vector 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(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>::iterator ref = mCreatures.mList.begin(); ref != mCreatures.mList.end(); ref++) - { - if (!cellController->isDedicatedActor(MWWorld::Ptr(&*ref, this))) - { - mCreatures.mList.erase(ref); - } - } - - for (std::list>::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 - */ } diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 05199de13..c132d3b92 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -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 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 diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index e25c033f9..3764f2260 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -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 * 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 returnPtr; - std::map 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 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(); diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index c5fe0274a..8a00ea165 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -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 * cells) override; - /* - End of tes3mp addition - */ - /* Start of tes3mp addition