mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
removed indirection in OpenMW-CS land record
This commit is contained in:
parent
69b9eadb52
commit
85f6bb892b
8 changed files with 29 additions and 40 deletions
|
@ -416,16 +416,16 @@ void CSMDoc::WriteLandCollectionStage::perform (int stage, Messages& messages)
|
|||
if (land.mState==CSMWorld::RecordBase::State_Modified ||
|
||||
land.mState==CSMWorld::RecordBase::State_ModifiedOnly)
|
||||
{
|
||||
CSMWorld::Land record = land.get();
|
||||
const CSMWorld::Land& record = land.get();
|
||||
|
||||
mState.getWriter().startRecord (record.mLand->sRecordId);
|
||||
mState.getWriter().startRecord (record.sRecordId);
|
||||
|
||||
record.mLand->save (mState.getWriter());
|
||||
record.save (mState.getWriter());
|
||||
|
||||
if (const ESM::Land::LandData *data = record.mLand->getLandData (record.mLand->mDataTypes))
|
||||
if (const ESM::Land::LandData *data = record.getLandData (record.mDataTypes))
|
||||
data->save (mState.getWriter());
|
||||
|
||||
mState.getWriter().endRecord (record.mLand->sRecordId);
|
||||
mState.getWriter().endRecord (record.sRecordId);
|
||||
}
|
||||
else if (land.mState==CSMWorld::RecordBase::State_Deleted)
|
||||
{
|
||||
|
|
|
@ -124,7 +124,7 @@ void CSMTools::ListLandTexturesMergeStage::perform (int stage, CSMDoc::Messages&
|
|||
|
||||
if (!record.isDeleted())
|
||||
{
|
||||
ESM::Land& land = *record.get().mLand;
|
||||
const ESM::Land& land = record.get();
|
||||
|
||||
// make sure record is loaded
|
||||
land.loadData (ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML |
|
||||
|
|
|
@ -773,6 +773,11 @@ const CSMWorld::IdCollection<CSMWorld::Land>& CSMWorld::Data::getLand() const
|
|||
return mLand;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<CSMWorld::Land>& CSMWorld::Data::getLand()
|
||||
{
|
||||
return mLand;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<CSMWorld::LandTexture>& CSMWorld::Data::getLandTextures() const
|
||||
{
|
||||
return mLandTextures;
|
||||
|
@ -951,7 +956,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages)
|
|||
int index = mLand.load(*mReader, mBase);
|
||||
|
||||
if (index!=-1 && !mBase)
|
||||
mLand.getRecord (index).mModified.mLand->loadData (
|
||||
mLand.getRecord (index).mModified.loadData (
|
||||
ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR |
|
||||
ESM::Land::DATA_VTEX | ESM::Land::DATA_WNAM);
|
||||
|
||||
|
|
|
@ -232,6 +232,8 @@ namespace CSMWorld
|
|||
|
||||
const IdCollection<CSMWorld::Land>& getLand() const;
|
||||
|
||||
IdCollection<CSMWorld::Land>& getLand();
|
||||
|
||||
const IdCollection<CSMWorld::LandTexture>& getLandTextures() const;
|
||||
|
||||
IdCollection<CSMWorld::LandTexture>& getLandTextures();
|
||||
|
|
|
@ -4,25 +4,13 @@
|
|||
|
||||
namespace CSMWorld
|
||||
{
|
||||
|
||||
Land::Land()
|
||||
{
|
||||
mLand.reset(new ESM::Land());
|
||||
}
|
||||
|
||||
void Land::load(ESM::ESMReader &esm)
|
||||
{
|
||||
mLand->load(esm);
|
||||
ESM::Land::load(esm);
|
||||
|
||||
std::ostringstream stream;
|
||||
stream << "#" << mLand->mX << " " << mLand->mY;
|
||||
stream << "#" << mX << " " << mY;
|
||||
|
||||
mId = stream.str();
|
||||
}
|
||||
|
||||
void Land::blank()
|
||||
{
|
||||
/// \todo
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define CSM_WORLD_LAND_H
|
||||
|
||||
#include <string>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <components/esm/loadland.hpp>
|
||||
|
||||
namespace CSMWorld
|
||||
|
@ -11,18 +11,12 @@ namespace CSMWorld
|
|||
///
|
||||
/// \todo Add worldspace support to the Land record.
|
||||
/// \todo Add a proper copy constructor (currently worked around using shared_ptr)
|
||||
struct Land
|
||||
struct Land : public ESM::Land
|
||||
{
|
||||
Land();
|
||||
|
||||
boost::shared_ptr<ESM::Land> mLand;
|
||||
|
||||
std::string mId;
|
||||
|
||||
/// Loads the metadata and ID
|
||||
void load (ESM::ESMReader &esm);
|
||||
|
||||
void blank();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ bool CSVRender::Cell::addObjects (int start, int end)
|
|||
bool modified = false;
|
||||
|
||||
const CSMWorld::RefCollection& collection = mData.getReferences();
|
||||
|
||||
|
||||
for (int i=start; i<=end; ++i)
|
||||
{
|
||||
std::string cell = Misc::StringUtils::lowerCase (collection.getRecord (i).get().mCell);
|
||||
|
@ -68,15 +68,16 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::st
|
|||
int landIndex = land.searchId(mId);
|
||||
if (landIndex != -1)
|
||||
{
|
||||
const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
|
||||
if(esmLand && esmLand->mDataTypes&ESM::Land::DATA_VHGT)
|
||||
const ESM::Land& esmLand = land.getRecord(mId).get();
|
||||
|
||||
if (esmLand.getLandData (ESM::Land::DATA_VHGT))
|
||||
{
|
||||
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, data.getResourceSystem().get(), NULL, new TerrainStorage(mData), Element_Terrain<<1));
|
||||
mTerrain->loadCell(esmLand->mX,
|
||||
esmLand->mY);
|
||||
mTerrain->loadCell(esmLand.mX,
|
||||
esmLand.mY);
|
||||
|
||||
mX = esmLand->mX;
|
||||
mY = esmLand->mY;
|
||||
mX = esmLand.mX;
|
||||
mY = esmLand.mY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,10 @@ namespace CSVRender
|
|||
if (index == -1)
|
||||
return NULL;
|
||||
|
||||
ESM::Land* land = mData.getLand().getRecord(index).get().mLand.get();
|
||||
const ESM::Land& land = mData.getLand().getRecord(index).get();
|
||||
int mask = ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR | ESM::Land::DATA_VTEX;
|
||||
if (!land->isDataLoaded(mask))
|
||||
land->loadData(mask);
|
||||
return land;
|
||||
land.loadData (mask);
|
||||
return &land;
|
||||
}
|
||||
|
||||
const ESM::LandTexture* TerrainStorage::getLandTexture(int index, short plugin)
|
||||
|
|
Loading…
Reference in a new issue