From 46fe5d49caef6c8db3df9d88f0d0ec773ef28095 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Fri, 26 Mar 2010 14:33:48 -0400 Subject: EXT-6536 : Make LLVOAvatarSelf a singleton Superficial cleanup so that all instances of gAgent.getAvatarObject() use "LLVOAvatarSelf *avatarp = gAgent.getAvatarObject". --- indra/newview/lltoolpie.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'indra/newview/lltoolpie.cpp') diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 8d4f0f9116..c80db89ef0 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -205,15 +205,16 @@ BOOL LLToolPie::pickLeftMouseDownCallback() // touch behavior down below... break; case CLICK_ACTION_SIT: - - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // agent not already sitting { - handle_object_sit_or_stand(); - // put focus in world when sitting on an object - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } // else nothing (fall through to touch) - + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (avatarp && !avatarp->isSitting()) // agent not already sitting + { + handle_object_sit_or_stand(); + // put focus in world when sitting on an object + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; + } // else nothing (fall through to touch) + } case CLICK_ACTION_PAY: if ((object && object->flagTakesMoney()) || (parent && parent->flagTakesMoney())) @@ -411,9 +412,12 @@ ECursorType cursor_from_object(LLViewerObject* object) switch(click_action) { case CLICK_ACTION_SIT: - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // not already sitting? { - cursor = UI_CURSOR_TOOLSIT; + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (avatarp && !avatarp->isSitting()) // not already sitting? + { + cursor = UI_CURSOR_TOOLSIT; + } } break; case CLICK_ACTION_BUY: -- cgit v1.2.3 From 94e6e10739c8321b6fb651a109901380ef92975a Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 29 Mar 2010 12:00:26 -0400 Subject: EXT-6536 : Make LLVOAvatarSelf a singleton Superficial cleanup to replace all instances of "LLVOAvatarSelf *avatarp = gAgent.getAvatarObject" with "gAgentAvatar". --- indra/newview/lltoolpie.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/newview/lltoolpie.cpp') diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index c80db89ef0..580b483b6b 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -206,8 +206,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback() break; case CLICK_ACTION_SIT: { - LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - if (avatarp && !avatarp->isSitting()) // agent not already sitting + if (isAgentAvatarValid() && !gAgentAvatar->isSitting()) // agent not already sitting { handle_object_sit_or_stand(); // put focus in world when sitting on an object @@ -331,7 +330,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback() } object = (LLViewerObject*)object->getParent(); } - if (object && object == gAgent.getAvatarObject()) + if (object && object == gAgentAvatar) { // we left clicked on avatar, switch to focus mode LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); @@ -413,8 +412,7 @@ ECursorType cursor_from_object(LLViewerObject* object) { case CLICK_ACTION_SIT: { - LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - if (avatarp && !avatarp->isSitting()) // not already sitting? + if (isAgentAvatarValid() && !gAgentAvatar->isSitting()) // not already sitting? { cursor = UI_CURSOR_TOOLSIT; } -- cgit v1.2.3 From 58d76a9ecf83b49e42fabfada27ca20814f93cf3 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 29 Mar 2010 12:11:51 -0400 Subject: EXT-6536 : Make LLVOAvatarSelf a singleton Superficial cleanup to replace all instances of "gAgentAvatar" with "gAgentAvatarp". --- indra/newview/lltoolpie.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/lltoolpie.cpp') diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 580b483b6b..322da2e343 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -206,7 +206,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback() break; case CLICK_ACTION_SIT: { - if (isAgentAvatarValid() && !gAgentAvatar->isSitting()) // agent not already sitting + if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // agent not already sitting { handle_object_sit_or_stand(); // put focus in world when sitting on an object @@ -330,7 +330,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback() } object = (LLViewerObject*)object->getParent(); } - if (object && object == gAgentAvatar) + if (object && object == gAgentAvatarp) { // we left clicked on avatar, switch to focus mode LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); @@ -412,7 +412,7 @@ ECursorType cursor_from_object(LLViewerObject* object) { case CLICK_ACTION_SIT: { - if (isAgentAvatarValid() && !gAgentAvatar->isSitting()) // not already sitting? + if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting? { cursor = UI_CURSOR_TOOLSIT; } -- cgit v1.2.3