mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 12:36:42 +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 ||
|
if (land.mState==CSMWorld::RecordBase::State_Modified ||
|
||||||
land.mState==CSMWorld::RecordBase::State_ModifiedOnly)
|
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());
|
data->save (mState.getWriter());
|
||||||
|
|
||||||
mState.getWriter().endRecord (record.mLand->sRecordId);
|
mState.getWriter().endRecord (record.sRecordId);
|
||||||
}
|
}
|
||||||
else if (land.mState==CSMWorld::RecordBase::State_Deleted)
|
else if (land.mState==CSMWorld::RecordBase::State_Deleted)
|
||||||
{
|
{
|
||||||
|
|
|
@ -124,7 +124,7 @@ void CSMTools::ListLandTexturesMergeStage::perform (int stage, CSMDoc::Messages&
|
||||||
|
|
||||||
if (!record.isDeleted())
|
if (!record.isDeleted())
|
||||||
{
|
{
|
||||||
ESM::Land& land = *record.get().mLand;
|
const ESM::Land& land = record.get();
|
||||||
|
|
||||||
// make sure record is loaded
|
// make sure record is loaded
|
||||||
land.loadData (ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML |
|
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;
|
return mLand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSMWorld::IdCollection<CSMWorld::Land>& CSMWorld::Data::getLand()
|
||||||
|
{
|
||||||
|
return mLand;
|
||||||
|
}
|
||||||
|
|
||||||
const CSMWorld::IdCollection<CSMWorld::LandTexture>& CSMWorld::Data::getLandTextures() const
|
const CSMWorld::IdCollection<CSMWorld::LandTexture>& CSMWorld::Data::getLandTextures() const
|
||||||
{
|
{
|
||||||
return mLandTextures;
|
return mLandTextures;
|
||||||
|
@ -951,7 +956,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages)
|
||||||
int index = mLand.load(*mReader, mBase);
|
int index = mLand.load(*mReader, mBase);
|
||||||
|
|
||||||
if (index!=-1 && !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_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR |
|
||||||
ESM::Land::DATA_VTEX | ESM::Land::DATA_WNAM);
|
ESM::Land::DATA_VTEX | ESM::Land::DATA_WNAM);
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,8 @@ namespace CSMWorld
|
||||||
|
|
||||||
const IdCollection<CSMWorld::Land>& getLand() const;
|
const IdCollection<CSMWorld::Land>& getLand() const;
|
||||||
|
|
||||||
|
IdCollection<CSMWorld::Land>& getLand();
|
||||||
|
|
||||||
const IdCollection<CSMWorld::LandTexture>& getLandTextures() const;
|
const IdCollection<CSMWorld::LandTexture>& getLandTextures() const;
|
||||||
|
|
||||||
IdCollection<CSMWorld::LandTexture>& getLandTextures();
|
IdCollection<CSMWorld::LandTexture>& getLandTextures();
|
||||||
|
|
|
@ -4,25 +4,13 @@
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
|
|
||||||
Land::Land()
|
|
||||||
{
|
|
||||||
mLand.reset(new ESM::Land());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Land::load(ESM::ESMReader &esm)
|
void Land::load(ESM::ESMReader &esm)
|
||||||
{
|
{
|
||||||
mLand->load(esm);
|
ESM::Land::load(esm);
|
||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << "#" << mLand->mX << " " << mLand->mY;
|
stream << "#" << mX << " " << mY;
|
||||||
|
|
||||||
mId = stream.str();
|
mId = stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Land::blank()
|
|
||||||
{
|
|
||||||
/// \todo
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define CSM_WORLD_LAND_H
|
#define CSM_WORLD_LAND_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include <components/esm/loadland.hpp>
|
#include <components/esm/loadland.hpp>
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
|
@ -11,18 +11,12 @@ namespace CSMWorld
|
||||||
///
|
///
|
||||||
/// \todo Add worldspace support to the Land record.
|
/// \todo Add worldspace support to the Land record.
|
||||||
/// \todo Add a proper copy constructor (currently worked around using shared_ptr)
|
/// \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;
|
std::string mId;
|
||||||
|
|
||||||
/// Loads the metadata and ID
|
/// Loads the metadata and ID
|
||||||
void load (ESM::ESMReader &esm);
|
void load (ESM::ESMReader &esm);
|
||||||
|
|
||||||
void blank();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,15 +68,16 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::st
|
||||||
int landIndex = land.searchId(mId);
|
int landIndex = land.searchId(mId);
|
||||||
if (landIndex != -1)
|
if (landIndex != -1)
|
||||||
{
|
{
|
||||||
const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
|
const ESM::Land& esmLand = land.getRecord(mId).get();
|
||||||
if(esmLand && esmLand->mDataTypes&ESM::Land::DATA_VHGT)
|
|
||||||
|
if (esmLand.getLandData (ESM::Land::DATA_VHGT))
|
||||||
{
|
{
|
||||||
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, data.getResourceSystem().get(), NULL, new TerrainStorage(mData), Element_Terrain<<1));
|
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, data.getResourceSystem().get(), NULL, new TerrainStorage(mData), Element_Terrain<<1));
|
||||||
mTerrain->loadCell(esmLand->mX,
|
mTerrain->loadCell(esmLand.mX,
|
||||||
esmLand->mY);
|
esmLand.mY);
|
||||||
|
|
||||||
mX = esmLand->mX;
|
mX = esmLand.mX;
|
||||||
mY = esmLand->mY;
|
mY = esmLand.mY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,10 @@ namespace CSVRender
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return NULL;
|
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;
|
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);
|
||||||
land->loadData(mask);
|
return &land;
|
||||||
return land;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::LandTexture* TerrainStorage::getLandTexture(int index, short plugin)
|
const ESM::LandTexture* TerrainStorage::getLandTexture(int index, short plugin)
|
||||||
|
|
Loading…
Reference in a new issue