mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 13:39:40 +00:00
various bits of cleanup
This commit is contained in:
parent
83ded18af0
commit
bfcd768078
4 changed files with 162 additions and 142 deletions
|
@ -430,6 +430,11 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
bool CellStore::isExterior() const
|
||||
{
|
||||
return mCell->isExterior();
|
||||
}
|
||||
|
||||
Ptr CellStore::searchInContainer (const std::string& id)
|
||||
{
|
||||
if (Ptr ptr = searchInContainerList (mContainers, id))
|
||||
|
@ -637,4 +642,14 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool operator== (const CellStore& left, const CellStore& right)
|
||||
{
|
||||
return left.getCell()->getCellId()==right.getCell()->getCellId();
|
||||
}
|
||||
|
||||
bool operator!= (const CellStore& left, const CellStore& right)
|
||||
{
|
||||
return !(left==right);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef GAME_MWWORLD_CELLSTORE_H
|
||||
#define GAME_MWWORLD_CELLSTORE_H
|
||||
|
||||
#include <deque>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
|
@ -82,10 +81,11 @@ namespace MWWorld
|
|||
int count() const;
|
||||
///< Return total number of references, including deleted ones.
|
||||
|
||||
|
||||
void load (const MWWorld::ESMStore &store, std::vector<ESM::ESMReader> &esm);
|
||||
///< Load references from content file.
|
||||
|
||||
void preload (const MWWorld::ESMStore &store, std::vector<ESM::ESMReader> &esm);
|
||||
///< Build ID list from content file.
|
||||
|
||||
/// Call functor (ref) for each reference. functor must return a bool. Returning
|
||||
/// false will abort the iteration.
|
||||
|
@ -118,19 +118,7 @@ namespace MWWorld
|
|||
forEachImp (functor, mCreatureLists);
|
||||
}
|
||||
|
||||
bool operator==(const CellStore &cell) {
|
||||
return mCell->mName == cell.mCell->mName &&
|
||||
mCell->mData.mX == cell.mCell->mData.mX &&
|
||||
mCell->mData.mY == cell.mCell->mData.mY;
|
||||
}
|
||||
|
||||
bool operator!=(const CellStore &cell) {
|
||||
return !(*this == cell);
|
||||
}
|
||||
|
||||
bool isExterior() const {
|
||||
return mCell->isExterior();
|
||||
}
|
||||
bool isExterior() const;
|
||||
|
||||
Ptr searchInContainer (const std::string& id);
|
||||
|
||||
|
@ -293,6 +281,9 @@ namespace MWWorld
|
|||
{
|
||||
return mWeapons;
|
||||
}
|
||||
|
||||
bool operator== (const CellStore& left, const CellStore& right);
|
||||
bool operator!= (const CellStore& left, const CellStore& right);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,3 +24,14 @@ void ESM::CellId::save (ESMWriter &esm) const
|
|||
if (mPaged)
|
||||
esm.writeHNT ("CIDX", mIndex, 8);
|
||||
}
|
||||
|
||||
bool ESM::operator== (const CellId& left, const CellId& right)
|
||||
{
|
||||
return left.mWorldspace==right.mWorldspace && left.mPaged==right.mPaged &&
|
||||
(!left.mPaged || (left.mIndex.mX==right.mIndex.mX && left.mIndex.mY==right.mIndex.mY));
|
||||
}
|
||||
|
||||
bool ESM::operator!= (const CellId& left, const CellId& right)
|
||||
{
|
||||
return !(left==right);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,9 @@ namespace ESM
|
|||
void load (ESMReader &esm);
|
||||
void save (ESMWriter &esm) const;
|
||||
};
|
||||
|
||||
bool operator== (const CellId& left, const CellId& right);
|
||||
bool operator!= (const CellId& left, const CellId& right);
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue