From 222ba039eddac452d6ff30284855837756db3f32 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 25 Jun 2016 17:08:43 +0200 Subject: [PATCH] Add some fixes to the client-side AO by Drake Arconis --- indra/newview/aoengine.cpp | 42 ++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/indra/newview/aoengine.cpp b/indra/newview/aoengine.cpp index 0188fba6f4..aa242241d6 100644 --- a/indra/newview/aoengine.cpp +++ b/indra/newview/aoengine.cpp @@ -574,17 +574,21 @@ void AOEngine::checkSitCancel() if (foreignAnimations(seat)) { - LLUUID animation = mCurrentSet->getStateByRemapID(ANIM_AGENT_SIT)->mCurrentAnimationID; - if (animation.notNull()) + AOSet::AOState* aoState = mCurrentSet->getStateByRemapID(ANIM_AGENT_SIT); + if (aoState) { - LL_DEBUGS("AOEngine") << "Stopping sit animation due to foreign animations running" << LL_ENDL; - gAgent.sendAnimationRequest(animation, ANIM_REQUEST_STOP); - // remove cycle point cover-up - gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC, ANIM_REQUEST_STOP); - gAgentAvatarp->LLCharacter::stopMotion(animation); - mSitCancelTimer.stop(); - // stop cycle tiemr - mCurrentSet->stopTimer(); + LLUUID animation = aoState->mCurrentAnimationID; + if (animation.notNull()) + { + LL_DEBUGS("AOEngine") << "Stopping sit animation due to foreign animations running" << LL_ENDL; + gAgent.sendAnimationRequest(animation, ANIM_REQUEST_STOP); + // remove cycle point cover-up + gAgent.sendAnimationRequest(ANIM_AGENT_SIT_GENERIC, ANIM_REQUEST_STOP); + gAgentAvatarp->LLCharacter::stopMotion(animation); + mSitCancelTimer.stop(); + // stop cycle tiemr + mCurrentSet->stopTimer(); + } } } } @@ -931,6 +935,11 @@ BOOL AOEngine::removeSet(AOSet* set) BOOL AOEngine::removeAnimation(const AOSet* set, AOSet::AOState* state, S32 index) { + if (index < 0) + { + return FALSE; + } + S32 numOfAnimations = state->mAnimations.size(); if (numOfAnimations == 0) { @@ -1717,9 +1726,16 @@ void AOEngine::onNotecardLoadComplete(LLVFS* vfs, const LLUUID& assetUUID, LLAss S32 notecardSize = vfs->getSize(assetUUID, type); char* buffer = new char[notecardSize]; - vfs->getData(assetUUID, type, (U8*) buffer, 0, notecardSize); - AOEngine::instance().parseNotecard(buffer); + S32 ret = vfs->getData(assetUUID, type, reinterpret_cast(buffer), 0, notecardSize); + if (ret > 0) + { + AOEngine::instance().parseNotecard(buffer); + } + else + { + delete[] buffer; + } } void AOEngine::parseNotecard(const char* buffer) @@ -1739,7 +1755,7 @@ void AOEngine::parseNotecard(const char* buffer) } std::string text(buffer); - delete buffer; + delete[] buffer; std::vector lines; LLStringUtil::getTokens(text, lines, "\n");