1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-12 09:39:58 +00:00

Rename MWWorld::Cells -> WorldModel

This commit is contained in:
Petr Mikheev 2022-12-06 00:11:19 +01:00
parent 4daac2b816
commit ac6303a83a
12 changed files with 48 additions and 48 deletions

View File

@ -74,7 +74,7 @@ add_openmw_dir (mwsound
add_openmw_dir (mwworld
refdata worldimp scene globals class action nullaction actionteleport
containerstore actiontalk actiontake manualref player cellvisitors failedaction
cells localscripts customdata inventorystore ptr actionopen actionread actionharvest
worldmodel localscripts customdata inventorystore ptr actionopen actionread actionharvest
actionequip timestamp actionalchemy cellstore actionapply actioneat
store esmstore fallback actionrepair actionsoulgem livecellref actiondoor
contentloader esmloader actiontrap cellreflist cellref weather projectilemanager

View File

@ -17,7 +17,7 @@ namespace l10n
namespace MWWorld
{
class Cells;
class WorldModel;
class Scene;
}
@ -43,7 +43,7 @@ namespace MWBase
static Environment* sThis;
World* mWorld = nullptr;
MWWorld::Cells* mWorldModel = nullptr; // TODO: rename Cells -> WorldModel
MWWorld::WorldModel* mWorldModel = nullptr;
MWWorld::Scene* mWorldScene = nullptr;
SoundManager* mSoundManager = nullptr;
ScriptManager* mScriptManager = nullptr;
@ -69,7 +69,7 @@ namespace MWBase
Environment& operator=(const Environment&) = delete;
void setWorld(World& value) { mWorld = &value; }
void setWorldModel(MWWorld::Cells& value) { mWorldModel = &value; }
void setWorldModel(MWWorld::WorldModel& value) { mWorldModel = &value; }
void setWorldScene(MWWorld::Scene& value) { mWorldScene = &value; }
void setSoundManager(SoundManager& value) { mSoundManager = &value; }
@ -95,7 +95,7 @@ namespace MWBase
void setL10nManager(l10n::Manager& value) { mL10nManager = &value; }
Misc::NotNullPtr<World> getWorld() const { return mWorld; }
Misc::NotNullPtr<MWWorld::Cells> getWorldModel() const { return mWorldModel; }
Misc::NotNullPtr<MWWorld::WorldModel> getWorldModel() const { return mWorldModel; }
Misc::NotNullPtr<MWWorld::Scene> getWorldScene() const { return mWorldScene; }
Misc::NotNullPtr<SoundManager> getSoundManager() const { return mSoundManager; }

View File

@ -22,11 +22,11 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/cells.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/cellutils.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/worldmodel.hpp"
#include "../mwrender/globalmap.hpp"
#include "../mwrender/localmap.hpp"
@ -626,7 +626,7 @@ namespace MWGui
{
std::vector<MWBase::World::DoorMarker> doors;
MWBase::World* world = MWBase::Environment::get().getWorld();
MWWorld::Cells* worldModel = MWBase::Environment::get().getWorldModel();
MWWorld::WorldModel* worldModel = MWBase::Environment::get().getWorldModel();
mDoorMarkersToRecycle.insert(
mDoorMarkersToRecycle.end(), mInteriorDoorMarkerWidgets.begin(), mInteriorDoorMarkerWidgets.end());

View File

@ -13,13 +13,13 @@
#include "../mwbase/world.hpp"
#include "../mwworld/actionteleport.hpp"
#include "../mwworld/cells.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/cellutils.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/store.hpp"
#include "../mwworld/worldmodel.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwmechanics/creaturestats.hpp"

View File

@ -8,10 +8,10 @@
#include "../mwclass/container.hpp"
#include "../mwworld/cells.hpp"
#include "../mwworld/cellutils.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/timestamp.hpp"
#include "../mwworld/worldmodel.hpp"
namespace MWLua
{
@ -127,7 +127,7 @@ namespace MWLua
// sections.
MWWorld::CellStore* WorldView::findCell(const std::string& name, osg::Vec3f position)
{
MWWorld::Cells* cells = MWBase::Environment::get().getWorldModel();
MWWorld::WorldModel* cells = MWBase::Environment::get().getWorldModel();
bool exterior = name.empty() || MWBase::Environment::get().getWorld()->getExterior(name);
if (exterior)
{
@ -140,7 +140,7 @@ namespace MWLua
MWWorld::CellStore* WorldView::findNamedCell(const std::string& name)
{
MWWorld::Cells* cells = MWBase::Environment::get().getWorldModel();
MWWorld::WorldModel* cells = MWBase::Environment::get().getWorldModel();
const ESM::Cell* esmCell = MWBase::Environment::get().getWorld()->getExterior(name);
if (esmCell)
return cells->getExterior(esmCell->getGridX(), esmCell->getGridY());

View File

@ -13,13 +13,13 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/cells.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/cellutils.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/manualref.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/scene.hpp"
#include "../mwworld/worldmodel.hpp"
#include "../mwmechanics/actorutil.hpp"

View File

@ -30,11 +30,11 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/cells.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/scene.hpp"
#include "../mwworld/worldmodel.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwmechanics/npcstats.hpp"

View File

@ -8,10 +8,10 @@
#include "../mwmechanics/creaturestats.hpp"
#include "../mwworld/cells.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/cellutils.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/worldmodel.hpp"
#include "player.hpp"
@ -43,7 +43,7 @@ namespace MWWorld
void ActionTeleport::teleport(const Ptr& actor)
{
MWBase::World* world = MWBase::Environment::get().getWorld();
MWWorld::Cells* worldModel = MWBase::Environment::get().getWorldModel();
MWWorld::WorldModel* worldModel = MWBase::Environment::get().getWorldModel();
actor.getClass().getCreatureStats(actor).land(actor == world->getPlayerPtr());
if (actor == world->getPlayerPtr())
{

View File

@ -12,10 +12,10 @@
#include <components/esm3/player.hpp>
#include <components/fallback/fallback.hpp>
#include "../mwworld/cells.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/magiceffects.hpp"
#include "../mwworld/worldmodel.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp"

View File

@ -10,7 +10,6 @@
#include "../mwbase/world.hpp"
#include "cells.hpp"
#include "contentloader.hpp"
#include "esmstore.hpp"
#include "globals.hpp"
@ -19,6 +18,7 @@
#include "ptr.hpp"
#include "scene.hpp"
#include "timestamp.hpp"
#include "worldmodel.hpp"
namespace osg
{
@ -90,7 +90,7 @@ namespace MWWorld
LocalScripts mLocalScripts;
MWWorld::Globals mGlobalVariables;
Misc::Rng::Generator mPrng;
Cells mCells;
WorldModel mCells;
std::vector<int> mESMVersions; // the versions of esm files
std::string mCurrentWorldSpace;
@ -188,7 +188,7 @@ namespace MWWorld
MWWorld::ConstPtr getClosestMarkerFromExteriorPosition(const osg::Vec3f& worldPos, std::string_view id);
public:
Cells& getWorldModel() { return mCells; }
WorldModel& getWorldModel() { return mCells; }
Scene& getWorldScene() { return *mWorldScene; }
// FIXME

View File

@ -1,4 +1,4 @@
#include "cells.hpp"
#include "worldmodel.hpp"
#include <components/debug/debuglog.hpp>
#include <components/esm/defs.hpp>
@ -58,7 +58,7 @@ namespace
};
}
MWWorld::CellStore* MWWorld::Cells::getCellStore(const ESM::Cell* cell)
MWWorld::CellStore* MWWorld::WorldModel::getCellStore(const ESM::Cell* cell)
{
if (cell->mData.mFlags & ESM::Cell::Interior)
{
@ -84,7 +84,7 @@ MWWorld::CellStore* MWWorld::Cells::getCellStore(const ESM::Cell* cell)
}
}
void MWWorld::Cells::clear()
void MWWorld::WorldModel::clear()
{
mInteriors.clear();
mExteriors.clear();
@ -92,7 +92,7 @@ void MWWorld::Cells::clear()
mIdCacheIndex = 0;
}
MWWorld::Ptr MWWorld::Cells::getPtrAndCache(std::string_view name, CellStore& cellStore)
MWWorld::Ptr MWWorld::WorldModel::getPtrAndCache(std::string_view name, CellStore& cellStore)
{
Ptr ptr = getPtr(name, cellStore);
@ -107,7 +107,7 @@ MWWorld::Ptr MWWorld::Cells::getPtrAndCache(std::string_view name, CellStore& ce
return ptr;
}
void MWWorld::Cells::writeCell(ESM::ESMWriter& writer, CellStore& cell) const
void MWWorld::WorldModel::writeCell(ESM::ESMWriter& writer, CellStore& cell) const
{
if (cell.getState() != CellStore::State_Loaded)
cell.load();
@ -124,7 +124,7 @@ void MWWorld::Cells::writeCell(ESM::ESMWriter& writer, CellStore& cell) const
writer.endRecord(ESM::REC_CSTA);
}
MWWorld::Cells::Cells(const MWWorld::ESMStore& store, ESM::ReadersCache& readers)
MWWorld::WorldModel::WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCache& readers)
: mStore(store)
, mReaders(readers)
, mIdCacheIndex(0)
@ -133,7 +133,7 @@ MWWorld::Cells::Cells(const MWWorld::ESMStore& store, ESM::ReadersCache& readers
mIdCache = IdCache(cacheSize, std::pair<std::string, CellStore*>("", (CellStore*)nullptr));
}
MWWorld::CellStore* MWWorld::Cells::getExterior(int x, int y)
MWWorld::CellStore* MWWorld::WorldModel::getExterior(int x, int y)
{
std::map<std::pair<int, int>, CellStore>::iterator result = mExteriors.find(std::make_pair(x, y));
@ -170,7 +170,7 @@ MWWorld::CellStore* MWWorld::Cells::getExterior(int x, int y)
return &result->second;
}
MWWorld::CellStore* MWWorld::Cells::getInterior(std::string_view name)
MWWorld::CellStore* MWWorld::WorldModel::getInterior(std::string_view name)
{
std::string lowerName = Misc::StringUtils::lowerCase(name);
std::map<std::string, CellStore>::iterator result = mInteriors.find(lowerName);
@ -190,7 +190,7 @@ MWWorld::CellStore* MWWorld::Cells::getInterior(std::string_view name)
return &result->second;
}
void MWWorld::Cells::rest(double hours)
void MWWorld::WorldModel::rest(double hours)
{
for (auto& interior : mInteriors)
{
@ -203,7 +203,7 @@ void MWWorld::Cells::rest(double hours)
}
}
void MWWorld::Cells::recharge(float duration)
void MWWorld::WorldModel::recharge(float duration)
{
for (auto& interior : mInteriors)
{
@ -216,7 +216,7 @@ void MWWorld::Cells::recharge(float duration)
}
}
MWWorld::CellStore* MWWorld::Cells::getCell(const ESM::CellId& id)
MWWorld::CellStore* MWWorld::WorldModel::getCell(const ESM::CellId& id)
{
if (id.mPaged)
return getExterior(id.mIndex.mX, id.mIndex.mY);
@ -224,7 +224,7 @@ MWWorld::CellStore* MWWorld::Cells::getCell(const ESM::CellId& id)
return getInterior(id.mWorldspace);
}
MWWorld::Ptr MWWorld::Cells::getPtr(std::string_view name, CellStore& cell, bool searchInContainers)
MWWorld::Ptr MWWorld::WorldModel::getPtr(std::string_view name, CellStore& cell, bool searchInContainers)
{
if (cell.getState() == CellStore::State_Unloaded)
cell.preload();
@ -250,7 +250,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr(std::string_view name, CellStore& cell, bool
return Ptr();
}
MWWorld::Ptr MWWorld::Cells::getPtr(const std::string& name)
MWWorld::Ptr MWWorld::WorldModel::getPtr(const std::string& name)
{
// First check the cache
for (IdCache::iterator iter(mIdCache.begin()); iter != mIdCache.end(); ++iter)
@ -307,7 +307,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr(const std::string& name)
return Ptr();
}
MWWorld::Ptr MWWorld::Cells::getPtr(const std::string& id, const ESM::RefNum& refNum)
MWWorld::Ptr MWWorld::WorldModel::getPtr(const std::string& id, const ESM::RefNum& refNum)
{
for (auto& pair : mInteriors)
{
@ -324,7 +324,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr(const std::string& id, const ESM::RefNum& re
return Ptr();
}
MWWorld::Ptr MWWorld::Cells::getPtr(CellStore& cellStore, const std::string& id, const ESM::RefNum& refNum)
MWWorld::Ptr MWWorld::WorldModel::getPtr(CellStore& cellStore, const std::string& id, const ESM::RefNum& refNum)
{
if (cellStore.getState() == CellStore::State_Unloaded)
cellStore.preload();
@ -338,7 +338,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr(CellStore& cellStore, const std::string& id,
return cellStore.searchViaRefNum(refNum);
}
void MWWorld::Cells::getExteriorPtrs(std::string_view name, std::vector<MWWorld::Ptr>& out)
void MWWorld::WorldModel::getExteriorPtrs(std::string_view name, std::vector<MWWorld::Ptr>& out)
{
const MWWorld::Store<ESM::Cell>& cells = mStore.get<ESM::Cell>();
for (MWWorld::Store<ESM::Cell>::iterator iter = cells.extBegin(); iter != cells.extEnd(); ++iter)
@ -352,7 +352,7 @@ void MWWorld::Cells::getExteriorPtrs(std::string_view name, std::vector<MWWorld:
}
}
void MWWorld::Cells::getInteriorPtrs(const std::string& name, std::vector<MWWorld::Ptr>& out)
void MWWorld::WorldModel::getInteriorPtrs(const std::string& name, std::vector<MWWorld::Ptr>& out)
{
const MWWorld::Store<ESM::Cell>& cells = mStore.get<ESM::Cell>();
for (MWWorld::Store<ESM::Cell>::iterator iter = cells.intBegin(); iter != cells.intEnd(); ++iter)
@ -366,7 +366,7 @@ void MWWorld::Cells::getInteriorPtrs(const std::string& name, std::vector<MWWorl
}
}
std::vector<MWWorld::Ptr> MWWorld::Cells::getAll(const std::string& id)
std::vector<MWWorld::Ptr> MWWorld::WorldModel::getAll(const std::string& id)
{
PtrCollector visitor;
if (forEachInStore(id, visitor, mInteriors))
@ -374,7 +374,7 @@ std::vector<MWWorld::Ptr> MWWorld::Cells::getAll(const std::string& id)
return visitor.mPtrs;
}
int MWWorld::Cells::countSavedGameRecords() const
int MWWorld::WorldModel::countSavedGameRecords() const
{
int count = 0;
@ -390,7 +390,7 @@ int MWWorld::Cells::countSavedGameRecords() const
return count;
}
void MWWorld::Cells::write(ESM::ESMWriter& writer, Loading::Listener& progress) const
void MWWorld::WorldModel::write(ESM::ESMWriter& writer, Loading::Listener& progress) const
{
for (std::map<std::pair<int, int>, CellStore>::iterator iter(mExteriors.begin()); iter != mExteriors.end(); ++iter)
if (iter->second.hasState())
@ -410,12 +410,12 @@ void MWWorld::Cells::write(ESM::ESMWriter& writer, Loading::Listener& progress)
struct GetCellStoreCallback : public MWWorld::CellStore::GetCellStoreCallback
{
public:
GetCellStoreCallback(MWWorld::Cells& cells)
GetCellStoreCallback(MWWorld::WorldModel& cells)
: mCells(cells)
{
}
MWWorld::Cells& mCells;
MWWorld::WorldModel& mCells;
MWWorld::CellStore* getCellStore(const ESM::CellId& cellId) override
{
@ -430,7 +430,7 @@ public:
}
};
bool MWWorld::Cells::readRecord(ESM::ESMReader& reader, uint32_t type, const std::map<int, int>& contentFileMap)
bool MWWorld::WorldModel::readRecord(ESM::ESMReader& reader, uint32_t type, const std::map<int, int>& contentFileMap)
{
if (type == ESM::REC_CSTA)
{

View File

@ -1,5 +1,5 @@
#ifndef GAME_MWWORLD_CELLS_H
#define GAME_MWWORLD_CELLS_H
#ifndef GAME_MWWORLD_WORLDMODEL_H
#define GAME_MWWORLD_WORLDMODEL_H
#include <list>
#include <map>
@ -27,7 +27,7 @@ namespace MWWorld
class ESMStore;
/// \brief Cell container
class Cells
class WorldModel
{
typedef std::vector<std::pair<std::string, CellStore*>> IdCache;
const MWWorld::ESMStore& mStore;
@ -37,8 +37,8 @@ namespace MWWorld
IdCache mIdCache;
std::size_t mIdCacheIndex;
Cells(const Cells&);
Cells& operator=(const Cells&);
WorldModel(const WorldModel&);
WorldModel& operator=(const WorldModel&);
CellStore* getCellStore(const ESM::Cell* cell);
@ -51,7 +51,7 @@ namespace MWWorld
public:
void clear();
explicit Cells(const MWWorld::ESMStore& store, ESM::ReadersCache& reader);
explicit WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCache& reader);
CellStore* getExterior(int x, int y);