1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 22:53:53 +00:00

Merge remote branch 'lgro/master'

This commit is contained in:
Marc Zinnschlag 2012-04-04 23:19:30 +02:00
commit 6fd3d5c776
3 changed files with 35 additions and 2 deletions

View file

@ -97,9 +97,12 @@ namespace MWRender
ESM::Land* land = mEnvironment.mWorld->getStore().lands.search(cellX, cellY); ESM::Land* land = mEnvironment.mWorld->getStore().lands.search(cellX, cellY);
if ( land != NULL ) if ( land != NULL )
{
if (!land->dataLoaded)
{ {
land->loadData(); land->loadData();
} }
}
//split the cell terrain into four segments //split the cell terrain into four segments
const int numTextures = ESM::Land::LAND_TEXTURE_SIZE/2; const int numTextures = ESM::Land::LAND_TEXTURE_SIZE/2;
@ -419,8 +422,12 @@ namespace MWRender
ESM::Land* land = mEnvironment.mWorld->getStore().lands.search(cellX, cellY); ESM::Land* land = mEnvironment.mWorld->getStore().lands.search(cellX, cellY);
if ( land != NULL ) if ( land != NULL )
{
if (!land->dataLoaded)
{ {
land->loadData(); land->loadData();
}
return land->landData return land->landData
->textures[y * ESM::Land::LAND_TEXTURE_SIZE + x]; ->textures[y * ESM::Land::LAND_TEXTURE_SIZE + x];
} }

View file

@ -2,6 +2,24 @@
namespace ESM namespace ESM
{ {
Land::Land()
: flags(0)
, X(0)
, Y(0)
, mEsm(NULL)
, hasData(false)
, dataLoaded(false)
, landData(NULL)
{
}
Land::~Land()
{
delete landData;
}
void Land::load(ESMReader &esm) void Land::load(ESMReader &esm)
{ {
mEsm = &esm; mEsm = &esm;

View file

@ -11,6 +11,9 @@ namespace ESM
struct Land struct Land
{ {
Land();
~Land();
int flags; // Only first four bits seem to be used, don't know what int flags; // Only first four bits seem to be used, don't know what
// they mean. // they mean.
int X, Y; // Map coordinates. int X, Y; // Map coordinates.
@ -77,6 +80,11 @@ struct Land
* Frees memory allocated for land data * Frees memory allocated for land data
*/ */
void unloadData(); void unloadData();
private:
Land(const Land& land);
Land& operator=(const Land& land);
}; };
} }
#endif #endif