Return const Land in ESMStore

pull/149/head
scrawl 8 years ago
parent e295a72d43
commit 325bf66653

@ -153,7 +153,7 @@ namespace MWRender
{
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)
{

@ -43,7 +43,8 @@ namespace MWRender
{
const MWWorld::ESMStore &esmStore =
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)
return NULL;

@ -228,7 +228,7 @@ namespace MWWorld
if ((*iter)->getCell()->isExterior())
{
ESM::Land* land =
const ESM::Land* land =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
(*iter)->getCell()->getGridX(),
(*iter)->getCell()->getGridY()
@ -262,7 +262,7 @@ namespace MWWorld
// Load terrain physics first...
if (cell->getCell()->isExterior())
{
ESM::Land* land =
const ESM::Land* land =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
cell->getCell()->getGridX(),
cell->getCell()->getGridY()

@ -436,7 +436,7 @@ namespace MWWorld
{
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;
land.mX = x, land.mY = y;
@ -445,13 +445,13 @@ namespace MWWorld
std::lower_bound(mStatic.begin(), mStatic.end(), &land, Compare());
if (it != mStatic.end() && (*it)->mX == x && (*it)->mY == y) {
return const_cast<ESM::Land *>(*it);
return *it;
}
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) {
std::ostringstream msg;
msg << "Land at (" << x << ", " << y << ") not found";

@ -242,8 +242,8 @@ namespace MWWorld
// Must be threadsafe! Called from terrain background loading threads.
// Not a big deal here, since ESM::Land can never be modified or inserted/erased
ESM::Land *search(int x, int y) const;
ESM::Land *find(int x, int y) const;
const ESM::Land *search(int x, int y) const;
const ESM::Land *find(int x, int y) const;
RecordId load(ESM::ESMReader &esm);
void setUp();

@ -234,7 +234,7 @@ namespace ESM
}
}
void Land::unloadData()
void Land::unloadData() const
{
if (mDataLoaded)
{

@ -123,7 +123,7 @@ struct Land
/**
* Frees memory allocated for land data
*/
void unloadData();
void unloadData() const;
/// Check if given data type is loaded
/// @note We only check data types that *can* be loaded (present in mDataTypes)

Loading…
Cancel
Save