summaryrefslogtreecommitdiff
path: root/indra/newview/llgesturemgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llgesturemgr.cpp')
-rwxr-xr-xindra/newview/llgesturemgr.cpp92
1 files changed, 73 insertions, 19 deletions
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index b56c34573d..ffddeeb129 100755
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -257,19 +257,19 @@ void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id,
if( !gAssetStorage )
{
- llwarns << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << llendl;
+ LL_WARNS() << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << LL_ENDL;
return;
}
// If gesture is already active, nothing to do.
if (isGestureActive(item_id))
{
- llwarns << "Tried to loadGesture twice " << item_id << llendl;
+ LL_WARNS() << "Tried to loadGesture twice " << item_id << LL_ENDL;
return;
}
// if (asset_id.isNull())
// {
-// llwarns << "loadGesture() - gesture has no asset" << llendl;
+// LL_WARNS() << "loadGesture() - gesture has no asset" << LL_ENDL;
// return;
// }
@@ -305,7 +305,7 @@ void LLGestureMgr::deactivateGesture(const LLUUID& item_id)
item_map_t::iterator it = mActive.find(base_item_id);
if (it == mActive.end())
{
- llwarns << "deactivateGesture for inactive gesture " << item_id << llendl;
+ LL_WARNS() << "deactivateGesture for inactive gesture " << item_id << LL_ENDL;
return;
}
@@ -469,7 +469,7 @@ void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_ges
item_map_t::iterator it = mActive.find(base_item_id);
if (it == mActive.end())
{
- llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl;
+ LL_WARNS() << "replaceGesture for inactive gesture " << base_item_id << LL_ENDL;
return;
}
@@ -511,7 +511,7 @@ void LLGestureMgr::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset
item_map_t::iterator it = LLGestureMgr::instance().mActive.find(base_item_id);
if (it == mActive.end())
{
- llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl;
+ LL_WARNS() << "replaceGesture for inactive gesture " << base_item_id << LL_ENDL;
return;
}
@@ -586,7 +586,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture)
}
default:
{
- llwarns << "Unknown gesture step type: " << step->getType() << llendl;
+ LL_WARNS() << "Unknown gesture step type: " << step->getType() << LL_ENDL;
}
}
}
@@ -907,8 +907,8 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
else if (gesture->mWaitTimer.getElapsedTimeF32() > MAX_WAIT_ANIM_SECS)
{
// we've waited too long for an animation
- llinfos << "Waited too long for animations to stop, continuing gesture."
- << llendl;
+ LL_INFOS() << "Waited too long for animations to stop, continuing gesture."
+ << LL_ENDL;
gesture->mWaitingAnimations = FALSE;
gesture->mCurrentStep++;
}
@@ -1129,7 +1129,7 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,
}
else
{
- llwarns << "Unable to load gesture" << llendl;
+ LL_WARNS() << "Unable to load gesture" << LL_ENDL;
self.mActive.erase(item_id);
@@ -1139,8 +1139,6 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,
}
else
{
- LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
-
if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
LL_ERR_FILE_EMPTY == status)
{
@@ -1151,7 +1149,7 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,
LLDelayedGestureError::gestureFailedToLoad( item_id );
}
- llwarns << "Problem loading gesture: " << status << llendl;
+ LL_WARNS() << "Problem loading gesture: " << status << LL_ENDL;
LLGestureMgr::instance().mActive.erase(item_id);
}
@@ -1187,7 +1185,7 @@ void LLGestureMgr::onAssetLoadComplete(LLVFS *vfs,
}
default:
{
- llwarns << "Unexpected asset type: " << type << llendl;
+ LL_WARNS() << "Unexpected asset type: " << type << LL_ENDL;
// We don't want to return from this callback without
// an animation or sound callback being fired
@@ -1242,7 +1240,7 @@ bool LLGestureMgr::hasLoadingAssets(LLMultiGesture* gesture)
}
default:
{
- llwarns << "Unknown gesture step type: " << step->getType() << llendl;
+ LL_WARNS() << "Unknown gesture step type: " << step->getType() << LL_ENDL;
}
}
}
@@ -1324,7 +1322,7 @@ void LLGestureMgr::removeObserver(LLGestureManagerObserver* observer)
// from the list.
void LLGestureMgr::notifyObservers()
{
- lldebugs << "LLGestureMgr::notifyObservers" << llendl;
+ LL_DEBUGS() << "LLGestureMgr::notifyObservers" << LL_ENDL;
for(std::vector<LLGestureManagerObserver*>::iterator iter = mObservers.begin();
iter != mObservers.end();
@@ -1339,6 +1337,7 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
{
S32 in_len = in_str.length();
+ //return whole trigger, if received text equals to it
item_map_t::iterator it;
for (it = mActive.begin(); it != mActive.end(); ++it)
{
@@ -1346,7 +1345,24 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
if (gesture)
{
const std::string& trigger = gesture->getTrigger();
-
+ if (!LLStringUtil::compareInsensitive(in_str, trigger))
+ {
+ *out_str = trigger;
+ return TRUE;
+ }
+ }
+ }
+
+ //return common chars, if more than one trigger matches the prefix
+ std::string rest_of_match = "";
+ std::string buf = "";
+ for (it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ LLMultiGesture* gesture = (*it).second;
+ if (gesture)
+ {
+ const std::string& trigger = gesture->getTrigger();
+
if (in_len > (S32)trigger.length())
{
// too short, bail out
@@ -1357,11 +1373,49 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
LLStringUtil::truncate(trigger_trunc, in_len);
if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc))
{
- *out_str = trigger;
- return TRUE;
+ if (rest_of_match.compare("") == 0)
+ {
+ rest_of_match = trigger.substr(in_str.size());
+ }
+ std::string cur_rest_of_match = trigger.substr(in_str.size());
+ buf = "";
+ S32 i=0;
+
+ while (i<rest_of_match.length() && i<cur_rest_of_match.length())
+ {
+ if (rest_of_match[i]==cur_rest_of_match[i])
+ {
+ buf.push_back(rest_of_match[i]);
+ }
+ else
+ {
+ if(i==0)
+ {
+ rest_of_match = "";
+ }
+ break;
+ }
+ i++;
+ }
+ if (rest_of_match.compare("") == 0)
+ {
+ return FALSE;
+ }
+ if (buf.compare("") != 0)
+ {
+ rest_of_match = buf;
+ }
+
}
}
}
+
+ if (rest_of_match.compare("") != 0)
+ {
+ *out_str = in_str+rest_of_match;
+ return TRUE;
+ }
+
return FALSE;
}