Cache the lookup of the sim access level.
Being part of the state line, it is called every frame, causing a translation lookup every frame.
This commit is contained in:
@@ -599,9 +599,15 @@ BOOL LLViewerRegion::canManageEstate() const
|
||||
|| gAgent.getID() == getOwner();
|
||||
}
|
||||
|
||||
const std::string LLViewerRegion::getSimAccessString() const
|
||||
std::string const& LLViewerRegion::getSimAccessString()
|
||||
{
|
||||
return accessToString(mSimAccess);
|
||||
// Singu: added a cache because this is called every frame.
|
||||
if (mLastSimAccess != mSimAccess)
|
||||
{
|
||||
mSimAccessString = accessToString(mSimAccess);
|
||||
mLastSimAccess = mSimAccess;
|
||||
}
|
||||
return mSimAccessString;
|
||||
}
|
||||
|
||||
std::string LLViewerRegion::getLocalizedSimProductName() const
|
||||
|
||||
@@ -204,8 +204,8 @@ public:
|
||||
|
||||
void setSimAccess(U8 sim_access) { mSimAccess = sim_access; }
|
||||
U8 getSimAccess() const { return mSimAccess; }
|
||||
const std::string getSimAccessString() const;
|
||||
|
||||
std::string const& getSimAccessString(); // Singu note: return reference to mSimAccessString.
|
||||
|
||||
// Homestead-related getters; there are no setters as nobody should be
|
||||
// setting them other than the individual message handler which is a member
|
||||
S32 getSimClassID() const { return mClassID; }
|
||||
@@ -425,6 +425,8 @@ private:
|
||||
U64 mRegionFlags; // includes damage flags
|
||||
U64 mRegionProtocols; // protocols supported by this region
|
||||
U8 mSimAccess;
|
||||
U8 mLastSimAccess; // Singularity extension.
|
||||
std::string mSimAccessString; // Singularity extension.
|
||||
F32 mBillableFactor;
|
||||
U32 mMaxTasks; // max prim count
|
||||
F32 mCameraDistanceSquared; // updated once per frame
|
||||
|
||||
Reference in New Issue
Block a user