Merged cleanly with RLVa tip

master
Kitty Barnett 2016-12-03 20:34:36 +01:00
commit eb43f227bc
8 changed files with 74 additions and 38 deletions

View File

@ -165,6 +165,9 @@ public:
validate_signal_t* getValidateSignal() { return &mValidateSignal; }
sanity_signal_t* getSanitySignal() { return &mSanitySignal; }
// [RLVa:KB] - Patch: RLVa-2.1.0
bool hasUnsavedValue() { return mValues.size() > 2; }
// [/RLVa:KB]
bool isDefault() { return (mValues.size() == 1); }
bool isSane();
bool shouldSave(bool nondefault_only);

View File

@ -1320,14 +1320,12 @@ LLVector3d LLAgent::getPosGlobalFromAgent(const LLVector3 &pos_agent) const
void LLAgent::sitDown()
{
// setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
// [RLVa:KB] - Checked: 2010-08-28 (RLVa-1.2.1a) | Added: RLVa-1.2.1a
// RELEASE-RLVa: [SL-2.0.0] Check this function's callers since usually they require explicit blocking
if ( (!rlv_handler_t::isEnabled()) || ((RlvActions::canStand()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SIT))) )
{
setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
}
// [RLVa:KB] - Checked: RLVa-1.2.1
if (!RlvActions::canGroundSit())
return;
// [/RLVa:KB]
setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
}

View File

@ -3388,6 +3388,21 @@ bool LLAppViewer::initConfiguration()
LLEventPumps::instance().obtain("LLControlGroup").post(LLSDMap("init", *ki));
}
// [RLVa:KB] - Patch: RLVa-2.1.0
if (LLControlVariable* pControl = gSavedSettings.getControl(RLV_SETTING_MAIN))
{
if ( (pControl->getValue().asBoolean()) && (pControl->hasUnsavedValue()) )
{
pControl->resetToDefault();
pControl->setValue(false);
std::ostringstream msg;
msg << LLTrans::getString("RLVaToggleMessageLogin", LLSD().with("[STATE]", LLTrans::getString("RLVaToggleDisabled")));
OSMessageBox(msg.str(), LLStringUtil::null, OSMB_OK);
}
}
// [/RLVa:KB]
return true; // Config was successful.
}

View File

