mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 14:39:42 +00:00
Return const Land in ESMStore
This commit is contained in:
parent
e295a72d43
commit
325bf66653
7 changed files with 13 additions and 12 deletions
|
@ -153,7 +153,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
for (int y = mMinY; y <= mMaxY; ++y)
|
for (int y = mMinY; y <= mMaxY; ++y)
|
||||||
{
|
{
|
||||||
ESM::Land* land = esmStore.get<ESM::Land>().search (x,y);
|
const ESM::Land* land = esmStore.get<ESM::Land>().search (x,y);
|
||||||
|
|
||||||
if (land)
|
if (land)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,8 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
const MWWorld::ESMStore &esmStore =
|
const MWWorld::ESMStore &esmStore =
|
||||||
MWBase::Environment::get().getWorld()->getStore();
|
MWBase::Environment::get().getWorld()->getStore();
|
||||||
ESM::Land* land = esmStore.get<ESM::Land>().search(cellX, cellY);
|
|
||||||
|
const ESM::Land* land = esmStore.get<ESM::Land>().search(cellX, cellY);
|
||||||
if (!land)
|
if (!land)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ namespace MWWorld
|
||||||
|
|
||||||
if ((*iter)->getCell()->isExterior())
|
if ((*iter)->getCell()->isExterior())
|
||||||
{
|
{
|
||||||
ESM::Land* land =
|
const ESM::Land* land =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
|
||||||
(*iter)->getCell()->getGridX(),
|
(*iter)->getCell()->getGridX(),
|
||||||
(*iter)->getCell()->getGridY()
|
(*iter)->getCell()->getGridY()
|
||||||
|
@ -262,7 +262,7 @@ namespace MWWorld
|
||||||
// Load terrain physics first...
|
// Load terrain physics first...
|
||||||
if (cell->getCell()->isExterior())
|
if (cell->getCell()->isExterior())
|
||||||
{
|
{
|
||||||
ESM::Land* land =
|
const ESM::Land* land =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
|
||||||
cell->getCell()->getGridX(),
|
cell->getCell()->getGridX(),
|
||||||
cell->getCell()->getGridY()
|
cell->getCell()->getGridY()
|
||||||
|
|
|
@ -436,7 +436,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
return iterator(mStatic.end());
|
return iterator(mStatic.end());
|
||||||
}
|
}
|
||||||
ESM::Land *Store<ESM::Land>::search(int x, int y) const
|
const ESM::Land *Store<ESM::Land>::search(int x, int y) const
|
||||||
{
|
{
|
||||||
ESM::Land land;
|
ESM::Land land;
|
||||||
land.mX = x, land.mY = y;
|
land.mX = x, land.mY = y;
|
||||||
|
@ -445,13 +445,13 @@ namespace MWWorld
|
||||||
std::lower_bound(mStatic.begin(), mStatic.end(), &land, Compare());
|
std::lower_bound(mStatic.begin(), mStatic.end(), &land, Compare());
|
||||||
|
|
||||||
if (it != mStatic.end() && (*it)->mX == x && (*it)->mY == y) {
|
if (it != mStatic.end() && (*it)->mX == x && (*it)->mY == y) {
|
||||||
return const_cast<ESM::Land *>(*it);
|
return *it;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ESM::Land *Store<ESM::Land>::find(int x, int y) const
|
const ESM::Land *Store<ESM::Land>::find(int x, int y) const
|
||||||
{
|
{
|
||||||
ESM::Land *ptr = search(x, y);
|
const ESM::Land *ptr = search(x, y);
|
||||||
if (ptr == 0) {
|
if (ptr == 0) {
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
msg << "Land at (" << x << ", " << y << ") not found";
|
msg << "Land at (" << x << ", " << y << ") not found";
|
||||||
|
|
|
@ -242,8 +242,8 @@ namespace MWWorld
|
||||||
|
|
||||||
// Must be threadsafe! Called from terrain background loading threads.
|
// Must be threadsafe! Called from terrain background loading threads.
|
||||||
// Not a big deal here, since ESM::Land can never be modified or inserted/erased
|
// Not a big deal here, since ESM::Land can never be modified or inserted/erased
|
||||||
ESM::Land *search(int x, int y) const;
|
const ESM::Land *search(int x, int y) const;
|
||||||
ESM::Land *find(int x, int y) const;
|
const ESM::Land *find(int x, int y) const;
|
||||||
|
|
||||||
RecordId load(ESM::ESMReader &esm);
|
RecordId load(ESM::ESMReader &esm);
|
||||||
void setUp();
|
void setUp();
|
||||||
|
|
|
@ -234,7 +234,7 @@ namespace ESM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Land::unloadData()
|
void Land::unloadData() const
|
||||||
{
|
{
|
||||||
if (mDataLoaded)
|
if (mDataLoaded)
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,7 +123,7 @@ struct Land
|
||||||
/**
|
/**
|
||||||
* Frees memory allocated for land data
|
* Frees memory allocated for land data
|
||||||
*/
|
*/
|
||||||
void unloadData();
|
void unloadData() const;
|
||||||
|
|
||||||
/// Check if given data type is loaded
|
/// Check if given data type is loaded
|
||||||
/// @note We only check data types that *can* be loaded (present in mDataTypes)
|
/// @note We only check data types that *can* be loaded (present in mDataTypes)
|
||||||
|
|
Loading…
Reference in a new issue