diff options
author | Christian Goetze <cg@lindenlab.com> | 2007-08-21 22:17:53 +0000 |
---|---|---|
committer | Christian Goetze <cg@lindenlab.com> | 2007-08-21 22:17:53 +0000 |
commit | ce0a5fe14590b8d675b885fccd5f79d7ea17a302 (patch) | |
tree | 3388e6f8ff02292ec4521d278c841801462945b8 /indra/newview/llstartup.cpp | |
parent | b699ae454d8477d19342d320758cd993d1d28cec (diff) |
EFFECTIVE MERGE: svn merge -r 66133:68118 svn+ssh://svn/svn/linden/branches/maintenance into release
Actual action: branched maintenance-r68118, merged in release, then copied result into release
Diffstat (limited to 'indra/newview/llstartup.cpp')
-rw-r--r-- | indra/newview/llstartup.cpp | 656 |
1 files changed, 304 insertions, 352 deletions
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 74d8aa8e9a..8aa442818e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -196,6 +196,9 @@ LLString gInitialOutfitGender; // "male" or "female" static bool gUseCircuitCallbackCalled = false; +S32 LLStartUp::gStartupState = STATE_FIRST; + + // // local function declaration // @@ -336,7 +339,7 @@ BOOL idle_startup() gImageList.updateImages(0.01f); } - if (STATE_FIRST == gStartupState) + if ( STATE_FIRST == LLStartUp::getStartupState() ) { gViewerWindow->showCursor(); gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT); @@ -585,67 +588,49 @@ BOOL idle_startup() llwarns << "Unreliable timers detected (may be bad PCI chipset)!!" << llendl; } - // Get ready to show the login dialog - if (!gConnectToSomething) + // + // Log on to system + // + if( !gCmdLineFirstName.empty() + && !gCmdLineLastName.empty() + && !gCmdLinePassword.empty()) { - // Don't use a session token, and generate a random user id - gAgentID.generate(); - gAgentSessionID = LLUUID::null; + firstname = gCmdLineFirstName; + lastname = gCmdLineLastName; - gStartupState = STATE_WORLD_INIT; - return do_normal_idle; + LLMD5 pass((unsigned char*)gCmdLinePassword.c_str()); + char md5pass[33]; /* Flawfinder: ignore */ + pass.hex_digest(md5pass); + password = md5pass; + + remember_password = gSavedSettings.getBOOL("RememberPassword"); + show_connect_box = FALSE; } - else if (!gRunLocal) + else if (gAutoLogin || gSavedSettings.getBOOL("AutoLogin")) { - // - // Log on to userserver - // - if( !gCmdLineFirstName.empty() - && !gCmdLineLastName.empty() - && !gCmdLinePassword.empty()) - { - firstname = gCmdLineFirstName; - lastname = gCmdLineLastName; - - LLMD5 pass((unsigned char*)gCmdLinePassword.c_str()); - char md5pass[33]; /* Flawfinder: ignore */ - pass.hex_digest(md5pass); - password = md5pass; - - remember_password = gSavedSettings.getBOOL("RememberPassword"); - show_connect_box = FALSE; - } - else if (gAutoLogin || gSavedSettings.getBOOL("AutoLogin")) - { - firstname = gSavedSettings.getString("FirstName"); - lastname = gSavedSettings.getString("LastName"); - password = load_password_from_disk(); - remember_password = TRUE; - show_connect_box = FALSE; - } - else - { - // if not automatically logging in, display login dialog - // until a valid userserver is selected - firstname = gSavedSettings.getString("FirstName"); - lastname = gSavedSettings.getString("LastName"); - password = load_password_from_disk(); - remember_password = gSavedSettings.getBOOL("RememberPassword"); - show_connect_box = TRUE; - } - - // Go to the next startup state - gStartupState++; - return do_normal_idle; + firstname = gSavedSettings.getString("FirstName"); + lastname = gSavedSettings.getString("LastName"); + password = load_password_from_disk(); + remember_password = TRUE; + show_connect_box = FALSE; } else { - gStartupState++; - return do_normal_idle; + // if not automatically logging in, display login dialog + // until a valid userserver is selected + firstname = gSavedSettings.getString("FirstName"); + lastname = gSavedSettings.getString("LastName"); + password = load_password_from_disk(); + remember_password = gSavedSettings.getBOOL("RememberPassword"); + show_connect_box = TRUE; } + + // Go to the next startup state + LLStartUp::setStartupState( STATE_LOGIN_SHOW ); + return do_normal_idle; } - if (STATE_LOGIN_SHOW == gStartupState) + if (STATE_LOGIN_SHOW == LLStartUp::getStartupState()) { llinfos << "Initializing Window" << llendl; @@ -655,45 +640,37 @@ BOOL idle_startup() timeout_count = 0; - if (gConnectToSomething && !gRunLocal) + if (show_connect_box) { - if (show_connect_box) + if (gNoRender) { - if (gNoRender) - { - llerrs << "Need to autologin or use command line with norender!" << llendl; - } - // Make sure the process dialog doesn't hide things - gViewerWindow->setShowProgress(FALSE); + llerrs << "Need to autologin or use command line with norender!" << llendl; + } + // Make sure the process dialog doesn't hide things + gViewerWindow->setShowProgress(FALSE); - // Show the login dialog - login_show(); + // Show the login dialog + login_show(); - // connect dialog is already shown, so fill in the names - LLPanelLogin::setFields( firstname, lastname, password, remember_password ); - LLPanelLogin::giveFocus(); + // connect dialog is already shown, so fill in the names + LLPanelLogin::setFields( firstname, lastname, password, remember_password ); + LLPanelLogin::giveFocus(); - gSavedSettings.setBOOL("FirstRunThisInstall", FALSE); + gSavedSettings.setBOOL("FirstRunThisInstall", FALSE); - gStartupState++; - } - else - { - // skip directly to message template verification - gStartupState = STATE_LOGIN_CLEANUP; - } + LLStartUp::setStartupState( STATE_LOGIN_WAIT ); // Wait for user input } else { - gMessageSystem->setCircuitProtection(FALSE); - gStartupState = STATE_LOGIN_CLEANUP; + // skip directly to message template verification + LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); } timeout.reset(); return do_normal_idle; } - if (STATE_LOGIN_WAIT == gStartupState) + if (STATE_LOGIN_WAIT == LLStartUp::getStartupState()) { // Don't do anything. Wait for the login view to call the login_callback, // which will push us to the next state. @@ -703,7 +680,7 @@ BOOL idle_startup() return do_normal_idle; } - if (STATE_LOGIN_CLEANUP == gStartupState) + if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState()) { if (show_connect_box) { @@ -771,7 +748,7 @@ BOOL idle_startup() { LLString server_label; S32 domain_name_index; - LLPanelLogin::getServer( server_label, domain_name_index ); + BOOL user_picked_server = LLPanelLogin::getServer( server_label, domain_name_index ); gUserServerChoice = (EUserServerDomain) domain_name_index; gSavedSettings.setS32("ServerChoice", gUserServerChoice); if (gUserServerChoice == USERSERVER_OTHER) @@ -779,14 +756,11 @@ BOOL idle_startup() snprintf(gUserServerName, MAX_STRING, "%s", server_label.c_str()); /* Flawfinder: ignore */ } - // Dave S temp reversion of SL-49082 fix - this code breaks command line urls. I'll fix this with - // the control isDirty() functionality tomorrow. - - //if ( userPickedServer ) - //{ // User picked a grid from the popup, so clear the stored urls so they will be re-generated from gUserServerChoice - // auth_uris.clear(); - // resetURIs(); - //} + if ( user_picked_server ) + { // User picked a grid from the popup, so clear the stored urls and they will be re-generated from gUserServerChoice + auth_uris.clear(); + resetURIs(); + } LLString location; LLPanelLogin::getLocation( location ); @@ -849,18 +823,18 @@ BOOL idle_startup() init_colors(); // skipping over STATE_UPDATE_CHECK because that just waits for input - gStartupState = STATE_LOGIN_AUTH_INIT; + LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT ); return do_normal_idle; } - if (STATE_UPDATE_CHECK == gStartupState) + if (STATE_UPDATE_CHECK == LLStartUp::getStartupState()) { // wait for user to give input via dialog box return do_normal_idle; } - if(STATE_LOGIN_AUTH_INIT == gStartupState) + if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState()) { //#define LL_MINIMIAL_REQUESTED_OPTIONS lldebugs << "STATE_LOGIN_AUTH_INIT" << llendl; @@ -907,10 +881,10 @@ BOOL idle_startup() auth_desc = "Logging in. "; auth_desc += gSecondLife; auth_desc += " may appear frozen. Please wait."; - ++gStartupState; + LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); } - if (STATE_LOGIN_AUTHENTICATE == gStartupState) + if (STATE_LOGIN_AUTHENTICATE == LLStartUp::getStartupState()) { lldebugs << "STATE_LOGIN_AUTHENTICATE" << llendl; set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); @@ -962,11 +936,11 @@ BOOL idle_startup() // reset globals gAcceptTOS = FALSE; gAcceptCriticalMessage = FALSE; - ++gStartupState; + LLStartUp::setStartupState( STATE_LOGIN_NO_DATA_YET ); return do_normal_idle; } - if(STATE_LOGIN_NO_DATA_YET == gStartupState) + if(STATE_LOGIN_NO_DATA_YET == LLStartUp::getStartupState()) { //lldebugs << "STATE_LOGIN_NO_DATA_YET" << llendl; if (!gUserAuthp) @@ -985,13 +959,13 @@ BOOL idle_startup() //llinfos << "waiting..." << llendl; return do_normal_idle; } - ++gStartupState; + LLStartUp::setStartupState( STATE_LOGIN_DOWNLOADING ); progress += 0.01f; set_startup_status(progress, auth_desc.c_str(), auth_message.c_str()); return do_normal_idle; } - if(STATE_LOGIN_DOWNLOADING == gStartupState) + if(STATE_LOGIN_DOWNLOADING == LLStartUp::getStartupState()) { lldebugs << "STATE_LOGIN_DOWNLOADING" << llendl; if (!gUserAuthp) @@ -1010,13 +984,13 @@ BOOL idle_startup() //llinfos << "downloading..." << llendl; return do_normal_idle; } - ++gStartupState; + LLStartUp::setStartupState( STATE_LOGIN_PROCESS_RESPONSE ); progress += 0.01f; set_startup_status(progress, "Processing Response...", auth_message.c_str()); return do_normal_idle; } - if(STATE_LOGIN_PROCESS_RESPONSE == gStartupState) + if(STATE_LOGIN_PROCESS_RESPONSE == LLStartUp::getStartupState()) { lldebugs << "STATE_LOGIN_PROCESS_RESPONSE" << llendl; std::ostringstream emsg; @@ -1055,7 +1029,7 @@ BOOL idle_startup() } // ignoring the duration & options array for now. // Go back to authenticate. - gStartupState = STATE_LOGIN_AUTHENTICATE; + LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); return do_normal_idle; } else @@ -1078,7 +1052,7 @@ BOOL idle_startup() if (show_connect_box) { llinfos << "Need tos agreement" << llendl; - gStartupState = STATE_UPDATE_CHECK; + LLStartUp::setStartupState( STATE_UPDATE_CHECK ); LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_TOS, message_response); tos_dialog->startModal(); @@ -1095,7 +1069,7 @@ BOOL idle_startup() if (show_connect_box) { llinfos << "Need critical message" << llendl; - gStartupState = STATE_UPDATE_CHECK; + LLStartUp::setStartupState( STATE_UPDATE_CHECK ); LLFloaterTOS* tos_dialog = LLFloaterTOS::show(LLFloaterTOS::TOS_CRITICAL_MESSAGE, message_response); tos_dialog->startModal(); @@ -1119,7 +1093,7 @@ BOOL idle_startup() if (show_connect_box) { update_app(TRUE, auth_message); - gStartupState = STATE_UPDATE_CHECK; + LLStartUp::setStartupState( STATE_UPDATE_CHECK ); return FALSE; } else @@ -1134,7 +1108,7 @@ BOOL idle_startup() if (show_connect_box) { update_app(FALSE, auth_message); - gStartupState = STATE_UPDATE_CHECK; + LLStartUp::setStartupState( STATE_UPDATE_CHECK ); gSkipOptionalUpdate = TRUE; return FALSE; } @@ -1157,7 +1131,7 @@ BOOL idle_startup() s << "Previous login attempt failed. Logging in, attempt " << (auth_uri_num + 1) << ". "; auth_desc = s.str(); - gStartupState = STATE_LOGIN_AUTHENTICATE; + LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); auth_uri_num++; return do_normal_idle; } @@ -1387,7 +1361,7 @@ BOOL idle_startup() && first_sim.isOk() && gAgent.mInventoryRootID.notNull()) { - ++gStartupState; + LLStartUp::setStartupState( STATE_WORLD_INIT ); } else { @@ -1431,7 +1405,7 @@ BOOL idle_startup() //--------------------------------------------------------------------- // World Init //--------------------------------------------------------------------- - if (STATE_WORLD_INIT == gStartupState) + if (STATE_WORLD_INIT == LLStartUp::getStartupState()) { set_startup_status(0.40f, "Initializing World...", gAgent.mMOTD.c_str()); display_startup(); @@ -1474,38 +1448,26 @@ BOOL idle_startup() // User might have overridden far clip gWorldp->setLandFarClip( gAgent.mDrawDistance ); - if (!gRunLocal) - { - // Before we create the first region, we need to set the agent's mOriginGlobal - // This is necessary because creating objects before this is set will result in a - // bad mPositionAgent cache. + // Before we create the first region, we need to set the agent's mOriginGlobal + // This is necessary because creating objects before this is set will result in a + // bad mPositionAgent cache. - gAgent.initOriginGlobal(from_region_handle(first_sim_handle)); + gAgent.initOriginGlobal(from_region_handle(first_sim_handle)); - gWorldp->addRegion(first_sim_handle, first_sim); + gWorldp->addRegion(first_sim_handle, first_sim); - LLViewerRegion *regionp = gWorldp->getRegionFromHandle(first_sim_handle); - llinfos << "Adding initial simulator " << regionp->getOriginGlobal() << llendl; - - gStartupState = STATE_SEED_GRANTED_WAIT; - regionp->setSeedCapability(first_sim_seed_cap); - - // Set agent's initial region to be the one we just created. - gAgent.setRegion(regionp); + LLViewerRegion *regionp = gWorldp->getRegionFromHandle(first_sim_handle); + llinfos << "Adding initial simulator " << regionp->getOriginGlobal() << llendl; + + LLStartUp::setStartupState( STATE_SEED_GRANTED_WAIT ); + regionp->setSeedCapability(first_sim_seed_cap); + + // Set agent's initial region to be the one we just created. + gAgent.setRegion(regionp); - // Set agent's initial position, which will be read by LLVOAvatar when the avatar - // object is created. I think this must be done after setting the region. JC - gAgent.setPositionAgent(agent_start_position_region); - } - else - { - // With one simulator, assume region is at 0,0, hence has regionHandle 0 - // VEFFECT: Login - gWorldp->addRegion(0, gAgentSimHost); - gAgent.setRegion(gWorldp->getRegionFromHandle(0)); - - gStartupState = STATE_SEED_CAP_GRANTED; - } + // Set agent's initial position, which will be read by LLVOAvatar when the avatar + // object is created. I think this must be done after setting the region. JC + gAgent.setPositionAgent(agent_start_position_region); display_startup(); return do_normal_idle; @@ -1515,7 +1477,7 @@ BOOL idle_startup() //--------------------------------------------------------------------- // Wait for Seed Cap Grant //--------------------------------------------------------------------- - if(STATE_SEED_GRANTED_WAIT == gStartupState) + if(STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) { llinfos << "Waiting for seed grant ...." << llendl; return do_normal_idle; @@ -1526,7 +1488,7 @@ BOOL idle_startup() // Seed Capability Granted // no newMessage calls should happen before this point //--------------------------------------------------------------------- - if (STATE_SEED_CAP_GRANTED == gStartupState) + if (STATE_SEED_CAP_GRANTED == LLStartUp::getStartupState()) { update_texture_fetch(); @@ -1659,42 +1621,35 @@ BOOL idle_startup() // For all images pre-loaded into viewer cache, decode them. // Need to do this AFTER we init the sky gImageList.decodeAllImages(2.f); - gStartupState++; + LLStartUp::setStartupState( STATE_QUICKTIME_INIT ); // JC - Do this as late as possible to increase likelihood Purify // will run. - if (!gRunLocal) + LLMessageSystem* msg = gMessageSystem; + if (!msg->mOurCircuitCode) { - LLMessageSystem* msg = gMessageSystem; - if (!msg->mOurCircuitCode) - { - llwarns << "Attempting to connect to simulator with a zero circuit code!" << llendl; - } - - gUseCircuitCallbackCalled = FALSE; - - msg->enableCircuit(first_sim, TRUE); - // now, use the circuit info to tell simulator about us! - llinfos << "viewer: UserLoginLocationReply() Enabling " << first_sim << " with code " << msg->mOurCircuitCode << llendl; - msg->newMessageFast(_PREHASH_UseCircuitCode); - msg->nextBlockFast(_PREHASH_CircuitCode); - msg->addU32Fast(_PREHASH_Code, msg->mOurCircuitCode); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_ID, gAgent.getID()); - msg->sendReliable( - first_sim, - MAX_TIMEOUT_COUNT, - FALSE, - TIMEOUT_SECONDS, - use_circuit_callback, - NULL); + llwarns << "Attempting to connect to simulator with a zero circuit code!" << llendl; } + gUseCircuitCallbackCalled = FALSE; + + msg->enableCircuit(first_sim, TRUE); + // now, use the circuit info to tell simulator about us! + llinfos << "viewer: UserLoginLocationReply() Enabling " << first_sim << " with code " << msg->mOurCircuitCode << llendl; + msg->newMessageFast(_PREHASH_UseCircuitCode); + msg->nextBlockFast(_PREHASH_CircuitCode); + msg->addU32Fast(_PREHASH_Code, msg->mOurCircuitCode); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_ID, gAgent.getID()); + msg->sendReliable( + first_sim, + MAX_TIMEOUT_COUNT, + FALSE, + TIMEOUT_SECONDS, + use_circuit_callback, + NULL); + timeout.reset(); - if (!gConnectToSomething) - { - gStartupState = STATE_MISC; - } return do_normal_idle; } @@ -1702,7 +1657,7 @@ BOOL idle_startup() //--------------------------------------------------------------------- // LLMediaEngine Init //--------------------------------------------------------------------- - if (STATE_QUICKTIME_INIT == gStartupState) + if (STATE_QUICKTIME_INIT == LLStartUp::getStartupState()) { if (gViewerWindow) { @@ -1737,20 +1692,20 @@ BOOL idle_startup() } #endif - gStartupState++; + LLStartUp::setStartupState( STATE_WORLD_WAIT ); return do_normal_idle; } //--------------------------------------------------------------------- // Agent Send //--------------------------------------------------------------------- - if(STATE_WORLD_WAIT == gStartupState) + if(STATE_WORLD_WAIT == LLStartUp::getStartupState()) { //llinfos << "Waiting for simulator ack...." << llendl; set_startup_status(0.49f, "Waiting for region handshake...", gAgent.mMOTD.c_str()); if(gGotUseCircuitCodeAck) { - ++gStartupState; + LLStartUp::setStartupState( STATE_AGENT_SEND ); } LLMessageSystem* msg = gMessageSystem; while (msg->checkAllMessages(gFrameCount, gServicePump)) @@ -1763,7 +1718,7 @@ BOOL idle_startup() //--------------------------------------------------------------------- // Agent Send //--------------------------------------------------------------------- - if (STATE_AGENT_SEND == gStartupState) + if (STATE_AGENT_SEND == LLStartUp::getStartupState()) { llinfos << "Connecting to region..." << llendl; set_startup_status(0.50f, "Connecting to region...", gAgent.mMOTD.c_str()); @@ -1774,7 +1729,7 @@ BOOL idle_startup() _PREHASH_AgentMovementComplete, process_agent_movement_complete); LLViewerRegion* regionp = gAgent.getRegion(); - if(!gRunLocal && regionp) + if(regionp) { send_complete_agent_movement(regionp->getHost()); gAssetStorage->setUpstream(regionp->getHost()); @@ -1782,10 +1737,6 @@ BOOL idle_startup() msg->newMessageFast(_PREHASH_EconomyDataRequest); gAgent.sendReliableMessage(); } - else - { - gStartupState++; - } // Create login effect // But not on first login, because you can't see your avatar then @@ -1797,7 +1748,7 @@ BOOL idle_startup() gHUDManager->sendEffects(); } - gStartupState++; + LLStartUp::setStartupState( STATE_AGENT_WAIT ); // Go to STATE_AGENT_WAIT timeout.reset(); return do_normal_idle; @@ -1806,14 +1757,13 @@ BOOL idle_startup() //--------------------------------------------------------------------- // Agent Wait //--------------------------------------------------------------------- - if (STATE_AGENT_WAIT == gStartupState) + if (STATE_AGENT_WAIT == LLStartUp::getStartupState()) { LLMessageSystem* msg = gMessageSystem; while (msg->checkAllMessages(gFrameCount, gServicePump)) { if (gAgentMovementCompleted) { - gStartupState++; // Sometimes we have more than one message in the // queue. break out of this loop and continue // processing. If we don't, then this could skip one @@ -1827,183 +1777,187 @@ BOOL idle_startup() } } msg->processAcks(); + + if (gAgentMovementCompleted) + { + LLStartUp::setStartupState( STATE_INVENTORY_SEND ); + } + return do_normal_idle; } //--------------------------------------------------------------------- // Inventory Send //--------------------------------------------------------------------- - if (STATE_INVENTORY_SEND == gStartupState) + if (STATE_INVENTORY_SEND == LLStartUp::getStartupState()) { if (!gUserAuthp) { llerrs << "No userauth in STATE_INVENTORY_SEND!" << llendl; } - if (gConnectToSomething && !gRunLocal) + // unpack thin inventory + LLUserAuth::options_t options; + options.clear(); + //bool dump_buffer = false; + + if(gUserAuthp->getOptions("inventory-lib-root", options) + && !options.empty()) { - // unpack thin inventory - LLUserAuth::options_t options; - options.clear(); - //bool dump_buffer = false; - - if(gUserAuthp->getOptions("inventory-lib-root", options) - && !options.empty()) + // should only be one + LLUserAuth::response_t::iterator it; + it = options[0].find("folder_id"); + if(it != options[0].end()) { - // should only be one - LLUserAuth::response_t::iterator it; - it = options[0].find("folder_id"); - if(it != options[0].end()) - { - gInventoryLibraryRoot.set((*it).second.c_str()); - } + gInventoryLibraryRoot.set((*it).second.c_str()); } - options.clear(); - if(gUserAuthp->getOptions("inventory-lib-owner", options) - && !options.empty()) + } + options.clear(); + if(gUserAuthp->getOptions("inventory-lib-owner", options) + && !options.empty()) + { + // should only be one + LLUserAuth::response_t::iterator it; + it = options[0].find("agent_id"); + if(it != options[0].end()) { - // should only be one - LLUserAuth::response_t::iterator it; - it = options[0].find("agent_id"); - if(it != options[0].end()) - { - gInventoryLibraryOwner.set((*it).second.c_str()); - } + gInventoryLibraryOwner.set((*it).second.c_str()); } - options.clear(); - if(gUserAuthp->getOptions("inventory-skel-lib", options) - && gInventoryLibraryOwner.notNull()) + } + options.clear(); + if(gUserAuthp->getOptions("inventory-skel-lib", options) + && gInventoryLibraryOwner.notNull()) + { + if(!gInventory.loadSkeleton(options, gInventoryLibraryOwner)) { - if(!gInventory.loadSkeleton(options, gInventoryLibraryOwner)) - { - llwarns << "Problem loading inventory-skel-lib" << llendl; - } + llwarns << "Problem loading inventory-skel-lib" << llendl; } - options.clear(); - if(gUserAuthp->getOptions("inventory-skeleton", options)) + } + options.clear(); + if(gUserAuthp->getOptions("inventory-skeleton", options)) + { + if(!gInventory.loadSkeleton(options, gAgent.getID())) { - if(!gInventory.loadSkeleton(options, gAgent.getID())) - { - llwarns << "Problem loading inventory-skel-targets" - << llendl; - } + llwarns << "Problem loading inventory-skel-targets" + << llendl; } - - options.clear(); - if(gUserAuthp->getOptions("buddy-list", options)) - { - LLUserAuth::options_t::iterator it = options.begin(); - LLUserAuth::options_t::iterator end = options.end(); - LLAvatarTracker::buddy_map_t list; - LLUUID agent_id; - S32 has_rights = 0, given_rights = 0; - for (; it != end; ++it) + } + + options.clear(); + if(gUserAuthp->getOptions("buddy-list", options)) + { + LLUserAuth::options_t::iterator it = options.begin(); + LLUserAuth::options_t::iterator end = options.end(); + LLAvatarTracker::buddy_map_t list; + LLUUID agent_id; + S32 has_rights = 0, given_rights = 0; + for (; it != end; ++it) + { + LLUserAuth::response_t::const_iterator option_it; + option_it = (*it).find("buddy_id"); + if(option_it != (*it).end()) { - LLUserAuth::response_t::const_iterator option_it; - option_it = (*it).find("buddy_id"); - if(option_it != (*it).end()) - { - agent_id.set((*option_it).second.c_str()); - } - option_it = (*it).find("buddy_rights_has"); - if(option_it != (*it).end()) - { - has_rights = atoi((*option_it).second.c_str()); - } - option_it = (*it).find("buddy_rights_given"); - if(option_it != (*it).end()) - { - given_rights = atoi((*option_it).second.c_str()); - } - list[agent_id] = new LLRelationship(given_rights, has_rights, false); + agent_id.set((*option_it).second.c_str()); } - LLAvatarTracker::instance().addBuddyList(list); - } - - options.clear(); - if(gUserAuthp->getOptions("ui-config", options)) - { - LLUserAuth::options_t::iterator it = options.begin(); - LLUserAuth::options_t::iterator end = options.end(); - for (; it != end; ++it) + option_it = (*it).find("buddy_rights_has"); + if(option_it != (*it).end()) { - LLUserAuth::response_t::const_iterator option_it; - option_it = (*it).find("allow_first_life"); - if(option_it != (*it).end()) - { - if (option_it->second == "Y") - { - LLPanelAvatar::sAllowFirstLife = TRUE; - } - } + has_rights = atoi((*option_it).second.c_str()); } - } - - options.clear(); - if(gUserAuthp->getOptions("event_categories", options)) - { - LLEventInfo::loadCategories(options); - } - if(gUserAuthp->getOptions("event_notifications", options)) - { - gEventNotifier.load(options); + option_it = (*it).find("buddy_rights_given"); + if(option_it != (*it).end()) + { + given_rights = atoi((*option_it).second.c_str()); + } + list[agent_id] = new LLRelationship(given_rights, has_rights, false); } - options.clear(); - if(gUserAuthp->getOptions("classified_categories", options)) + LLAvatarTracker::instance().addBuddyList(list); + } + + options.clear(); + if(gUserAuthp->getOptions("ui-config", options)) + { + LLUserAuth::options_t::iterator it = options.begin(); + LLUserAuth::options_t::iterator end = options.end(); + for (; it != end; ++it) { - LLClassifiedInfo::loadCategories(options); + LLUserAuth::response_t::const_iterator option_it; + option_it = (*it).find("allow_first_life"); + if(option_it != (*it).end()) + { + if (option_it->second == "Y") + { + LLPanelAvatar::sAllowFirstLife = TRUE; + } + } } - gInventory.buildParentChildMap(); - gInventory.addChangedMask(LLInventoryObserver::ALL, LLUUID::null); - gInventory.notifyObservers(); + } - // set up callbacks - LLMessageSystem* msg = gMessageSystem; - LLInventoryModel::registerCallbacks(msg); - LLAvatarTracker::instance().registerCallbacks(msg); - LLLandmark::registerCallbacks(msg); - - // request mute list - gMuteListp->requestFromServer(gAgent.getID()); - - // Get L$ and ownership credit information - msg->newMessageFast(_PREHASH_MoneyBalanceRequest); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_MoneyData); - msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); - gAgent.sendReliableMessage(); + options.clear(); + if(gUserAuthp->getOptions("event_categories", options)) + { + LLEventInfo::loadCategories(options); + } + if(gUserAuthp->getOptions("event_notifications", options)) + { + gEventNotifier.load(options); + } + options.clear(); + if(gUserAuthp->getOptions("classified_categories", options)) + { + LLClassifiedInfo::loadCategories(options); + } + gInventory.buildParentChildMap(); + gInventory.addChangedMask(LLInventoryObserver::ALL, LLUUID::null); + gInventory.notifyObservers(); - // request all group information - // *FIX: This will not do the right thing if the message - // gets there before the requestuserserverconnection - // circuit is completed. - gAgent.sendAgentDataUpdateRequest(); + // set up callbacks + LLMessageSystem* msg = gMessageSystem; + LLInventoryModel::registerCallbacks(msg); + LLAvatarTracker::instance().registerCallbacks(msg); + LLLandmark::registerCallbacks(msg); + // request mute list + gMuteListp->requestFromServer(gAgent.getID()); - // NOTE: removed as part of user-privacy - // enhancements. this information should be available from - // login. 2006-10-16 Phoenix. - // get the users that have been granted modify powers - //msg->newMessageFast(_PREHASH_RequestGrantedProxies); - //msg->nextBlockFast(_PREHASH_AgentData); - //msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - //msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - //gAgent.sendReliableMessage(); + // Get L$ and ownership credit information + msg->newMessageFast(_PREHASH_MoneyBalanceRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_MoneyData); + msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null ); + gAgent.sendReliableMessage(); - BOOL shown_at_exit = gSavedSettings.getBOOL("ShowInventory"); + // request all group information + // *FIX: This will not do the right thing if the message + // gets there before the requestuserserverconnection + // circuit is completed. + gAgent.sendAgentDataUpdateRequest(); - // Create the inventory views - LLInventoryView::showAgentInventory(); - // Hide the inventory if it wasn't shown at exit - if(!shown_at_exit) - { - LLInventoryView::toggleVisibility(NULL); - } + // NOTE: removed as part of user-privacy + // enhancements. this information should be available from + // login. 2006-10-16 Phoenix. + // get the users that have been granted modify powers + //msg->newMessageFast(_PREHASH_RequestGrantedProxies); + //msg->nextBlockFast(_PREHASH_AgentData); + //msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + //msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + //gAgent.sendReliableMessage(); + + BOOL shown_at_exit = gSavedSettings.getBOOL("ShowInventory"); + + // Create the inventory views + LLInventoryView::showAgentInventory(); + + // Hide the inventory if it wasn't shown at exit + if(!shown_at_exit) + { + LLInventoryView::toggleVisibility(NULL); } - gStartupState++; + + LLStartUp::setStartupState( STATE_MISC ); return do_normal_idle; } @@ -2011,14 +1965,8 @@ BOOL idle_startup() //--------------------------------------------------------------------- // Misc //--------------------------------------------------------------------- - if (STATE_MISC == gStartupState) + if (STATE_MISC == LLStartUp::getStartupState()) { - // Create a few objects if we don't actually have a world - if (!gConnectToSomething) - { - // could add them here - } - // We have a region, and just did a big inventory download. // We can estimate the user's connection speed, and set their // max bandwidth accordingly. JC @@ -2037,7 +1985,7 @@ BOOL idle_startup() { llinfos << "Fast network connection, increasing max bandwidth to " << FASTER_RATE_BPS/1024.f - << " Kbps" << llendl; + << " kbps" << llendl; gViewerThrottle.setMaxBandwidth(FASTER_RATE_BPS / 1024.f); } else if (rate_bps > FAST_RATE_BPS @@ -2045,7 +1993,7 @@ BOOL idle_startup() { llinfos << "Fast network connection, increasing max bandwidth to " << FAST_RATE_BPS/1024.f - << " Kbps" << llendl; + << " kbps" << llendl; gViewerThrottle.setMaxBandwidth(FAST_RATE_BPS / 1024.f); } } @@ -2197,12 +2145,12 @@ BOOL idle_startup() } } - gStartupState++; + LLStartUp::setStartupState( STATE_PRECACHE ); timeout.reset(); return do_normal_idle; } - if (STATE_PRECACHE == gStartupState) + if (STATE_PRECACHE == LLStartUp::getStartupState()) { do_normal_idle = TRUE; @@ -2211,7 +2159,7 @@ BOOL idle_startup() if(((timeout_frac > 1.f) && gAgent.getAvatarObject()) || (timeout_frac > 3.f)) { - gStartupState++; + LLStartUp::setStartupState( STATE_WEARABLES_WAIT ); } else { @@ -2223,7 +2171,7 @@ BOOL idle_startup() return do_normal_idle; } - if (STATE_WEARABLES_WAIT == gStartupState) + if (STATE_WEARABLES_WAIT == LLStartUp::getStartupState()) { do_normal_idle = TRUE; @@ -2234,13 +2182,13 @@ BOOL idle_startup() if(gAgent.getWearablesLoaded() || !gAgent.isGenderChosen()) { - gStartupState++; + LLStartUp::setStartupState( STATE_CLEANUP ); } else if (wearables_time > MAX_WEARABLES_TIME) { gViewerWindow->alertXml("ClothingLoading"); gViewerStats->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG); - gStartupState++; + LLStartUp::setStartupState( STATE_CLEANUP ); } else { @@ -2252,7 +2200,7 @@ BOOL idle_startup() return do_normal_idle; } - if (STATE_CLEANUP == gStartupState) + if (STATE_CLEANUP == LLStartUp::getStartupState()) { set_startup_status(1.0, "", NULL); @@ -2324,7 +2272,7 @@ BOOL idle_startup() gUserAuthp = NULL; } - gStartupState++; + LLStartUp::setStartupState( STATE_STARTED ); // Unmute audio if desired and setup volumes audio_update_volume(); @@ -2338,7 +2286,7 @@ BOOL idle_startup() return do_normal_idle; } - llwarns << "Reached end of idle_startup for state " << gStartupState << llendl; + llwarns << "Reached end of idle_startup for state " << LLStartUp::getStartupState() << llendl; return do_normal_idle; } @@ -2398,7 +2346,7 @@ void login_callback(S32 option, void *userdata) if (CONNECT_OPTION == option) { - gStartupState++; + LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); return; } else if (QUIT_OPTION == option) @@ -2665,7 +2613,7 @@ void update_dialog_callback(S32 option, void *userdata) #if !LL_RELEASE_FOR_DOWNLOAD if (option == 2) { - gStartupState++; + LLStartUp::setStartupState( STATE_WORLD_INIT ); return; } #endif @@ -2681,7 +2629,7 @@ void update_dialog_callback(S32 option, void *userdata) } else { - gStartupState++; + LLStartUp::setStartupState( STATE_WORLD_INIT ); } return; } @@ -3066,7 +3014,7 @@ void init_stat_view() stat_barp->mDisplayHistory = FALSE; stat_barp = stat_viewp->addStat("Packet Loss", &(gViewerStats->mPacketsLostPercentStat)); - stat_barp->setUnitLabel(" %%"); + stat_barp->setUnitLabel(" %"); stat_barp->mMinBar = 0.f; stat_barp->mMaxBar = 5.f; stat_barp->mTickSpacing = 1.f; @@ -3086,16 +3034,6 @@ void init_stat_view() stat_barp->mPerSec = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = stat_viewp->addStat("Ping User", &(gViewerStats->mUserserverPingStat)); - stat_barp->setUnitLabel(" msec"); - stat_barp->mMinBar = 0.f; - stat_barp->mMaxBar = 1000.f; - stat_barp->mTickSpacing = 100.f; - stat_barp->mLabelSpacing = 200.f; - stat_barp->mDisplayBar = FALSE; - stat_barp->mPerSec = FALSE; - stat_barp->mDisplayMean = FALSE; - stat_viewp = new LLStatView("advanced stat view", "Advanced", "OpenDebugStatAdvanced", rect); gDebugView->mStatViewp->addChildAtEnd(stat_viewp); @@ -3717,17 +3655,31 @@ void release_start_screen() gStartImageGL = NULL; } +// static bool LLStartUp::canGoFullscreen() { - return gStartupState >= STATE_WORLD_INIT; + return LLStartUp::getStartupState() >= STATE_WORLD_INIT; } + +// static +void LLStartUp::setStartupState( S32 state ) +{ + llinfos << "Startup state changing from " << gStartupState << " to " << state << llendl; + gStartupState = state; +} + + void reset_login() { - gStartupState = STATE_LOGIN_SHOW; + LLStartUp::setStartupState( STATE_LOGIN_SHOW ); if ( gViewerWindow ) { // Hide menus and normal buttons gViewerWindow->setNormalControlsVisible( FALSE ); } + + // Hide any other stuff + if ( gFloaterMap ) + gFloaterMap->setVisible( FALSE ); } |