summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagent.cpp')
-rwxr-xr-xindra/newview/llagent.cpp562
1 files changed, 122 insertions, 440 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index f150ceda67..bd6025feea 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -47,6 +47,7 @@
#include "llfirstuse.h"
#include "llfloatercamera.h"
#include "llfloaterimcontainer.h"
+#include "llfloaterperms.h"
#include "llfloaterreg.h"
#include "llfloatertools.h"
#include "llgroupactions.h"
@@ -406,7 +407,7 @@ LLAgent::LLAgent() :
mNextFidgetTime(0.f),
mCurrentFidget(0),
mFirstLogin(FALSE),
- mGenderChosen(FALSE),
+ mOutfitChosen(FALSE),
mVoiceConnected(false),
@@ -755,7 +756,7 @@ void LLAgent::setFlying(BOOL fly)
}
if( !was_flying )
{
- LLViewerStats::getInstance()->incStat(LLViewerStats::ST_FLY_COUNT);
+ add(LLStatViewer::FLY, 1);
}
setControlFlags(AGENT_CONTROL_FLY);
}
@@ -809,30 +810,6 @@ void LLAgent::standUp()
setControlFlags(AGENT_CONTROL_STAND_UP);
}
-
-void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id)
-{
- llinfos << "called" << llendl;
-
-
- // Old-style appearance entering a server-bake region.
- if (isAgentAvatarValid() &&
- !gAgentAvatarp->isUsingServerBakes() &&
- (mRegionp->getCentralBakeVersion()>0))
- {
- llinfos << "update requested due to region transition" << llendl;
- LLAppearanceMgr::instance().requestServerAppearanceUpdate();
- }
- // new-style appearance entering a non-bake region,
- // need to check for existence of the baking service.
- else if (isAgentAvatarValid() &&
- gAgentAvatarp->isUsingServerBakes() &&
- mRegionp->getCentralBakeVersion()==0)
- {
- gAgentAvatarp->checkForUnsupportedServerBakeAppearance();
- }
-}
-
void LLAgent::changeParcels()
{
LL_DEBUGS("AgentLocation") << "Calling ParcelChanged callbacks" << LL_ENDL;
@@ -850,13 +827,10 @@ boost::signals2::connection LLAgent::addParcelChangedCallback(parcel_changed_cal
//-----------------------------------------------------------------------------
void LLAgent::setRegion(LLViewerRegion *regionp)
{
- bool notifyRegionChange;
-
llassert(regionp);
if (mRegionp != regionp)
{
- notifyRegionChange = true;
-
+
std::string ip = regionp->getHost().getString();
LL_INFOS("AgentLocation") << "Moving agent into region: " << regionp->getName()
<< " located at " << ip << LL_ENDL;
@@ -908,10 +882,7 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
// Pass new region along to metrics components that care about this level of detail.
LLAppViewer::metricsUpdateRegion(regionp->getHandle());
}
- else
- {
- notifyRegionChange = false;
- }
+
mRegionp = regionp;
// TODO - most of what follows probably should be moved into callbacks
@@ -934,24 +905,8 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
LLFloaterMove::sUpdateFlyingStatus();
- // If the newly entered region is using server bakes, and our
- // current appearance is non-baked, request appearance update from
- // server.
- if (mRegionp->capabilitiesReceived())
- {
- handleServerBakeRegionTransition(mRegionp->getRegionID());
- }
- else
- {
- // Need to handle via callback after caps arrive.
- mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::handleServerBakeRegionTransition,this,_1));
- }
-
- if (notifyRegionChange)
- {
- LL_DEBUGS("AgentLocation") << "Calling RegionChanged callbacks" << LL_ENDL;
- mRegionChangedSignal();
- }
+ LL_DEBUGS("AgentLocation") << "Calling RegionChanged callbacks" << LL_ENDL;
+ mRegionChangedSignal();
}
@@ -1011,12 +966,12 @@ void LLAgent::sendMessage()
{
if (gDisconnected)
{
- llwarns << "Trying to send message when disconnected!" << llendl;
+ LL_WARNS() << "Trying to send message when disconnected!" << LL_ENDL;
return;
}
if (!mRegionp)
{
- llerrs << "No region for agent yet!" << llendl;
+ LL_ERRS() << "No region for agent yet!" << LL_ENDL;
return;
}
gMessageSystem->sendMessage(mRegionp->getHost());
@@ -1030,12 +985,12 @@ void LLAgent::sendReliableMessage()
{
if (gDisconnected)
{
- lldebugs << "Trying to send message when disconnected!" << llendl;
+ LL_DEBUGS() << "Trying to send message when disconnected!" << LL_ENDL;
return;
}
if (!mRegionp)
{
- lldebugs << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << llendl;
+ LL_DEBUGS() << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << LL_ENDL;
return;
}
gMessageSystem->sendReliable(mRegionp->getHost());
@@ -1064,7 +1019,7 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
{
if (!pos_agent.isFinite())
{
- llerrs << "setPositionAgent is not a number" << llendl;
+ LL_ERRS() << "setPositionAgent is not a number" << LL_ENDL;
}
if (isAgentAvatarValid() && gAgentAvatarp->getParent())
@@ -1196,7 +1151,7 @@ void LLAgent::resetAxes(const LLVector3 &look_at)
LLVector3 cross(look_at % skyward);
if (cross.isNull())
{
- llinfos << "LLAgent::resetAxes cross-product is zero" << llendl;
+ LL_INFOS() << "LLAgent::resetAxes cross-product is zero" << LL_ENDL;
return;
}
@@ -1466,6 +1421,7 @@ void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb)
{
LLDoNotDisturbNotificationStorage::getInstance()->updateNotifications();
}
+ gIMMgr->updateDNDMessageStatus();
}
//-----------------------------------------------------------------------------
@@ -1917,7 +1873,7 @@ BOOL LLAgent::needsRenderAvatar()
return FALSE;
}
- return mShowAvatar && mGenderChosen;
+ return mShowAvatar && mOutfitChosen;
}
// TRUE if we need to render your own avatar's head.
@@ -2073,7 +2029,7 @@ void LLAgent::endAnimationUpdateUI()
im_box->getDetachedConversationFloaters(conversations);
BOOST_FOREACH(LLFloater* conversation, conversations)
{
- llinfos << "skip_list.insert(session_floater): " << conversation->getTitle() << llendl;
+ LL_INFOS() << "skip_list.insert(session_floater): " << conversation->getTitle() << LL_ENDL;
skip_list.insert(conversation);
}
@@ -2336,7 +2292,7 @@ void LLAgent::setStartPosition( U32 location_id )
object = gObjectList.findObject(gAgentID);
if (! object)
{
- llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl;
+ LL_INFOS() << "setStartPosition - Can't find agent viewerobject id " << gAgentID << LL_ENDL;
return;
}
// we've got the viewer object
@@ -2437,7 +2393,7 @@ void LLAgent::requestStopMotion( LLMotion* motion )
// if motion is not looping, it could have stopped by running out of time
// so we need to tell the server this
-// llinfos << "Sending stop for motion " << motion->getName() << llendl;
+// LL_INFOS() << "Sending stop for motion " << motion->getName() << LL_ENDL;
sendAnimationRequest( anim_state, ANIM_REQUEST_STOP );
}
@@ -2565,17 +2521,19 @@ int LLAgent::convertTextToMaturity(char text)
class LLMaturityPreferencesResponder : public LLHTTPClient::Responder
{
+ LOG_CLASS(LLMaturityPreferencesResponder);
public:
LLMaturityPreferencesResponder(LLAgent *pAgent, U8 pPreferredMaturity, U8 pPreviousMaturity);
virtual ~LLMaturityPreferencesResponder();
- virtual void result(const LLSD &pContent);
- virtual void errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent);
+protected:
+ virtual void httpSuccess();
+ virtual void httpFailure();
protected:
private:
- U8 parseMaturityFromServerResponse(const LLSD &pContent);
+ U8 parseMaturityFromServerResponse(const LLSD &pContent) const;
LLAgent *mAgent;
U8 mPreferredMaturity;
@@ -2594,39 +2552,43 @@ LLMaturityPreferencesResponder::~LLMaturityPreferencesResponder()
{
}
-void LLMaturityPreferencesResponder::result(const LLSD &pContent)
+void LLMaturityPreferencesResponder::httpSuccess()
{
- U8 actualMaturity = parseMaturityFromServerResponse(pContent);
+ U8 actualMaturity = parseMaturityFromServerResponse(getContent());
if (actualMaturity != mPreferredMaturity)
{
- llwarns << "while attempting to change maturity preference from '" << LLViewerRegion::accessToString(mPreviousMaturity)
- << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) << "', the server responded with '"
- << LLViewerRegion::accessToString(actualMaturity) << "' [value:" << static_cast<U32>(actualMaturity) << ", llsd:"
- << pContent << "]" << llendl;
+ LL_WARNS() << "while attempting to change maturity preference from '"
+ << LLViewerRegion::accessToString(mPreviousMaturity)
+ << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity)
+ << "', the server responded with '"
+ << LLViewerRegion::accessToString(actualMaturity)
+ << "' [value:" << static_cast<U32>(actualMaturity)
+ << "], " << dumpResponse() << LL_ENDL;
}
mAgent->handlePreferredMaturityResult(actualMaturity);
}
-void LLMaturityPreferencesResponder::errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent)
+void LLMaturityPreferencesResponder::httpFailure()
{
- llwarns << "while attempting to change maturity preference from '" << LLViewerRegion::accessToString(mPreviousMaturity)
- << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) << "', we got an error with [status:"
- << pStatus << "]: " << (pContent.isDefined() ? pContent : LLSD(pReason)) << llendl;
+ LL_WARNS() << "while attempting to change maturity preference from '"
+ << LLViewerRegion::accessToString(mPreviousMaturity)
+ << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity)
+ << "', " << dumpResponse() << LL_ENDL;
mAgent->handlePreferredMaturityError();
}
-U8 LLMaturityPreferencesResponder::parseMaturityFromServerResponse(const LLSD &pContent)
+U8 LLMaturityPreferencesResponder::parseMaturityFromServerResponse(const LLSD &pContent) const
{
U8 maturity = SIM_ACCESS_MIN;
- llassert(!pContent.isUndefined());
+ llassert(pContent.isDefined());
llassert(pContent.isMap());
llassert(pContent.has("access_prefs"));
llassert(pContent.get("access_prefs").isMap());
llassert(pContent.get("access_prefs").has("max"));
llassert(pContent.get("access_prefs").get("max").isString());
- if (!pContent.isUndefined() && pContent.isMap() && pContent.has("access_prefs")
+ if (pContent.isDefined() && pContent.isMap() && pContent.has("access_prefs")
&& pContent.get("access_prefs").isMap() && pContent.get("access_prefs").has("max")
&& pContent.get("access_prefs").get("max").isString())
{
@@ -2661,8 +2623,8 @@ void LLAgent::handlePreferredMaturityResult(U8 pServerMaturity)
// server by re-sending our last known request. Cap the re-tries at 3 just to be safe.
else if (++mMaturityPreferenceNumRetries <= 3)
{
- llinfos << "Retrying attempt #" << mMaturityPreferenceNumRetries << " to set viewer preferred maturity to '"
- << LLViewerRegion::accessToString(mLastKnownRequestMaturity) << "'" << llendl;
+ LL_INFOS() << "Retrying attempt #" << mMaturityPreferenceNumRetries << " to set viewer preferred maturity to '"
+ << LLViewerRegion::accessToString(mLastKnownRequestMaturity) << "'" << LL_ENDL;
sendMaturityPreferenceToServer(mLastKnownRequestMaturity);
}
// Else, the viewer is style out of sync with the server after 3 retries, so inform the user
@@ -2689,8 +2651,8 @@ void LLAgent::handlePreferredMaturityError()
// the server, but not quite sure why we are
if (mLastKnownRequestMaturity == mLastKnownResponseMaturity)
{
- llwarns << "Got an error but maturity preference '" << LLViewerRegion::accessToString(mLastKnownRequestMaturity)
- << "' seems to be in sync with the server" << llendl;
+ LL_WARNS() << "Got an error but maturity preference '" << LLViewerRegion::accessToString(mLastKnownRequestMaturity)
+ << "' seems to be in sync with the server" << LL_ENDL;
reportPreferredMaturitySuccess();
}
// Else, the more likely case is that the last request does not match the last response,
@@ -2744,7 +2706,7 @@ void LLAgent::reportPreferredMaturityError()
{
bool tmpIsDoSendMaturityPreferenceToServer = mIsDoSendMaturityPreferenceToServer;
mIsDoSendMaturityPreferenceToServer = false;
- llinfos << "Setting viewer preferred maturity to '" << LLViewerRegion::accessToString(mLastKnownResponseMaturity) << "'" << llendl;
+ LL_INFOS() << "Setting viewer preferred maturity to '" << LLViewerRegion::accessToString(mLastKnownResponseMaturity) << "'" << LL_ENDL;
gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(mLastKnownResponseMaturity));
mIsDoSendMaturityPreferenceToServer = tmpIsDoSendMaturityPreferenceToServer;
}
@@ -2772,7 +2734,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)
// If we don't have a region, report it as an error
if (getRegion() == NULL)
{
- responderPtr->errorWithContent(0U, "region is not defined", LLSD());
+ responderPtr->failureResult(0U, "region is not defined", LLSD());
}
else
{
@@ -2782,7 +2744,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)
// If the capability is not defined, report it as an error
if (url.empty())
{
- responderPtr->errorWithContent(0U,
+ responderPtr->failureResult(0U,
"capability 'UpdateAgentInformation' is not defined for region", LLSD());
}
else
@@ -2793,8 +2755,8 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)
LLSD body = LLSD::emptyMap();
body["access_prefs"] = access_prefs;
- llinfos << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity)
- << "' via capability to: " << url << llendl;
+ LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity)
+ << "' via capability to: " << url << LL_ENDL;
LLSD headers;
LLHTTPClient::post(url, body, responderPtr, headers, 30.0f);
}
@@ -2869,10 +2831,10 @@ BOOL LLAgent::isInGroup(const LLUUID& group_id, BOOL ignore_god_mode /* FALSE */
if (!ignore_god_mode && isGodlike())
return true;
- S32 count = mGroups.count();
- for(S32 i = 0; i < count; ++i)
+ U32 count = mGroups.size();
+ for(U32 i = 0; i < count; ++i)
{
- if(mGroups.get(i).mID == group_id)
+ if(mGroups[i].mID == group_id)
{
return TRUE;
}
@@ -2889,12 +2851,12 @@ BOOL LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const
// GP_NO_POWERS can also mean no power is enough to grant an ability.
if (GP_NO_POWERS == power) return FALSE;
- S32 count = mGroups.count();
- for(S32 i = 0; i < count; ++i)
+ U32 count = mGroups.size();
+ for(U32 i = 0; i < count; ++i)
{
- if(mGroups.get(i).mID == group_id)
+ if(mGroups[i].mID == group_id)
{
- return (BOOL)((mGroups.get(i).mPowers & power) > 0);
+ return (BOOL)((mGroups[i].mPowers & power) > 0);
}
}
return FALSE;
@@ -2910,12 +2872,12 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const
if (isGodlike())
return GP_ALL_POWERS;
- S32 count = mGroups.count();
- for(S32 i = 0; i < count; ++i)
+ U32 count = mGroups.size();
+ for(U32 i = 0; i < count; ++i)
{
- if(mGroups.get(i).mID == group_id)
+ if(mGroups[i].mID == group_id)
{
- return (mGroups.get(i).mPowers);
+ return (mGroups[i].mPowers);
}
}
@@ -2924,12 +2886,12 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const
BOOL LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const
{
- S32 count = mGroups.count();
+ S32 count = mGroups.size();
for(S32 i = 0; i < count; ++i)
{
- if(mGroups.get(i).mID == group_id)
+ if(mGroups[i].mID == group_id)
{
- data = mGroups.get(i);
+ data = mGroups[i];
return TRUE;
}
}
@@ -2938,12 +2900,12 @@ BOOL LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const
S32 LLAgent::getGroupContribution(const LLUUID& group_id) const
{
- S32 count = mGroups.count();
+ S32 count = mGroups.size();
for(S32 i = 0; i < count; ++i)
{
- if(mGroups.get(i).mID == group_id)
+ if(mGroups[i].mID == group_id)
{
- S32 contribution = mGroups.get(i).mContribution;
+ S32 contribution = mGroups[i].mContribution;
return contribution;
}
}
@@ -2952,12 +2914,12 @@ S32 LLAgent::getGroupContribution(const LLUUID& group_id) const
BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution)
{
- S32 count = mGroups.count();
+ S32 count = mGroups.size();
for(S32 i = 0; i < count; ++i)
{
- if(mGroups.get(i).mID == group_id)
+ if(mGroups[i].mID == group_id)
{
- mGroups.get(i).mContribution = contribution;
+ mGroups[i].mContribution = contribution;
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("SetGroupContribution");
msg->nextBlock("AgentData");
@@ -2975,13 +2937,13 @@ BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution)
BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile)
{
- S32 count = mGroups.count();
+ S32 count = mGroups.size();
for(S32 i = 0; i < count; ++i)
{
- if(mGroups.get(i).mID == group_id)
+ if(mGroups[i].mID == group_id)
{
- mGroups.get(i).mAcceptNotices = accept_notices;
- mGroups.get(i).mListInProfile = list_in_profile;
+ mGroups[i].mAcceptNotices = accept_notices;
+ mGroups[i].mListInProfile = list_in_profile;
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("SetGroupAcceptNotices");
msg->nextBlock("AgentData");
@@ -3001,7 +2963,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
BOOL LLAgent::canJoinGroups() const
{
- return mGroups.count() < gMaxAgentGroups;
+ return (S32)mGroups.size() < gMaxAgentGroups;
}
LLQuaternion LLAgent::getHeadRotation()
@@ -3030,7 +2992,7 @@ LLQuaternion LLAgent::getHeadRotation()
return rot;
}
-void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request)
+void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request)
{
if (gAgentID.isNull())
{
@@ -3045,7 +3007,7 @@ void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimReque
msg->addUUIDFast(_PREHASH_AgentID, getID());
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
- for (S32 i = 0; i < anim_ids.count(); i++)
+ for (S32 i = 0; i < anim_ids.size(); i++)
{
if (anim_ids[i].isNull())
{
@@ -3282,7 +3244,7 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **)
if (agent_id != gAgentID)
{
- llwarns << "processAgentDropGroup for agent other than me" << llendl;
+ LL_WARNS() << "processAgentDropGroup for agent other than me" << LL_ENDL;
return;
}
@@ -3292,10 +3254,10 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **)
// Remove the group if it already exists remove it and add the new data to pick up changes.
LLGroupData gd;
gd.mID = group_id;
- S32 index = gAgent.mGroups.find(gd);
- if (index != -1)
+ std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
+ if (found_it != gAgent.mGroups.end())
{
- gAgent.mGroups.remove(index);
+ gAgent.mGroups.erase(found_it);
if (gAgent.getGroupID() == group_id)
{
gAgent.mGroupID.setNull();
@@ -3313,7 +3275,7 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **)
}
else
{
- llwarns << "processAgentDropGroup, agent is not part of group " << group_id << llendl;
+ LL_WARNS() << "processAgentDropGroup, agent is not part of group " << group_id << LL_ENDL;
}
}
@@ -3330,8 +3292,7 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode
!input.has("body") )
{
//what to do with badly formed message?
- response->statusUnknownError(400);
- response->result(LLSD("Invalid message parameters"));
+ response->extendedResult(HTTP_BAD_REQUEST, LLSD("Invalid message parameters"));
}
LLSD body = input["body"];
@@ -3346,7 +3307,7 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode
body["AgentData"].isArray() &&
body["AgentData"][0].isMap() )
{
- llinfos << "VALID DROP GROUP" << llendl;
+ LL_INFOS() << "VALID DROP GROUP" << LL_ENDL;
//there is only one set of data in the AgentData block
LLSD agent_data = body["AgentData"][0];
@@ -3358,8 +3319,8 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode
if (agent_id != gAgentID)
{
- llwarns
- << "AgentDropGroup for agent other than me" << llendl;
+ LL_WARNS()
+ << "AgentDropGroup for agent other than me" << LL_ENDL;
response->notFound();
return;
@@ -3369,10 +3330,10 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode
// and add the new data to pick up changes.
LLGroupData gd;
gd.mID = group_id;
- S32 index = gAgent.mGroups.find(gd);
- if (index != -1)
+ std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd);
+ if (found_it != gAgent.mGroups.end())
{
- gAgent.mGroups.remove(index);
+ gAgent.mGroups.erase(found_it);
if (gAgent.getGroupID() == group_id)
{
gAgent.mGroupID.setNull();
@@ -3390,9 +3351,9 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode
}
else
{
- llwarns
+ LL_WARNS()
<< "AgentDropGroup, agent is not part of group "
- << group_id << llendl;
+ << group_id << LL_ENDL;
}
response->result(LLSD());
@@ -3400,8 +3361,7 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode
else
{
//what to do with badly formed message?
- response->statusUnknownError(400);
- response->result(LLSD("Invalid message parameters"));
+ response->extendedResult(HTTP_BAD_REQUEST, LLSD("Invalid message parameters"));
}
}
};
@@ -3419,13 +3379,12 @@ void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **)
if (agent_id != gAgentID)
{
- llwarns << "processAgentGroupDataUpdate for agent other than me" << llendl;
+ LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL;
return;
}
S32 count = msg->getNumberOfBlocksFast(_PREHASH_GroupData);
LLGroupData group;
- S32 index = -1;
bool need_floater_update = false;
for(S32 i = 0; i < count; ++i)
{
@@ -3440,12 +3399,12 @@ void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **)
{
need_floater_update = true;
// Remove the group if it already exists remove it and add the new data to pick up changes.
- index = gAgent.mGroups.find(group);
- if (index != -1)
+ std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
+ if (found_it != gAgent.mGroups.end())
{
- gAgent.mGroups.remove(index);
+ gAgent.mGroups.erase(found_it);
}
- gAgent.mGroups.put(group);
+ gAgent.mGroups.push_back(group);
}
if (need_floater_update)
{
@@ -3469,7 +3428,7 @@ class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode
if (agent_id != gAgentID)
{
- llwarns << "processAgentGroupDataUpdate for agent other than me" << llendl;
+ LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL;
return;
}
@@ -3484,7 +3443,6 @@ class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode
{
LLGroupData group;
- S32 index = -1;
bool need_floater_update = false;
group.mID = (*iter_group)["GroupID"].asUUID();
@@ -3501,12 +3459,12 @@ class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode
{
need_floater_update = true;
// Remove the group if it already exists remove it and add the new data to pick up changes.
- index = gAgent.mGroups.find(group);
- if (index != -1)
+ std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group);
+ if (found_it != gAgent.mGroups.end())
{
- gAgent.mGroups.remove(index);
+ gAgent.mGroups.erase(found_it);
}
- gAgent.mGroups.put(group);
+ gAgent.mGroups.push_back(group);
}
if (need_floater_update)
{
@@ -3528,7 +3486,7 @@ void LLAgent::processAgentDataUpdate(LLMessageSystem *msg, void **)
if (agent_id != gAgentID)
{
- llwarns << "processAgentDataUpdate for agent other than me" << llendl;
+ LL_WARNS() << "processAgentDataUpdate for agent other than me" << LL_ENDL;
return;
}
@@ -3685,82 +3643,6 @@ void LLAgent::processControlRelease(LLMessageSystem *msg, void **)
}
*/
-//static
-void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void **user_data)
-{
- gAgentQueryManager.mNumPendingQueries--;
- if (gAgentQueryManager.mNumPendingQueries == 0)
- {
- selfStopPhase("fetch_texture_cache_entries");
- }
-
- if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
- {
- llwarns << "No avatar for user in cached texture update!" << llendl;
- return;
- }
-
- if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance())
- {
- // ignore baked textures when in customize mode
- return;
- }
-
- S32 query_id;
- mesgsys->getS32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, query_id);
-
- S32 num_texture_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_WearableData);
-
-
- S32 num_results = 0;
- for (S32 texture_block = 0; texture_block < num_texture_blocks; texture_block++)
- {
- LLUUID texture_id;
- U8 texture_index;
-
- mesgsys->getUUIDFast(_PREHASH_WearableData, _PREHASH_TextureID, texture_id, texture_block);
- mesgsys->getU8Fast(_PREHASH_WearableData, _PREHASH_TextureIndex, texture_index, texture_block);
-
-
- if ((S32)texture_index < TEX_NUM_INDICES )
- {
- const LLAvatarAppearanceDictionary::TextureEntry *texture_entry = LLAvatarAppearanceDictionary::instance().getTexture((ETextureIndex)texture_index);
- if (texture_entry)
- {
- EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex;
-
- if (gAgentQueryManager.mActiveCacheQueries[baked_index] == query_id)
- {
- if (texture_id.notNull())
- {
- //llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
- gAgentAvatarp->setCachedBakedTexture((ETextureIndex)texture_index, texture_id);
- //gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
- gAgentQueryManager.mActiveCacheQueries[baked_index] = 0;
- num_results++;
- }
- else
- {
- // no cache of this bake. request upload.
- gAgentAvatarp->invalidateComposite(gAgentAvatarp->getLayerSet(baked_index),TRUE);
- }
- }
- }
- }
- }
- llinfos << "Received cached texture response for " << num_results << " textures." << llendl;
- gAgentAvatarp->outputRezTiming("Fetched agent wearables textures from cache. Will now load them");
-
- gAgentAvatarp->updateMeshTextures();
-
- if (gAgentQueryManager.mNumPendingQueries == 0)
- {
- // RN: not sure why composites are disabled at this point
- gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
- gAgent.sendAgentSetAppearance();
- }
-}
-
BOOL LLAgent::anyControlGrabbed() const
{
for (U32 i = 0; i < TOTAL_CONTROLS; i++)
@@ -3826,7 +3708,7 @@ bool LLAgent::teleportCore(bool is_local)
{
if ((TELEPORT_NONE != mTeleportState) && (mTeleportState != TELEPORT_PENDING))
{
- llwarns << "Attempt to teleport when already teleporting." << llendl;
+ LL_WARNS() << "Attempt to teleport when already teleporting." << LL_ENDL;
return false;
}
@@ -3880,7 +3762,7 @@ bool LLAgent::teleportCore(bool is_local)
gAgentCamera.resetView(FALSE);
// local logic
- LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TELEPORT_COUNT);
+ add(LLStatViewer::TELEPORT, 1);
if (is_local)
{
gAgent.setTeleportState( LLAgent::TELEPORT_LOCAL );
@@ -3892,6 +3774,7 @@ bool LLAgent::teleportCore(bool is_local)
//release geometry from old location
gPipeline.resetVertexBuffers();
+ LLSpatialPartition::sTeleportRequested = TRUE;
}
make_ui_sound("UISndTeleportOut");
@@ -4104,6 +3987,7 @@ void LLAgent::teleportCancel()
}
clearTeleportRequest();
gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
+ gPipeline.resetVertexBuffers();
}
@@ -4136,7 +4020,7 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global)
else if(regionp &&
teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY])))
{
- llwarns << "Using deprecated teleportlocationrequest." << llendl;
+ LL_WARNS() << "Using deprecated teleportlocationrequest." << LL_ENDL;
// send the message
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_TeleportLocationRequest);
@@ -4197,7 +4081,7 @@ void LLAgent::setTeleportState(ETeleportState state)
case TELEPORT_ARRIVING:
// First two position updates after a teleport tend to be weird
- LLViewerStats::getInstance()->mAgentPositionSnaps.mCountOfNextUpdatesToIgnore = 2;
+ //LLViewerStats::getInstance()->mAgentPositionSnaps.mCountOfNextUpdatesToIgnore = 2;
// Let the interested parties know we've teleported.
LLViewerParcelMgr::getInstance()->onTeleportFinished(false, getPositionGlobal());
@@ -4214,7 +4098,7 @@ void LLAgent::stopCurrentAnimations()
// avatar, propagating this change back to the server.
if (isAgentAvatarValid())
{
- LLDynamicArray<LLUUID> anim_ids;
+ std::vector<LLUUID> anim_ids;
for ( LLVOAvatar::AnimIterator anim_it =
gAgentAvatarp->mPlayingAnimations.begin();
@@ -4310,11 +4194,12 @@ void LLAgent::fidget()
void LLAgent::stopFidget()
{
- LLDynamicArray<LLUUID> anims;
- anims.put(ANIM_AGENT_STAND_1);
- anims.put(ANIM_AGENT_STAND_2);
- anims.put(ANIM_AGENT_STAND_3);
- anims.put(ANIM_AGENT_STAND_4);
+ std::vector<LLUUID> anims;
+ anims.reserve(4);
+ anims.push_back(ANIM_AGENT_STAND_1);
+ anims.push_back(ANIM_AGENT_STAND_2);
+ anims.push_back(ANIM_AGENT_STAND_3);
+ anims.push_back(ANIM_AGENT_STAND_4);
gAgent.sendAnimationRequests(anims, ANIM_REQUEST_STOP);
}
@@ -4350,192 +4235,6 @@ void LLAgent::requestLeaveGodMode()
sendReliableMessage();
}
-// For debugging, trace agent state at times appearance message are sent out.
-void LLAgent::dumpSentAppearance(const std::string& dump_prefix)
-{
- std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml");
-
- LLAPRFile outfile;
- std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
- outfile.open(fullpath, LL_APR_WB );
- apr_file_t* file = outfile.getFileHandle();
- if (!file)
- {
- return;
- }
- else
- {
- LL_DEBUGS("Avatar") << "dumping sent appearance message to " << fullpath << llendl;
- }
-
- LLVisualParam* appearance_version_param = gAgentAvatarp->getVisualParam(11000);
- if (appearance_version_param)
- {
- F32 value = appearance_version_param->getWeight();
- dump_visual_param(file, appearance_version_param, value);
- }
- for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
- iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
- ++iter)
- {
- const ETextureIndex index = iter->first;
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
- if (texture_dict->mIsBakedTexture)
- {
- LLTextureEntry* entry = gAgentAvatarp->getTE((U8) index);
- const LLUUID& uuid = entry->getID();
- apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", index, uuid.asString().c_str());
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-// sendAgentSetAppearance()
-//-----------------------------------------------------------------------------
-void LLAgent::sendAgentSetAppearance()
-{
- if (gAgentQueryManager.mNumPendingQueries > 0)
- {
- return;
- }
-
- if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return;
-
- // At this point we have a complete appearance to send and are in a non-baking region.
- // DRANO FIXME
- //gAgentAvatarp->setIsUsingServerBakes(FALSE);
- S32 sb_count, host_count, both_count, neither_count;
- gAgentAvatarp->bakedTextureOriginCounts(sb_count, host_count, both_count, neither_count);
- if (both_count != 0 || neither_count != 0)
- {
- llwarns << "bad bake texture state " << sb_count << "," << host_count << "," << both_count << "," << neither_count << llendl;
- }
- if (sb_count != 0 && host_count == 0)
- {
- gAgentAvatarp->setIsUsingServerBakes(true);
- }
- else if (sb_count == 0 && host_count != 0)
- {
- gAgentAvatarp->setIsUsingServerBakes(false);
- }
- else if (sb_count + host_count > 0)
- {
- llwarns << "unclear baked texture state, not sending appearance" << llendl;
- return;
- }
-
-
- LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << LL_ENDL;
- //dumpAvatarTEs( "sendAgentSetAppearance()" );
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_AgentSetAppearance);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
-
- // correct for the collision tolerance (to make it look like the
- // agent is actually walking on the ground/object)
- // NOTE -- when we start correcting all of the other Havok geometry
- // to compensate for the COLLISION_TOLERANCE ugliness we will have
- // to tweak this number again
- const LLVector3 body_size = gAgentAvatarp->mBodySize + gAgentAvatarp->mAvatarOffset;
- msg->addVector3Fast(_PREHASH_Size, body_size);
-
- // To guard against out of order packets
- // Note: always start by sending 1. This resets the server's count. 0 on the server means "uninitialized"
- mAppearanceSerialNum++;
- msg->addU32Fast(_PREHASH_SerialNum, mAppearanceSerialNum );
-
- // is texture data current relative to wearables?
- // KLW - TAT this will probably need to check the local queue.
- BOOL textures_current = gAgentAvatarp->areTexturesCurrent();
-
- for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
- {
- const ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
-
- // if we're not wearing a skirt, we don't need the texture to be baked
- if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
- {
- continue;
- }
-
- // IMG_DEFAULT_AVATAR means not baked. 0 index should be ignored for baked textures
- if (!gAgentAvatarp->isTextureDefined(texture_index, 0))
- {
- LL_DEBUGS("Avatar") << "texture not current for baked " << (S32)baked_index << " local " << (S32)texture_index << llendl;
- textures_current = FALSE;
- break;
- }
- }
-
- // only update cache entries if we have all our baked textures
-
- // FIXME DRANO need additional check for not in appearance editing
- // mode, if still using local composites need to set using local
- // composites to false, and update mesh textures.
- if (textures_current)
- {
- bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage");
- std::string dump_prefix = gAgentAvatarp->getFullname() + "_sent_appearance";
- if (enable_verbose_dumps)
- {
- dumpSentAppearance(dump_prefix);
- }
- LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "TAT: Sending cached texture data" << LL_ENDL;
- for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
- {
- BOOL generate_valid_hash = TRUE;
- if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLAvatarAppearanceDefines::EBakedTextureIndex)baked_index))
- {
- generate_valid_hash = FALSE;
- LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "Not caching baked texture upload for " << (U32)baked_index << " due to being uploaded at low resolution." << LL_ENDL;
- }
-
- const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, generate_valid_hash);
- if (hash.notNull())
- {
- ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index);
- msg->nextBlockFast(_PREHASH_WearableData);
- msg->addUUIDFast(_PREHASH_CacheID, hash);
- msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
- }
- }
- msg->nextBlockFast(_PREHASH_ObjectData);
- gAgentAvatarp->sendAppearanceMessage( gMessageSystem );
- }
- else
- {
- // If the textures aren't baked, send NULL for texture IDs
- // This means the baked texture IDs on the server will be untouched.
- // Once all textures are baked, another AvatarAppearance message will be sent to update the TEs
- msg->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addBinaryDataFast(_PREHASH_TextureEntry, NULL, 0);
- }
-
-
- S32 transmitted_params = 0;
- for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam();
- param;
- param = (LLViewerVisualParam*)gAgentAvatarp->getNextVisualParam())
- {
- if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) // do not transmit params of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
- {
- msg->nextBlockFast(_PREHASH_VisualParam );
-
- // We don't send the param ids. Instead, we assume that the receiver has the same params in the same sequence.
- const F32 param_value = param->getWeight();
- const U8 new_weight = F32_to_U8(param_value, param->getMinWeight(), param->getMaxWeight());
- msg->addU8Fast(_PREHASH_ParamValue, new_weight );
- transmitted_params++;
- }
- }
-
-// llinfos << "Avatar XML num VisualParams transmitted = " << transmitted_params << llendl;
- sendReliableMessage();
-}
-
void LLAgent::sendAgentDataUpdateRequest()
{
gMessageSystem->newMessageFast(_PREHASH_AgentDataUpdateRequest);
@@ -4573,8 +4272,8 @@ void LLAgent::parseTeleportMessages(const std::string& xml_filename)
if (!success || !root || !root->hasName( "teleport_messages" ))
{
- llerrs << "Problem reading teleport string XML file: "
- << xml_filename << llendl;
+ LL_ERRS() << "Problem reading teleport string XML file: "
+ << xml_filename << LL_ENDL;
return;
}
@@ -4638,11 +4337,11 @@ void LLAgent::sendAgentUpdateUserInfo(bool im_via_email, const std::string& dire
// static
void LLAgent::dumpGroupInfo()
{
- llinfos << "group " << gAgent.mGroupName << llendl;
- llinfos << "ID " << gAgent.mGroupID << llendl;
- llinfos << "powers " << gAgent.mGroupPowers << llendl;
- llinfos << "title " << gAgent.mGroupTitle << llendl;
- //llinfos << "insig " << gAgent.mGroupInsigniaID << llendl;
+ LL_INFOS() << "group " << gAgent.mGroupName << LL_ENDL;
+ LL_INFOS() << "ID " << gAgent.mGroupID << LL_ENDL;
+ LL_INFOS() << "powers " << gAgent.mGroupPowers << LL_ENDL;
+ LL_INFOS() << "title " << gAgent.mGroupTitle << LL_ENDL;
+ //LL_INFOS() << "insig " << gAgent.mGroupInsigniaID << LL_ENDL;
}
// Draw a representation of current autopilot target
@@ -4678,23 +4377,6 @@ void LLAgent::renderAutoPilotTarget()
/********************************************************************************/
-LLAgentQueryManager gAgentQueryManager;
-
-LLAgentQueryManager::LLAgentQueryManager() :
- mWearablesCacheQueryID(0),
- mNumPendingQueries(0),
- mUpdateSerialNum(0)
-{
- for (U32 i = 0; i < BAKED_NUM_INDICES; i++)
- {
- mActiveCacheQueries[i] = 0;
- }
-}
-
-LLAgentQueryManager::~LLAgentQueryManager()
-{
-}
-
//-----------------------------------------------------------------------------
// LLTeleportRequest
//-----------------------------------------------------------------------------