mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
Merge branch 'getters' into 'master'
Move getters to header in order to allow inlining (performance optimization) See merge request OpenMW/openmw!1289
This commit is contained in:
commit
89077af3ff
@ -8,11 +8,6 @@
|
|||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
|
|
||||||
const ESM::RefNum& CellRef::getRefNum() const
|
|
||||||
{
|
|
||||||
return mCellRef.mRefNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ESM::RefNum& CellRef::getOrAssignRefNum(ESM::RefNum& lastAssignedRefNum)
|
const ESM::RefNum& CellRef::getOrAssignRefNum(ESM::RefNum& lastAssignedRefNum)
|
||||||
{
|
{
|
||||||
if (!mCellRef.mRefNum.isSet())
|
if (!mCellRef.mRefNum.isSet())
|
||||||
@ -33,41 +28,11 @@ namespace MWWorld
|
|||||||
return mCellRef.mRefNum;
|
return mCellRef.mRefNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CellRef::hasContentFile() const
|
|
||||||
{
|
|
||||||
return mCellRef.mRefNum.hasContentFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::unsetRefNum()
|
void CellRef::unsetRefNum()
|
||||||
{
|
{
|
||||||
mCellRef.mRefNum.unset();
|
mCellRef.mRefNum.unset();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CellRef::getRefId() const
|
|
||||||
{
|
|
||||||
return mCellRef.mRefID;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CellRef::getTeleport() const
|
|
||||||
{
|
|
||||||
return mCellRef.mTeleport;
|
|
||||||
}
|
|
||||||
|
|
||||||
ESM::Position CellRef::getDoorDest() const
|
|
||||||
{
|
|
||||||
return mCellRef.mDoorDest;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CellRef::getDestCell() const
|
|
||||||
{
|
|
||||||
return mCellRef.mDestCell;
|
|
||||||
}
|
|
||||||
|
|
||||||
float CellRef::getScale() const
|
|
||||||
{
|
|
||||||
return mCellRef.mScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setScale(float scale)
|
void CellRef::setScale(float scale)
|
||||||
{
|
{
|
||||||
if (scale != mCellRef.mScale)
|
if (scale != mCellRef.mScale)
|
||||||
@ -77,22 +42,12 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ESM::Position CellRef::getPosition() const
|
|
||||||
{
|
|
||||||
return mCellRef.mPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setPosition(const ESM::Position &position)
|
void CellRef::setPosition(const ESM::Position &position)
|
||||||
{
|
{
|
||||||
mChanged = true;
|
mChanged = true;
|
||||||
mCellRef.mPos = position;
|
mCellRef.mPos = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CellRef::getEnchantmentCharge() const
|
|
||||||
{
|
|
||||||
return mCellRef.mEnchantmentCharge;
|
|
||||||
}
|
|
||||||
|
|
||||||
float CellRef::getNormalizedEnchantmentCharge(int maxCharge) const
|
float CellRef::getNormalizedEnchantmentCharge(int maxCharge) const
|
||||||
{
|
{
|
||||||
if (maxCharge == 0)
|
if (maxCharge == 0)
|
||||||
@ -118,11 +73,6 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CellRef::getCharge() const
|
|
||||||
{
|
|
||||||
return mCellRef.mChargeInt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setCharge(int charge)
|
void CellRef::setCharge(int charge)
|
||||||
{
|
{
|
||||||
if (charge != mCellRef.mChargeInt)
|
if (charge != mCellRef.mChargeInt)
|
||||||
@ -150,11 +100,6 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float CellRef::getChargeFloat() const
|
|
||||||
{
|
|
||||||
return mCellRef.mChargeFloat;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setChargeFloat(float charge)
|
void CellRef::setChargeFloat(float charge)
|
||||||
{
|
{
|
||||||
if (charge != mCellRef.mChargeFloat)
|
if (charge != mCellRef.mChargeFloat)
|
||||||
@ -164,16 +109,6 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CellRef::getOwner() const
|
|
||||||
{
|
|
||||||
return mCellRef.mOwner;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CellRef::getGlobalVariable() const
|
|
||||||
{
|
|
||||||
return mCellRef.mGlobalVariable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::resetGlobalVariable()
|
void CellRef::resetGlobalVariable()
|
||||||
{
|
{
|
||||||
if (!mCellRef.mGlobalVariable.empty())
|
if (!mCellRef.mGlobalVariable.empty())
|
||||||
@ -192,11 +127,6 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CellRef::getFactionRank() const
|
|
||||||
{
|
|
||||||
return mCellRef.mFactionRank;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setOwner(const std::string &owner)
|
void CellRef::setOwner(const std::string &owner)
|
||||||
{
|
{
|
||||||
if (owner != mCellRef.mOwner)
|
if (owner != mCellRef.mOwner)
|
||||||
@ -206,11 +136,6 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CellRef::getSoul() const
|
|
||||||
{
|
|
||||||
return mCellRef.mSoul;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setSoul(const std::string &soul)
|
void CellRef::setSoul(const std::string &soul)
|
||||||
{
|
{
|
||||||
if (soul != mCellRef.mSoul)
|
if (soul != mCellRef.mSoul)
|
||||||
@ -220,11 +145,6 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CellRef::getFaction() const
|
|
||||||
{
|
|
||||||
return mCellRef.mFaction;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setFaction(const std::string &faction)
|
void CellRef::setFaction(const std::string &faction)
|
||||||
{
|
{
|
||||||
if (faction != mCellRef.mFaction)
|
if (faction != mCellRef.mFaction)
|
||||||
@ -234,11 +154,6 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CellRef::getLockLevel() const
|
|
||||||
{
|
|
||||||
return mCellRef.mLockLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setLockLevel(int lockLevel)
|
void CellRef::setLockLevel(int lockLevel)
|
||||||
{
|
{
|
||||||
if (lockLevel != mCellRef.mLockLevel)
|
if (lockLevel != mCellRef.mLockLevel)
|
||||||
@ -261,16 +176,6 @@ namespace MWWorld
|
|||||||
setLockLevel(-abs(mCellRef.mLockLevel)); //Makes lockLevel negative
|
setLockLevel(-abs(mCellRef.mLockLevel)); //Makes lockLevel negative
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CellRef::getKey() const
|
|
||||||
{
|
|
||||||
return mCellRef.mKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CellRef::getTrap() const
|
|
||||||
{
|
|
||||||
return mCellRef.mTrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setTrap(const std::string& trap)
|
void CellRef::setTrap(const std::string& trap)
|
||||||
{
|
{
|
||||||
if (trap != mCellRef.mTrap)
|
if (trap != mCellRef.mTrap)
|
||||||
@ -280,11 +185,6 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CellRef::getGoldValue() const
|
|
||||||
{
|
|
||||||
return mCellRef.mGoldValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CellRef::setGoldValue(int value)
|
void CellRef::setGoldValue(int value)
|
||||||
{
|
{
|
||||||
if (value != mCellRef.mGoldValue)
|
if (value != mCellRef.mGoldValue)
|
||||||
@ -299,9 +199,4 @@ namespace MWWorld
|
|||||||
state.mRef = mCellRef;
|
state.mRef = mCellRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CellRef::hasChanged() const
|
|
||||||
{
|
|
||||||
return mChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note: Currently unused for items in containers
|
// Note: Currently unused for items in containers
|
||||||
const ESM::RefNum& getRefNum() const;
|
const ESM::RefNum& getRefNum() const { return mCellRef.mRefNum; }
|
||||||
|
|
||||||
// Returns RefNum.
|
// Returns RefNum.
|
||||||
// If RefNum is not set, assigns a generated one and changes the "lastAssignedRefNum" counter.
|
// If RefNum is not set, assigns a generated one and changes the "lastAssignedRefNum" counter.
|
||||||
@ -33,35 +33,35 @@ namespace MWWorld
|
|||||||
void unsetRefNum();
|
void unsetRefNum();
|
||||||
|
|
||||||
/// Does the RefNum have a content file?
|
/// Does the RefNum have a content file?
|
||||||
bool hasContentFile() const;
|
bool hasContentFile() const { return mCellRef.mRefNum.hasContentFile(); }
|
||||||
|
|
||||||
// Id of object being referenced
|
// Id of object being referenced
|
||||||
std::string getRefId() const;
|
const std::string& getRefId() const { return mCellRef.mRefID; }
|
||||||
|
|
||||||
// Reference to ID of the object being referenced
|
// Reference to ID of the object being referenced
|
||||||
const std::string& getRefIdRef() const { return mCellRef.mRefID; }
|
const std::string& getRefIdRef() const { return mCellRef.mRefID; } // TODO replace with getRefId
|
||||||
|
|
||||||
// For doors - true if this door teleports to somewhere else, false
|
// For doors - true if this door teleports to somewhere else, false
|
||||||
// if it should open through animation.
|
// if it should open through animation.
|
||||||
bool getTeleport() const;
|
bool getTeleport() const { return mCellRef.mTeleport; }
|
||||||
|
|
||||||
// Teleport location for the door, if this is a teleporting door.
|
// Teleport location for the door, if this is a teleporting door.
|
||||||
ESM::Position getDoorDest() const;
|
const ESM::Position& getDoorDest() const { return mCellRef.mDoorDest; }
|
||||||
|
|
||||||
// Destination cell for doors (optional)
|
// Destination cell for doors (optional)
|
||||||
std::string getDestCell() const;
|
const std::string& getDestCell() const { return mCellRef.mDestCell; }
|
||||||
|
|
||||||
// Scale applied to mesh
|
// Scale applied to mesh
|
||||||
float getScale() const;
|
float getScale() const { return mCellRef.mScale; }
|
||||||
void setScale(float scale);
|
void setScale(float scale);
|
||||||
|
|
||||||
// The *original* position and rotation as it was given in the Construction Set.
|
// The *original* position and rotation as it was given in the Construction Set.
|
||||||
// Current position and rotation of the object is stored in RefData.
|
// Current position and rotation of the object is stored in RefData.
|
||||||
ESM::Position getPosition() const;
|
const ESM::Position& getPosition() const { return mCellRef.mPos; }
|
||||||
void setPosition (const ESM::Position& position);
|
void setPosition (const ESM::Position& position);
|
||||||
|
|
||||||
// Remaining enchantment charge. This could be -1 if the charge was not touched yet (i.e. full).
|
// Remaining enchantment charge. This could be -1 if the charge was not touched yet (i.e. full).
|
||||||
float getEnchantmentCharge() const;
|
float getEnchantmentCharge() const { return mCellRef.mEnchantmentCharge; }
|
||||||
|
|
||||||
// Remaining enchantment charge rescaled to the supplied maximum charge (such as one of the enchantment).
|
// Remaining enchantment charge rescaled to the supplied maximum charge (such as one of the enchantment).
|
||||||
float getNormalizedEnchantmentCharge(int maxCharge) const;
|
float getNormalizedEnchantmentCharge(int maxCharge) const;
|
||||||
@ -71,57 +71,57 @@ namespace MWWorld
|
|||||||
// For weapon or armor, this is the remaining item health.
|
// For weapon or armor, this is the remaining item health.
|
||||||
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
|
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
|
||||||
// If this returns int(-1) it means full health.
|
// If this returns int(-1) it means full health.
|
||||||
int getCharge() const;
|
int getCharge() const { return mCellRef.mChargeInt; }
|
||||||
float getChargeFloat() const; // Implemented as union with int charge
|
float getChargeFloat() const { return mCellRef.mChargeFloat; } // Implemented as union with int charge
|
||||||
void setCharge(int charge);
|
void setCharge(int charge);
|
||||||
void setChargeFloat(float charge);
|
void setChargeFloat(float charge);
|
||||||
void applyChargeRemainderToBeSubtracted(float chargeRemainder); // Stores remainders and applies if > 1
|
void applyChargeRemainderToBeSubtracted(float chargeRemainder); // Stores remainders and applies if > 1
|
||||||
|
|
||||||
// The NPC that owns this object (and will get angry if you steal it)
|
// The NPC that owns this object (and will get angry if you steal it)
|
||||||
std::string getOwner() const;
|
const std::string& getOwner() const { return mCellRef.mOwner; }
|
||||||
void setOwner(const std::string& owner);
|
void setOwner(const std::string& owner);
|
||||||
|
|
||||||
// Name of a global variable. If the global variable is set to '1', using the object is temporarily allowed
|
// Name of a global variable. If the global variable is set to '1', using the object is temporarily allowed
|
||||||
// even if it has an Owner field.
|
// even if it has an Owner field.
|
||||||
// Used by bed rent scripts to allow the player to use the bed for the duration of the rent.
|
// Used by bed rent scripts to allow the player to use the bed for the duration of the rent.
|
||||||
std::string getGlobalVariable() const;
|
const std::string& getGlobalVariable() const { return mCellRef.mGlobalVariable; }
|
||||||
|
|
||||||
void resetGlobalVariable();
|
void resetGlobalVariable();
|
||||||
|
|
||||||
// ID of creature trapped in this soul gem
|
// ID of creature trapped in this soul gem
|
||||||
std::string getSoul() const;
|
const std::string& getSoul() const { return mCellRef.mSoul; }
|
||||||
void setSoul(const std::string& soul);
|
void setSoul(const std::string& soul);
|
||||||
|
|
||||||
// The faction that owns this object (and will get angry if
|
// The faction that owns this object (and will get angry if
|
||||||
// you take it and are not a faction member)
|
// you take it and are not a faction member)
|
||||||
std::string getFaction() const;
|
const std::string& getFaction() const { return mCellRef.mFaction; }
|
||||||
void setFaction (const std::string& faction);
|
void setFaction (const std::string& faction);
|
||||||
|
|
||||||
// PC faction rank required to use the item. Sometimes is -1, which means "any rank".
|
// PC faction rank required to use the item. Sometimes is -1, which means "any rank".
|
||||||
void setFactionRank(int factionRank);
|
void setFactionRank(int factionRank);
|
||||||
int getFactionRank() const;
|
int getFactionRank() const { return mCellRef.mFactionRank; }
|
||||||
|
|
||||||
// Lock level for doors and containers
|
// Lock level for doors and containers
|
||||||
// Positive for a locked door. 0 for a door that was never locked.
|
// Positive for a locked door. 0 for a door that was never locked.
|
||||||
// For an unlocked door, it is set to -(previous locklevel)
|
// For an unlocked door, it is set to -(previous locklevel)
|
||||||
int getLockLevel() const;
|
int getLockLevel() const { return mCellRef.mLockLevel; }
|
||||||
void setLockLevel(int lockLevel);
|
void setLockLevel(int lockLevel);
|
||||||
void lock(int lockLevel);
|
void lock(int lockLevel);
|
||||||
void unlock();
|
void unlock();
|
||||||
// Key and trap ID names, if any
|
// Key and trap ID names, if any
|
||||||
std::string getKey() const;
|
const std::string& getKey() const { return mCellRef.mKey; }
|
||||||
std::string getTrap() const;
|
const std::string& getTrap() const { return mCellRef.mTrap; }
|
||||||
void setTrap(const std::string& trap);
|
void setTrap(const std::string& trap);
|
||||||
|
|
||||||
// This is 5 for Gold_005 references, 100 for Gold_100 and so on.
|
// This is 5 for Gold_005 references, 100 for Gold_100 and so on.
|
||||||
int getGoldValue() const;
|
int getGoldValue() const { return mCellRef.mGoldValue; }
|
||||||
void setGoldValue(int value);
|
void setGoldValue(int value);
|
||||||
|
|
||||||
// Write the content of this CellRef into the given ObjectState
|
// Write the content of this CellRef into the given ObjectState
|
||||||
void writeState (ESM::ObjectState& state) const;
|
void writeState (ESM::ObjectState& state) const;
|
||||||
|
|
||||||
// Has this CellRef changed since it was originally loaded?
|
// Has this CellRef changed since it was originally loaded?
|
||||||
bool hasChanged() const;
|
bool hasChanged() const { return mChanged; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mChanged;
|
bool mChanged;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user