From b32e8140d4126d6fa302947aab2ef0c8ae06fc38 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 30 Jul 2010 00:33:04 -0500 Subject: Restructured WindlightMessage::processWindlight(). --- linden/indra/newview/lightshare.cpp | 91 +++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 43 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp index 29eab07..e7c3410 100644 --- a/linden/indra/newview/lightshare.cpp +++ b/linden/indra/newview/lightshare.cpp @@ -102,53 +102,58 @@ WindlightMessage::~WindlightMessage() // static void WindlightMessage::processWindlight(LLMessageSystem* msg, void**) { - if( gSavedSettings.getBOOL("UseServersideWindlightSettings") ) + if( !gSavedSettings.getBOOL("UseServersideWindlightSettings") ) + return; + + WindlightMessage* wl = new WindlightMessage(msg); + + if( !wl->isValid() ) + return; + + std::string water = LLWaterParamManager::instance()->mCurParams.mName; + std::string sky = LLWLParamManager::instance()->mCurParams.mName; + + // If they are using the default or region settings, just apply + // the new settings, don't bother asking. + if( (sky == "Default" || sky == sSkyPresetName) && + (water == "Default" || water == sWaterPresetName) ) + { + wl->apply(); + delete wl; + return; + } + + if( !ignoreTimerHasExpired() ) { - WindlightMessage* wl = new WindlightMessage(msg); - if( wl->isValid() ) - { - std::string water = LLWaterParamManager::instance()->mCurParams.mName; - std::string sky = LLWLParamManager::instance()->mCurParams.mName; - - // If they are using the default or region settings, just apply - // the new settings, don't bother asking. - if((sky == "Default" || sky == sSkyPresetName) && - (water == "Default" || water == sWaterPresetName)) - { - wl->apply(); - delete wl; - } - else if( !ignoreTimerHasExpired() ) - { - // The user recently ignored a windlight message, so ignore - // this one too, and reset the timer. - resetIgnoreTimer(); - delete wl; - } - else - { - if( sMostRecent == NULL ) - { - // No most recent, so store this and create notification - // asking the user whether to apply or not. - sMostRecent = wl; - LLNotifications::instance() - .add("ConfirmLightShare", - LLSD(), LLSD(), - boost::bind(&applyCallback, _1, _2)); - } - else - { - // No new notification (to avoid spamming the user), just - // store this as most recent. - delete sMostRecent; - sMostRecent = wl; - } - } - } + // The user recently ignored a windlight message, so ignore + // this one too, and reset the timer. + resetIgnoreTimer(); + delete wl; + return; + } + + if( sMostRecent == NULL ) + { + // No most recent, so store this and create notification + // asking the user whether to apply or not. + sMostRecent = wl; + LLNotifications::instance() + .add("ConfirmLightShare", + LLSD(), LLSD(), + boost::bind(&applyCallback, _1, _2)); + return; + } + else + { + // No new notification (to avoid spamming the user), just + // store this as most recent. + delete sMostRecent; + sMostRecent = wl; + return; } } + // static bool WindlightMessage::applyCallback(const LLSD& notification, const LLSD& response) -- cgit v1.1