diff options
Diffstat (limited to 'indra/newview/llagentpilot.cpp')
-rw-r--r-- | indra/newview/llagentpilot.cpp | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index f0bd452109..13e1023185 100644 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -2,30 +2,25 @@ * @file llagentpilot.cpp * @brief LLAgentPilot class implementation * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -37,30 +32,36 @@ #include "llagentpilot.h" #include "llagent.h" -#include "llframestats.h" #include "llappviewer.h" #include "llviewercontrol.h" LLAgentPilot gAgentPilot; BOOL LLAgentPilot::sLoop = TRUE; - -LLAgentPilot::LLAgentPilot() +BOOL LLAgentPilot::sReplaySession = FALSE; + +LLAgentPilot::LLAgentPilot() : + mNumRuns(-1), + mQuitAfterRuns(FALSE), + mRecording(FALSE), + mLastRecordTime(0.f), + mStarted(FALSE), + mPlaying(FALSE), + mCurrentAction(0) { - mRecording = FALSE; - mPlaying = FALSE; - mStarted = FALSE; - mNumRuns = -1; } LLAgentPilot::~LLAgentPilot() { } -void LLAgentPilot::load(const char *filename) +void LLAgentPilot::load(const std::string& filename) { - if(!filename) return; - + if(filename.empty()) + { + return; + } + llifstream file(filename); if (!file) @@ -78,8 +79,7 @@ void LLAgentPilot::load(const char *filename) file >> num_actions; - S32 i; - for (i = 0; i < num_actions; i++) + for (S32 i = 0; i < num_actions; i++) { S32 action_type; Action new_action; @@ -92,10 +92,10 @@ void LLAgentPilot::load(const char *filename) file.close(); } -void LLAgentPilot::save(const char *filename) +void LLAgentPilot::save(const std::string& filename) { llofstream file; - file.open(filename); /*Flawfinder: ignore*/ + file.open(filename); if (!file) { @@ -125,7 +125,7 @@ void LLAgentPilot::startRecord() void LLAgentPilot::stopRecord() { gAgentPilot.addAction(STRAIGHT); - gAgentPilot.save(gSavedSettings.getString("StatsPilotFile").c_str()); + gAgentPilot.save(gSavedSettings.getString("StatsPilotFile")); mRecording = FALSE; } @@ -171,6 +171,11 @@ void LLAgentPilot::stopPlayback() mTimer.reset(); gAgent.stopAutoPilot(); } + + if (sReplaySession) + { + LLAppViewer::instance()->forceQuit(); + } } void LLAgentPilot::updateTarget() @@ -192,7 +197,6 @@ void LLAgentPilot::updateTarget() { llinfos << "At start, beginning playback" << llendl; mTimer.reset(); - LLFrameStats::startLogging(NULL); mStarted = TRUE; } } @@ -209,7 +213,6 @@ void LLAgentPilot::updateTarget() else { stopPlayback(); - LLFrameStats::stopLogging(NULL); mNumRuns--; if (sLoop) { |