@ -254,16 +254,16 @@ bool RlvActions::canPaste(const LLInventoryCategory* pSourceCat, const LLInvento
{
// The user can paste the specified object into the destination if:
// - the source and destination are subject to the same lock type (or none at all) => NOTE: this happens to be the same logic we use for moving
return (isRlvEnabled()) && (pSourceCat) && (pDestCat) &&
((!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().canMoveFolder(pSourceCat->getUUID(), pDestCat->getUUID())));
return (!isRlvEnabled()) ||
( (pSourceCat) && (pDestCat) && ((!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().canMoveFolder(pSourceCat->getUUID(), pDestCat->getUUID()))) );
}
bool RlvActions::canPaste(const LLInventoryItem* pSourceItem, const LLInventoryCategory* pDestCat)
{
// The user can paste the specified object into the destination if:
// - the source and destination are subject to the same lock type (or none at all) => NOTE: this happens to be the same logic we use for moving
return (isRlvEnabled()) && (pSourceItem) && (pDestCat) &&
((!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().canMoveItem(pSourceItem->getUUID(), pDestCat->getUUID())));
return (!isRlvEnabled()) ||
( (pSourceItem) && (pDestCat) && ((!RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().canMoveItem(pSourceItem->getUUID(), pDestCat->getUUID()))) );
}
// ============================================================================
@ -377,6 +377,14 @@ bool RlvActions::canRez()
return (!gRlvHandler.hasBehaviour(RLV_BHVR_REZ));
}
bool RlvActions::canGroundSit()
{
// User can sit on the ground if:
// - not prevented from sitting
// - not prevented from standing up or not currently sitting
return (!hasBehaviour(RLV_BHVR_SIT)) && (canStand());
}
bool RlvActions::canSit(const LLViewerObject* pObj, const LLVector3& posOffset /*=LLVector3::zero*/)
{
// User can sit on the specified object if:

View File

@ -210,6 +210,11 @@ public:
*/
static bool canEdit(const LLViewerObject* pObj);
/*
* Returns true if the user can sit on the ground
*/
static bool canGroundSit();
/*
* Returns true if the user can interact with the specified object (with an optional relative offset)
* (returns true if pObj == nullptr to not short circuit calling code)
@ -237,7 +242,7 @@ public:
static bool canShowLocation();
/*
* Returns true if the user can sit up on the specified object
* Returns true if the user can sit on the specified object (see canGroundSit() for sitting on land)
*/
static bool canSit(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero);

View File

@ -35,8 +35,8 @@ const S32 RLV_VERSION_BUILD_COMPAT = 0;
// Implementation version
const S32 RLVa_VERSION_MAJOR = 2;
const S32 RLVa_VERSION_MINOR = 0;
const S32 RLVa_VERSION_PATCH = 3;
const S32 RLVa_VERSION_MINOR = 1;
const S32 RLVa_VERSION_PATCH = 0;
// Uncomment before a final release
#define RLV_RELEASE

View File

@ -2570,30 +2570,43 @@ ERlvCmdRet RlvForceHandler<RLV_BHVR_SETGROUP>::onCommand(const RlvCommand& rlvCm
template<> template<>
ERlvCmdRet RlvForceHandler<RLV_BHVR_SIT>::onCommand(const RlvCommand& rlvCmd)
{
LLViewerObject* pObj = NULL; LLUUID idTarget(rlvCmd.getOption());
// Sanity checking - we need to know about the object and it should identify a prim/linkset
if ( (idTarget.isNull()) || ((pObj = gObjectList.findObject(idTarget)) == NULL) || (LL_PCODE_VOLUME != pObj->getPCode()) )
LLUUID idTarget;
if (!RlvCommandOptionHelper::parseOption(rlvCmd.getOption(), idTarget))
return RLV_RET_FAILED_OPTION;
if (!RlvActions::canSit(pObj))
return RLV_RET_FAILED_LOCK;
else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid()) )
LLViewerObject* pObj = NULL;
if (idTarget.isNull())
{
if (gAgentAvatarp->isSitting())
if (!RlvActions::canGroundSit())
return RLV_RET_FAILED_LOCK;
gRlvHandler.m_posSitSource = gAgent.getPositionGlobal();
gAgent.sitDown();
}
else if ( ((pObj = gObjectList.findObject(idTarget)) != NULL) && (LL_PCODE_VOLUME == pObj->getPCode()))
{
if (!RlvActions::canSit(pObj))
return RLV_RET_FAILED_LOCK;
// Copy/paste from handle_sit_or_stand()
gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gMessageSystem->nextBlockFast(_PREHASH_TargetObject);
gMessageSystem->addUUIDFast(_PREHASH_TargetID, pObj->mID);
gMessageSystem->addVector3Fast(_PREHASH_Offset, LLVector3::zero);
pObj->getRegion()->sendReliableMessage();
if ((gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (isAgentAvatarValid()))
{
if (gAgentAvatarp->isSitting())
return RLV_RET_FAILED_LOCK;
gRlvHandler.m_posSitSource = gAgent.getPositionGlobal();
}
// Copy/paste from handle_sit_or_stand()
gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gMessageSystem->nextBlockFast(_PREHASH_TargetObject);
gMessageSystem->addUUIDFast(_PREHASH_TargetID, pObj->mID);
gMessageSystem->addVector3Fast(_PREHASH_Offset, LLVector3::zero);
pObj->getRegion()->sendReliableMessage();
}
else
{
return RLV_RET_FAILED_OPTION;
}
return RLV_RET_SUCCESS;
}

View File

@ -610,13 +610,7 @@ bool RlvCommand::parseCommand(const std::string& strCommand, std::string& strBeh
template<>
bool RlvCommandOptionHelper::parseOption<LLUUID>(const std::string& strOption, LLUUID& idOption)
{
if (!LLUUID::validate(strOption))
{
return false;
}
idOption.set(strOption);
return idOption.notNull();
return idOption.set(strOption, false);
}
template<>