diff options
Diffstat (limited to 'indra/newview/llagent.cpp')
-rw-r--r-- | indra/newview/llagent.cpp | 345 |
1 files changed, 172 insertions, 173 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 6db7088812..759b73e486 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -102,7 +102,7 @@ using namespace LLAvatarAppearanceDefines; extern LLMenuBarGL* gMenuBarView; -const BOOL ANIMATE = TRUE; +const bool ANIMATE = true; const U8 AGENT_STATE_TYPING = 0x04; const U8 AGENT_STATE_EDITING = 0x10; @@ -186,7 +186,7 @@ private: class LLTeleportRequestViaLure : public LLTeleportRequestViaLandmark { public: - LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL pIsLureGodLike); + LLTeleportRequestViaLure(const LLUUID &pLureId, bool pIsLureGodLike); virtual ~LLTeleportRequestViaLure(); virtual void toOstream(std::ostream& os) const; @@ -196,10 +196,10 @@ public: virtual void startTeleport(); protected: - inline BOOL isLureGodLike() const {return mIsLureGodLike;}; + inline bool isLureGodLike() const {return mIsLureGodLike;}; private: - BOOL mIsLureGodLike; + bool mIsLureGodLike; }; class LLTeleportRequestViaLocation : public LLTeleportRequest @@ -372,7 +372,7 @@ bool LLAgent::isMicrophoneOn(const LLSD& sdname) //----------------------------------------------------------------------------- LLAgent::LLAgent() : mGroupPowers(0), - mHideGroupTitle(FALSE), + mHideGroupTitle(false), mGroupID(), mInitialized(false), @@ -404,7 +404,7 @@ LLAgent::LLAgent() : mHttpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID), mTeleportState(TELEPORT_NONE), mRegionp(NULL), - mInterestListMode(LLViewerRegion::IL_MODE_DEFAULT), + mInterestListMode(IL_MODE_DEFAULT), mAgentOriginGlobal(), mPositionGlobal(), @@ -416,24 +416,24 @@ LLAgent::LLAgent() : mRenderState(0), mTypingTimer(), - mViewsPushed(FALSE), + mViewsPushed(false), - mCustomAnim(FALSE), - mShowAvatar(TRUE), + mCustomAnim(false), + mShowAvatar(true), mFrameAgent(), mIsDoNotDisturb(false), mControlFlags(0x00000000), - mbFlagsDirty(FALSE), - mbFlagsNeedReset(FALSE), + mbFlagsDirty(false), + mbFlagsNeedReset(false), - mAutoPilot(FALSE), - mAutoPilotFlyOnStop(FALSE), - mAutoPilotAllowFlying(TRUE), + mAutoPilot(false), + mAutoPilotFlyOnStop(false), + mAutoPilotAllowFlying(true), mAutoPilotTargetGlobal(), mAutoPilotStopDistance(1.f), - mAutoPilotUseRotation(FALSE), + mAutoPilotUseRotation(false), mAutoPilotTargetFacing(LLVector3::zero), mAutoPilotTargetDist(0.f), mAutoPilotNoProgressFrameCount(0), @@ -441,18 +441,18 @@ LLAgent::LLAgent() : mAutoPilotFinishedCallback(NULL), mAutoPilotCallbackData(NULL), - mMovementKeysLocked(FALSE), + mMovementKeysLocked(false), mEffectColor(new LLUIColor(LLColor4(0.f, 1.f, 1.f, 1.f))), - mHaveHomePosition(FALSE), + mHaveHomePosition(false), mHomeRegionHandle( 0 ), mNearChatRadius(CHAT_NORMAL_RADIUS / 2.f), mNextFidgetTime(0.f), mCurrentFidget(0), mFirstLogin(false), - mOutfitChosen(FALSE), + mOutfitChosen(false), mVoiceConnected(false), @@ -480,7 +480,7 @@ void LLAgent::init() { mMoveTimer.start(); - gSavedSettings.declareBOOL("SlowMotionAnimation", FALSE, "Declared in code", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("SlowMotionAnimation", false, "Declared in code", LLControlVariable::PERSIST_NO); gSavedSettings.getControl("SlowMotionAnimation")->getSignal()->connect(boost::bind(&handleSlowMotionAnimation, _2)); // *Note: this is where LLViewerCamera::getInstance() used to be constructed. @@ -846,26 +846,26 @@ void LLAgent::movePitch(F32 mag) // Does this parcel allow you to fly? -BOOL LLAgent::canFly() +bool LLAgent::canFly() { - if (isGodlike()) return TRUE; + if (isGodlike()) return true; LLViewerRegion* regionp = getRegion(); - if (regionp && regionp->getBlockFly()) return FALSE; + if (regionp && regionp->getBlockFly()) return false; LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - if (!parcel) return FALSE; + if (!parcel) return false; // Allow owners to fly on their own land. if (LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_ALLOW_FLY)) { - return TRUE; + return true; } return parcel->getAllowFly(); } -BOOL LLAgent::getFlying() const +bool LLAgent::getFlying() const { return mControlFlags & AGENT_CONTROL_FLY; } @@ -873,7 +873,7 @@ BOOL LLAgent::getFlying() const //----------------------------------------------------------------------------- // setFlying() //----------------------------------------------------------------------------- -void LLAgent::setFlying(BOOL fly, BOOL fail_sound) +void LLAgent::setFlying(bool fly, bool fail_sound) { if (isAgentAvatarValid()) { @@ -896,7 +896,7 @@ void LLAgent::setFlying(BOOL fly, BOOL fail_sound) if (fly) { - BOOL was_flying = getFlying(); + bool was_flying = getFlying(); if (!canFly() && !was_flying) { // parcel doesn't let you start fly @@ -923,7 +923,7 @@ void LLAgent::setFlying(BOOL fly, BOOL fail_sound) // Update Movement Controls according to Fly mode LLFloaterMove::setFlyingMode(fly); - mbFlagsDirty = TRUE; + mbFlagsDirty = true; } @@ -939,7 +939,7 @@ void LLAgent::toggleFlying() LLToolPie::instance().stopClickToWalk(); } - BOOL fly = !gAgent.getFlying(); + bool fly = !gAgent.getFlying(); gAgent.mMoveTimer.reset(); LLFirstUse::notMoving(false); @@ -951,7 +951,7 @@ void LLAgent::toggleFlying() // static bool LLAgent::enableFlying() { - BOOL sitting = FALSE; + bool sitting = false; if (isAgentAvatarValid()) { sitting = gAgentAvatarp->isSitting(); @@ -962,7 +962,7 @@ bool LLAgent::enableFlying() // static bool LLAgent::isSitting() { - BOOL sitting = FALSE; + bool sitting = false; if (isAgentAvatarValid()) { sitting = gAgentAvatarp->isSitting(); @@ -998,9 +998,9 @@ void LLAgent::capabilityReceivedCallback(const LLUUID ®ion_id, LLViewerRegion LLAppViewer::instance()->updateNameLookupUrl(regionp); } - if (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360) + if (gAgent.getInterestListMode() == IL_MODE_360) { - gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360); + gAgent.changeInterestListMode(IL_MODE_360); } } } @@ -1147,7 +1147,7 @@ void LLAgent::removeRegionChangedCallback(boost::signals2::connection callback) //----------------------------------------------------------------------------- // inPrelude() //----------------------------------------------------------------------------- -BOOL LLAgent::inPrelude() +bool LLAgent::inPrelude() { return mRegionp && mRegionp->isPrelude(); } @@ -1166,7 +1166,7 @@ std::string LLAgent::getRegionCapability(const std::string &name) // canManageEstate() //----------------------------------------------------------------------------- -BOOL LLAgent::canManageEstate() const +bool LLAgent::canManageEstate() const { return mRegionp && mRegionp->canManageEstate(); } @@ -1312,7 +1312,7 @@ boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot //----------------------------------------------------------------------------- S32 LLAgent::getRegionsVisited() const { - return mRegionsVisited.size(); + return static_cast<S32>(mRegionsVisited.size()); } //----------------------------------------------------------------------------- @@ -1542,7 +1542,7 @@ U32 LLAgent::getControlFlags() void LLAgent::setControlFlags(U32 mask) { mControlFlags |= mask; - mbFlagsDirty = TRUE; + mbFlagsDirty = true; } @@ -1555,14 +1555,14 @@ void LLAgent::clearControlFlags(U32 mask) mControlFlags &= ~mask; if (old_flags != mControlFlags) { - mbFlagsDirty = TRUE; + mbFlagsDirty = true; } } //----------------------------------------------------------------------------- // controlFlagsDirty() //----------------------------------------------------------------------------- -BOOL LLAgent::controlFlagsDirty() const +bool LLAgent::controlFlagsDirty() const { return mbFlagsDirty; } @@ -1572,7 +1572,7 @@ BOOL LLAgent::controlFlagsDirty() const //----------------------------------------------------------------------------- void LLAgent::enableControlFlagReset() { - mbFlagsNeedReset = TRUE; + mbFlagsNeedReset = true; } //----------------------------------------------------------------------------- @@ -1582,8 +1582,8 @@ void LLAgent::resetControlFlags() { if (mbFlagsNeedReset) { - mbFlagsNeedReset = FALSE; - mbFlagsDirty = FALSE; + mbFlagsNeedReset = false; + mbFlagsDirty = false; // reset all of the ephemeral flags // some flags are managed elsewhere mControlFlags &= AGENT_CONTROL_AWAY | AGENT_CONTROL_FLY | AGENT_CONTROL_MOUSELOOK; @@ -1630,7 +1630,7 @@ void LLAgent::clearAFK() //----------------------------------------------------------------------------- // getAFK() //----------------------------------------------------------------------------- -BOOL LLAgent::getAFK() const +bool LLAgent::getAFK() const { return (mControlFlags & AGENT_CONTROL_AWAY) != 0; } @@ -1667,11 +1667,11 @@ void LLAgent::startAutoPilotGlobal( const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, - void (*finish_callback)(BOOL, void *), + void (*finish_callback)(bool, void *), void *callback_data, F32 stop_distance, F32 rot_threshold, - BOOL allow_flying) + bool allow_flying) { if (!isAgentAvatarValid()) { @@ -1728,38 +1728,38 @@ void LLAgent::startAutoPilotGlobal( } else { - mAutoPilotFlyOnStop = FALSE; + mAutoPilotFlyOnStop = false; } if (distance > 30.0 && mAutoPilotAllowFlying) { - setFlying(TRUE); + setFlying(true); } if ( distance > 1.f && mAutoPilotAllowFlying && heightDelta > (sqrtf(mAutoPilotStopDistance) + 1.f)) { - setFlying(TRUE); + setFlying(true); // Do not force flying for "Sit" behavior to prevent flying after pressing "Stand" // from an object. See EXT-1655. if ("Sit" != mAutoPilotBehaviorName) - mAutoPilotFlyOnStop = TRUE; + mAutoPilotFlyOnStop = true; } - mAutoPilot = TRUE; + mAutoPilot = true; setAutoPilotTargetGlobal(target_global); if (target_rotation) { - mAutoPilotUseRotation = TRUE; + mAutoPilotUseRotation = true; mAutoPilotTargetFacing = LLVector3::x_axis * *target_rotation; mAutoPilotTargetFacing.mV[VZ] = 0.f; mAutoPilotTargetFacing.normalize(); } else { - mAutoPilotUseRotation = FALSE; + mAutoPilotUseRotation = false; } mAutoPilotNoProgressFrameCount = 0; @@ -1797,7 +1797,7 @@ void LLAgent::setAutoPilotTargetGlobal(const LLVector3d &target_global) //----------------------------------------------------------------------------- // startFollowPilot() //----------------------------------------------------------------------------- -void LLAgent::startFollowPilot(const LLUUID &leader_id, BOOL allow_flying, F32 stop_distance) +void LLAgent::startFollowPilot(const LLUUID &leader_id, bool allow_flying, F32 stop_distance) { mLeaderID = leader_id; if ( mLeaderID.isNull() ) return; @@ -1823,11 +1823,11 @@ void LLAgent::startFollowPilot(const LLUUID &leader_id, BOOL allow_flying, F32 s //----------------------------------------------------------------------------- // stopAutoPilot() //----------------------------------------------------------------------------- -void LLAgent::stopAutoPilot(BOOL user_cancel) +void LLAgent::stopAutoPilot(bool user_cancel) { if (mAutoPilot) { - mAutoPilot = FALSE; + mAutoPilot = false; if (mAutoPilotUseRotation && !user_cancel) { resetAxes(mAutoPilotTargetFacing); @@ -1885,7 +1885,7 @@ void LLAgent::autoPilot(F32 *delta_yaw) if (gAgentAvatarp->mInAir && mAutoPilotAllowFlying) { - setFlying(TRUE); + setFlying(true); } LLVector3 at; @@ -2080,7 +2080,7 @@ void LLAgent::propagate(const F32 dt) // handle auto-land behavior if (isAgentAvatarValid()) { - BOOL in_air = gAgentAvatarp->mInAir; + bool in_air = gAgentAvatarp->mInAir; LLVector3 land_vel = getVelocity(); land_vel.mV[VZ] = 0.f; @@ -2090,7 +2090,7 @@ void LLAgent::propagate(const F32 dt) && gSavedSettings.getBOOL("AutomaticFly")) { // land automatically - setFlying(FALSE); + setFlying(false); } } @@ -2154,23 +2154,23 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent) return s; } -// TRUE if your own avatar needs to be rendered. Usually only +// true if your own avatar needs to be rendered. Usually only // in third person and build. //----------------------------------------------------------------------------- // needsRenderAvatar() //----------------------------------------------------------------------------- -BOOL LLAgent::needsRenderAvatar() +bool LLAgent::needsRenderAvatar() { if (gAgentCamera.cameraMouselook() && !LLVOAvatar::sVisibleInFirstPerson) { - return FALSE; + return false; } return mShowAvatar && mOutfitChosen; } -// TRUE if we need to render your own avatar's head. -BOOL LLAgent::needsRenderHead() +// true if we need to render your own avatar's head. +bool LLAgent::needsRenderHead() { return (LLVOAvatar::sVisibleInFirstPerson && LLPipeline::sReflectionRender) || (mShowAvatar && !gAgentCamera.cameraMouselook()); } @@ -2203,7 +2203,7 @@ void LLAgent::startTyping() sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START); } (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))-> - sendChatFromViewer("", CHAT_TYPE_START, FALSE); + sendChatFromViewer("", CHAT_TYPE_START, false); } //----------------------------------------------------------------------------- @@ -2216,7 +2216,7 @@ void LLAgent::stopTyping() clearRenderState(AGENT_STATE_TYPING); sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP); (LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))-> - sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); + sendChatFromViewer("", CHAT_TYPE_STOP, false); } } @@ -2291,19 +2291,19 @@ void LLAgent::endAnimationUpdateUI() // show mouse cursor gViewerWindow->showCursor(); // show menus - gMenuBarView->setVisible(TRUE); - LLNavigationBar::getInstance()->setVisible(TRUE && gSavedSettings.getBOOL("ShowNavbarNavigationPanel")); + gMenuBarView->setVisible(true); + LLNavigationBar::getInstance()->setVisible(true && gSavedSettings.getBOOL("ShowNavbarNavigationPanel")); gStatusBar->setVisibleForMouselook(true); static LLCachedControl<bool> show_mini_location_panel(gSavedSettings, "ShowMiniLocationPanel"); if (show_mini_location_panel) { - LLPanelTopInfoBar::getInstance()->setVisible(TRUE); + LLPanelTopInfoBar::getInstance()->setVisible(true); } - LLChicletBar::getInstance()->setVisible(TRUE); + LLChicletBar::getInstance()->setVisible(true); - LLPanelStandStopFlying::getInstance()->setVisible(TRUE); + LLPanelStandStopFlying::getInstance()->setVisible(true); LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); @@ -2315,7 +2315,7 @@ void LLAgent::endAnimationUpdateUI() } // Only pop if we have pushed... - if (TRUE == mViewsPushed) + if (true == mViewsPushed) { #if 0 // Use this once all floaters are registered LLFloaterReg::restoreVisibleInstances(); @@ -2340,14 +2340,14 @@ void LLAgent::endAnimationUpdateUI() gFloaterView->popVisibleAll(skip_list); #endif - mViewsPushed = FALSE; + mViewsPushed = false; } gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); if( gMorphView ) { - gMorphView->setVisible( FALSE ); + gMorphView->setVisible( false ); } // Disable mouselook-specific animations @@ -2386,7 +2386,7 @@ void LLAgent::endAnimationUpdateUI() if( gMorphView ) { - gMorphView->setVisible( FALSE ); + gMorphView->setVisible( false ); } if (isAgentAvatarValid()) @@ -2396,7 +2396,7 @@ void LLAgent::endAnimationUpdateUI() sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_STOP); sendAnimationRequest(ANIM_AGENT_CUSTOMIZE_DONE, ANIM_REQUEST_START); - mCustomAnim = FALSE ; + mCustomAnim = false ; } } @@ -2412,19 +2412,19 @@ void LLAgent::endAnimationUpdateUI() { // clean up UI // first show anything hidden by UI toggle - gViewerWindow->setUIVisibility(TRUE); + gViewerWindow->setUIVisibility(true); // then hide stuff we want hidden for mouselook gToolBarView->setToolBarsVisible(false); - gMenuBarView->setVisible(FALSE); - LLNavigationBar::getInstance()->setVisible(FALSE); + gMenuBarView->setVisible(false); + LLNavigationBar::getInstance()->setVisible(false); gStatusBar->setVisibleForMouselook(false); - LLPanelTopInfoBar::getInstance()->setVisible(FALSE); + LLPanelTopInfoBar::getInstance()->setVisible(false); - LLChicletBar::getInstance()->setVisible(FALSE); + LLChicletBar::getInstance()->setVisible(false); - LLPanelStandStopFlying::getInstance()->setVisible(FALSE); + LLPanelStandStopFlying::getInstance()->setVisible(false); // clear out camera lag effect gAgentCamera.clearCameraLag(); @@ -2434,7 +2434,7 @@ void LLAgent::endAnimationUpdateUI() LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); - mViewsPushed = TRUE; + mViewsPushed = true; if (mMouselookModeInSignal) { @@ -2451,15 +2451,15 @@ void LLAgent::endAnimationUpdateUI() LLFloaterView::skip_list_t skip_list; skip_list.insert(LLFloaterReg::findInstance("mini_map")); skip_list.insert(LLFloaterReg::findInstance("beacons")); - gFloaterView->pushVisibleAll(FALSE, skip_list); + gFloaterView->pushVisibleAll(false, skip_list); #endif if( gMorphView ) { - gMorphView->setVisible(FALSE); + gMorphView->setVisible(false); } - gConsole->setVisible( TRUE ); + gConsole->setVisible( true ); if (isAgentAvatarValid()) { @@ -2508,7 +2508,7 @@ void LLAgent::endAnimationUpdateUI() if( gMorphView ) { - gMorphView->setVisible( TRUE ); + gMorphView->setVisible( true ); } // freeze avatar @@ -3061,7 +3061,7 @@ bool LLAgent::requestGetCapability(const std::string &capName, httpCallback_t cb return false; } -BOOL LLAgent::getAdminOverride() const +bool LLAgent::getAdminOverride() const { return mAgentAccess->getAdminOverride(); } @@ -3071,7 +3071,7 @@ void LLAgent::setMaturity(char text) mAgentAccess->setMaturity(text); } -void LLAgent::setAdminOverride(BOOL b) +void LLAgent::setAdminOverride(bool b) { mAgentAccess->setAdminOverride(b); } @@ -3123,43 +3123,43 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const } } -BOOL LLAgent::isInGroup(const LLUUID& group_id, BOOL ignore_god_mode /* FALSE */) const +bool LLAgent::isInGroup(const LLUUID& group_id, bool ignore_god_mode /* false */) const { if (!ignore_god_mode && isGodlike()) return true; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { - return TRUE; + return true; } } - return FALSE; + return false; } // This implementation should mirror LLAgentInfo::hasPowerInGroup -BOOL LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const +bool LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const { if (isGodlikeWithoutAdminMenuFakery()) return true; // GP_NO_POWERS can also mean no power is enough to grant an ability. - if (GP_NO_POWERS == power) return FALSE; + if (GP_NO_POWERS == power) return false; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { - return (BOOL)((mGroups[i].mPowers & power) > 0); + return (bool)((mGroups[i].mPowers & power) > 0); } } - return FALSE; + return false; } -BOOL LLAgent::hasPowerInActiveGroup(U64 power) const +bool LLAgent::hasPowerInActiveGroup(U64 power) const { return (mGroupID.notNull() && (hasPowerInGroup(mGroupID, power))); } @@ -3169,8 +3169,8 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const if (isGodlike()) return GP_ALL_POWERS; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3181,24 +3181,24 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const return GP_NO_POWERS; } -BOOL LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const +bool LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { data = mGroups[i]; - return TRUE; + return true; } } - return FALSE; + return false; } S32 LLAgent::getGroupContribution(const LLUUID& group_id) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3209,10 +3209,10 @@ S32 LLAgent::getGroupContribution(const LLUUID& group_id) const return 0; } -BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) +bool LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3226,16 +3226,16 @@ BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) msg->addUUID("GroupID", group_id); msg->addS32("Contribution", contribution); sendReliableMessage(); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile) +bool LLAgent::setUserGroupFlags(const LLUUID& group_id, bool accept_notices, bool list_in_profile) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3252,13 +3252,13 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO msg->nextBlock("NewData"); msg->addBOOL("ListInProfile", list_in_profile); sendReliableMessage(); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLAgent::canJoinGroups() const +bool LLAgent::canJoinGroups() const { return (S32)mGroups.size() < LLAgentBenefitsMgr::current().getGroupMembershipLimit(); } @@ -3304,16 +3304,15 @@ void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRe msg->addUUIDFast(_PREHASH_AgentID, getID()); msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - for (S32 i = 0; i < anim_ids.size(); i++) + for (const LLUUID& uuid : anim_ids) { - if (anim_ids[i].isNull()) + if (uuid.notNull()) { - continue; + msg->nextBlockFast(_PREHASH_AnimationList); + msg->addUUIDFast(_PREHASH_AnimID, uuid); + msg->addBOOLFast(_PREHASH_StartAnim, request == ANIM_REQUEST_START); + num_valid_anims++; } - msg->nextBlockFast(_PREHASH_AnimationList); - msg->addUUIDFast(_PREHASH_AnimID, (anim_ids[i]) ); - msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE); - num_valid_anims++; } msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList); @@ -3338,8 +3337,8 @@ void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request) msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); msg->nextBlockFast(_PREHASH_AnimationList); - msg->addUUIDFast(_PREHASH_AnimID, (anim_id) ); - msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? TRUE : FALSE); + msg->addUUIDFast(_PREHASH_AnimID, anim_id); + msg->addBOOLFast(_PREHASH_StartAnim, request == ANIM_REQUEST_START); msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList); msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0); @@ -3363,7 +3362,7 @@ void LLAgent::sendAnimationStateReset() msg->nextBlockFast(_PREHASH_AnimationList); msg->addUUIDFast(_PREHASH_AnimID, LLUUID::null ); - msg->addBOOLFast(_PREHASH_StartAnim, FALSE); + msg->addBOOLFast(_PREHASH_StartAnim, false); msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList); msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0); @@ -3404,7 +3403,7 @@ void LLAgent::sendWalkRun(bool running) msgsys->nextBlockFast(_PREHASH_AgentData); msgsys->addUUIDFast(_PREHASH_AgentID, getID()); msgsys->addUUIDFast(_PREHASH_SessionID, getSessionID()); - msgsys->addBOOLFast(_PREHASH_AlwaysRun, BOOL(running) ); + msgsys->addBOOLFast(_PREHASH_AlwaysRun, bool(running) ); sendReliableMessage(); } } @@ -3416,23 +3415,23 @@ void LLAgent::friendsChanged() mProxyForAgents = collector.mProxy; } -BOOL LLAgent::isGrantedProxy(const LLPermissions& perm) +bool LLAgent::isGrantedProxy(const LLPermissions& perm) { return (mProxyForAgents.count(perm.getOwner()) > 0); } -BOOL LLAgent::allowOperation(PermissionBit op, +bool LLAgent::allowOperation(PermissionBit op, const LLPermissions& perm, U64 group_proxy_power, U8 god_minimum) { // Check god level. - if (getGodLevel() >= god_minimum) return TRUE; + if (getGodLevel() >= god_minimum) return true; - if (!perm.isOwned()) return FALSE; + if (!perm.isOwned()) return false; // A group member with group_proxy_power can act as owner. - BOOL is_group_owned; + bool is_group_owned; LLUUID owner_id; perm.getOwnership(owner_id, is_group_owned); LLUUID group_id(perm.getGroup()); @@ -3488,37 +3487,37 @@ void LLAgent::initOriginGlobal(const LLVector3d &origin_global) mAgentOriginGlobal = origin_global; } -BOOL LLAgent::leftButtonGrabbed() const +bool LLAgent::leftButtonGrabbed() const { - const BOOL camera_mouse_look = gAgentCamera.cameraMouselook(); + const bool camera_mouse_look = gAgentCamera.cameraMouselook(); return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) || (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0) || (!camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) || (camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0); } -BOOL LLAgent::rotateGrabbed() const +bool LLAgent::rotateGrabbed() const { return (mControlsTakenCount[CONTROL_YAW_POS_INDEX] > 0) || (mControlsTakenCount[CONTROL_YAW_NEG_INDEX] > 0); } -BOOL LLAgent::forwardGrabbed() const +bool LLAgent::forwardGrabbed() const { return (mControlsTakenCount[CONTROL_AT_POS_INDEX] > 0); } -BOOL LLAgent::backwardGrabbed() const +bool LLAgent::backwardGrabbed() const { return (mControlsTakenCount[CONTROL_AT_NEG_INDEX] > 0); } -BOOL LLAgent::upGrabbed() const +bool LLAgent::upGrabbed() const { return (mControlsTakenCount[CONTROL_UP_POS_INDEX] > 0); } -BOOL LLAgent::downGrabbed() const +bool LLAgent::downGrabbed() const { return (mControlsTakenCount[CONTROL_UP_NEG_INDEX] > 0); } @@ -3814,9 +3813,9 @@ void LLAgent::processScriptControlChange(LLMessageSystem *msg, void **) S32 block_count = msg->getNumberOfBlocks("Data"); for (S32 block_index = 0; block_index < block_count; block_index++) { - BOOL take_controls; + bool take_controls; U32 controls; - BOOL passon; + bool passon; U32 i; msg->getBOOL("Data", "TakeControls", take_controls, block_index); if (take_controls) @@ -3938,19 +3937,19 @@ void LLAgent::processControlRelease(LLMessageSystem *msg, void **) } */ -BOOL LLAgent::anyControlGrabbed() const +bool LLAgent::anyControlGrabbed() const { for (U32 i = 0; i < TOTAL_CONTROLS; i++) { if (gAgent.mControlsTakenCount[i] > 0) - return TRUE; + return true; if (gAgent.mControlsTakenPassedOnCount[i] > 0) - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLAgent::isControlGrabbed(S32 control_index) const +bool LLAgent::isControlGrabbed(S32 control_index) const { return mControlsTakenCount[control_index] > 0; } @@ -3966,22 +3965,22 @@ void LLAgent::forceReleaseControls() void LLAgent::setHomePosRegion( const U64& region_handle, const LLVector3& pos_region) { - mHaveHomePosition = TRUE; + mHaveHomePosition = true; mHomeRegionHandle = region_handle; mHomePosRegion = pos_region; } -BOOL LLAgent::getHomePosGlobal( LLVector3d* pos_global ) +bool LLAgent::getHomePosGlobal( LLVector3d* pos_global ) { if(!mHaveHomePosition) { - return FALSE; + return false; } F32 x = 0; F32 y = 0; from_region_handle( mHomeRegionHandle, &x, &y); pos_global->setVec( x + mHomePosRegion.mV[VX], y + mHomePosRegion.mV[VY], mHomePosRegion.mV[VZ] ); - return TRUE; + return true; } bool LLAgent::isInHomeRegion() @@ -4064,7 +4063,7 @@ bool LLAgent::teleportCore(bool is_local) // Close all pie menus, deselect land, etc. // Don't change the camera until we know teleport succeeded. JC - gAgentCamera.resetView(FALSE); + gAgentCamera.resetView(false); // local logic add(LLStatViewer::TELEPORT, 1); @@ -4075,7 +4074,7 @@ bool LLAgent::teleportCore(bool is_local) } else { - gTeleportDisplay = TRUE; + gTeleportDisplay = true; LL_INFOS("Teleport") << "Non-local, setting teleport state to TELEPORT_START" << LL_ENDL; gAgent.setTeleportState( LLAgent::TELEPORT_START ); } @@ -4108,7 +4107,7 @@ void LLAgent::clearTeleportRequest() { if(LLVoiceClient::instanceExists()) { - LLVoiceClient::getInstance()->setHidden(FALSE); + LLVoiceClient::getInstance()->setHidden(false); } mTeleportRequest.reset(); mTPNeedsNeabyChatSeparator = false; @@ -4138,7 +4137,7 @@ void LLAgent::startTeleportRequest() LL_INFOS("Telport") << "Agent handling start teleport request." << LL_ENDL; if(LLVoiceClient::instanceExists()) { - LLVoiceClient::getInstance()->setHidden(TRUE); + LLVoiceClient::getInstance()->setHidden(true); } if (hasPendingTeleportRequest()) { @@ -4146,7 +4145,7 @@ void LLAgent::startTeleportRequest() mTeleportCanceled.reset(); if (!isMaturityPreferenceSyncedWithServer()) { - gTeleportDisplay = TRUE; + gTeleportDisplay = true; LL_INFOS("Teleport") << "Maturity preference not synced yet, setting teleport state to TELEPORT_PENDING" << LL_ENDL; setTeleportState(TELEPORT_PENDING); } @@ -4221,13 +4220,13 @@ void LLAgent::handleTeleportFailed() LL_WARNS("Teleport") << "Agent handling teleport failure!" << LL_ENDL; if(LLVoiceClient::instanceExists()) { - LLVoiceClient::getInstance()->setHidden(FALSE); + LLVoiceClient::getInstance()->setHidden(false); } setTeleportState(LLAgent::TELEPORT_NONE); // Unlock the UI if the progress bar has been shown. -// gViewerWindow->setShowProgress(FALSE); -// gTeleportDisplay = FALSE; +// gViewerWindow->setShowProgress(false); +// gTeleportDisplay = false; if (mTeleportRequest) { @@ -4273,14 +4272,14 @@ void LLAgent::addTPNearbyChatSeparator() LLChat chat; chat.mFromName = location_name; - chat.mMuted = FALSE; + chat.mMuted = false; chat.mFromID = LLUUID::null; chat.mSourceType = CHAT_SOURCE_TELEPORT; chat.mChatStyle = CHAT_STYLE_TELEPORT_SEP; chat.mText = ""; LLSD args; - args["do_not_log"] = TRUE; + args["do_not_log"] = true; nearby_chat->addMessage(chat, true, args); } } @@ -4364,13 +4363,13 @@ void LLAgent::doTeleportViaLandmark(const LLUUID& landmark_asset_id) } } -void LLAgent::teleportViaLure(const LLUUID& lure_id, BOOL godlike) +void LLAgent::teleportViaLure(const LLUUID& lure_id, bool godlike) { mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLure(lure_id, godlike)); startTeleportRequest(); } -void LLAgent::doTeleportViaLure(const LLUUID& lure_id, BOOL godlike) +void LLAgent::doTeleportViaLure(const LLUUID& lure_id, bool godlike) { LLViewerRegion* regionp = getRegion(); if(regionp && teleportCore()) @@ -4437,7 +4436,7 @@ void LLAgent::restoreCanceledTeleportRequest() gAgent.setTeleportState( LLAgent::TELEPORT_REQUESTED ); mTeleportRequest = mTeleportCanceled; mTeleportCanceled.reset(); - gTeleportDisplay = TRUE; + gTeleportDisplay = true; gTeleportDisplayTimer.reset(); } } @@ -4515,7 +4514,7 @@ void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global) if(!gAgentCamera.isfollowCamLocked()) { - gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction + gAgentCamera.setFocusOnAvatar(false, ANIMATE); // detach camera form avatar, so it keeps direction } U64 region_handle = to_region_handle(pos_global); @@ -4601,7 +4600,7 @@ void LLAgent::stopCurrentAnimations() else { // stop this animation locally - gAgentAvatarp->stopMotion(anim_it->first, TRUE); + gAgentAvatarp->stopMotion(anim_it->first, true); // ...and tell the server to tell everyone. anim_ids.push_back(anim_it->first); } @@ -4698,7 +4697,7 @@ void LLAgent::requestEnterGodMode() msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_RequestBlock); - msg->addBOOLFast(_PREHASH_Godlike, TRUE); + msg->addBOOLFast(_PREHASH_Godlike, true); msg->addUUIDFast(_PREHASH_Token, LLUUID::null); // simulators need to know about your request @@ -4713,7 +4712,7 @@ void LLAgent::requestLeaveGodMode() msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_RequestBlock); - msg->addBOOLFast(_PREHASH_Godlike, FALSE); + msg->addBOOLFast(_PREHASH_Godlike, false); msg->addUUIDFast(_PREHASH_Token, LLUUID::null); // simulator needs to know about your request @@ -4906,7 +4905,7 @@ const std::string& LLAgent::getTeleportStateName() const void LLAgent::parseTeleportMessages(const std::string& xml_filename) { LLXMLNodePtr root; - BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); + bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); if (!success || !root || !root->hasName( "teleport_messages" )) { @@ -5094,7 +5093,7 @@ void LLTeleportRequestViaLandmark::restartTeleport() // LLTeleportRequestViaLure //----------------------------------------------------------------------------- -LLTeleportRequestViaLure::LLTeleportRequestViaLure(const LLUUID &pLureId, BOOL pIsLureGodLike) +LLTeleportRequestViaLure::LLTeleportRequestViaLure(const LLUUID &pLureId, bool pIsLureGodLike) : LLTeleportRequestViaLandmark(pLureId), mIsLureGodLike(pIsLureGodLike) { |