summaryrefslogtreecommitdiff
path: root/indra/newview/llgesturemgr.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
commitcde1174345224d33d6b45b1e3243fa39043223e5 (patch)
tree6c8db6e0499622d8c7206a11c997eb173ebd478f /indra/newview/llgesturemgr.cpp
parent6f454ad8366ed33bbe199c3fc3ed69e6d3448cec (diff)
parent35efadf78315f9b351415930dca4fae251ef4dd0 (diff)
Merge branch 'main' into release/luau-scripting.
Diffstat (limited to 'indra/newview/llgesturemgr.cpp')
-rw-r--r--indra/newview/llgesturemgr.cpp144
1 files changed, 72 insertions, 72 deletions
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index 5671f6dd59..8ee11cdbd2 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -65,7 +65,7 @@ const F32 MAX_WAIT_KEY_SECS = 60.f * 10.f;
// Lightweight constructor.
// init() does the heavy lifting.
LLGestureMgr::LLGestureMgr()
-: mValid(FALSE),
+: mValid(false),
mPlaying(),
mActive(),
mLoadingCount(0)
@@ -145,8 +145,8 @@ void LLGestureMgr::activateGesture(const LLUUID& item_id)
mLoadingCount = 1;
mDeactivateSimilarNames.clear();
- const BOOL inform_server = TRUE;
- const BOOL deactivate_similar = FALSE;
+ const bool inform_server = true;
+ const bool deactivate_similar = false;
activateGestureWithAsset(item_id, asset_id, inform_server, deactivate_similar);
}
@@ -185,8 +185,8 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
}
// Don't inform server, we'll do that in bulk
- const BOOL no_inform_server = FALSE;
- const BOOL deactivate_similar = TRUE;
+ const bool no_inform_server = false;
+ const bool deactivate_similar = true;
activateGestureWithAsset(item->getUUID(), item->getAssetUUID(),
no_inform_server,
deactivate_similar);
@@ -195,7 +195,7 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
// Inform the database of this change
LLMessageSystem* msg = gMessageSystem;
- BOOL start_message = TRUE;
+ bool start_message = true;
for (it = items.begin(); it != items.end(); ++it)
{
@@ -213,7 +213,7 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->addU32("Flags", 0x0);
- start_message = FALSE;
+ start_message = false;
}
msg->nextBlock("Data");
@@ -224,7 +224,7 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
if (msg->getCurrentSendTotal() > MTUBYTES)
{
gAgent.sendReliableMessage();
- start_message = TRUE;
+ start_message = true;
}
}
@@ -238,8 +238,8 @@ void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
struct LLLoadInfo
{
LLUUID mItemID;
- BOOL mInformServer;
- BOOL mDeactivateSimilar;
+ bool mInformServer;
+ bool mDeactivateSimilar;
};
// If inform_server is true, will send a message upstream to update
@@ -249,8 +249,8 @@ struct LLLoadInfo
*/
void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id,
const LLUUID& asset_id,
- BOOL inform_server,
- BOOL deactivate_similar)
+ bool inform_server,
+ bool deactivate_similar)
{
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
@@ -284,7 +284,7 @@ void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id,
info->mInformServer = inform_server;
info->mDeactivateSimilar = deactivate_similar;
- const BOOL high_priority = TRUE;
+ const bool high_priority = true;
gAssetStorage->getAssetData(asset_id,
LLAssetType::AT_GESTURE,
onLoadComplete,
@@ -391,7 +391,7 @@ void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& i
// Inform database of the change
LLMessageSystem* msg = gMessageSystem;
- BOOL start_message = TRUE;
+ bool start_message = true;
uuid_vec_t::const_iterator vit = gest_item_ids.begin();
while (vit != gest_item_ids.end())
{
@@ -402,7 +402,7 @@ void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& i
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->addU32("Flags", 0x0);
- start_message = FALSE;
+ start_message = false;
}
msg->nextBlock("Data");
@@ -412,7 +412,7 @@ void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& i
if (msg->getCurrentSendTotal() > MTUBYTES)
{
gAgent.sendReliableMessage();
- start_message = TRUE;
+ start_message = true;
}
++vit;
@@ -437,7 +437,7 @@ void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& i
}
-BOOL LLGestureMgr::isGestureActive(const LLUUID& item_id)
+bool LLGestureMgr::isGestureActive(const LLUUID& item_id)
{
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
item_map_t::iterator it = mActive.find(base_item_id);
@@ -445,24 +445,24 @@ BOOL LLGestureMgr::isGestureActive(const LLUUID& item_id)
}
-BOOL LLGestureMgr::isGesturePlaying(const LLUUID& item_id)
+bool LLGestureMgr::isGesturePlaying(const LLUUID& item_id)
{
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
item_map_t::iterator it = mActive.find(base_item_id);
- if (it == mActive.end()) return FALSE;
+ if (it == mActive.end()) return false;
LLMultiGesture* gesture = (*it).second;
- if (!gesture) return FALSE;
+ if (!gesture) return false;
return gesture->mPlaying;
}
-BOOL LLGestureMgr::isGesturePlaying(LLMultiGesture* gesture)
+bool LLGestureMgr::isGesturePlaying(LLMultiGesture* gesture)
{
if(!gesture)
{
- return FALSE;
+ return false;
}
return gesture->mPlaying;
@@ -501,10 +501,10 @@ void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_ges
LLLoadInfo* info = new LLLoadInfo;
info->mItemID = base_item_id;
- info->mInformServer = TRUE;
- info->mDeactivateSimilar = FALSE;
+ info->mInformServer = true;
+ info->mDeactivateSimilar = false;
- const BOOL high_priority = TRUE;
+ const bool high_priority = true;
gAssetStorage->getAssetData(asset_id,
LLAssetType::AT_GESTURE,
onLoadComplete,
@@ -540,7 +540,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture, bool fromKeyPress)
gesture->mTriggeredByKey = fromKeyPress;
// Add to list of playing
- gesture->mPlaying = TRUE;
+ gesture->mPlaying = true;
mPlaying.push_back(gesture);
// Load all needed assets to minimize the delays
@@ -569,7 +569,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture, bool fromKeyPress)
LLAssetType::AT_ANIMATION,
onAssetLoadComplete,
(void *)id,
- TRUE);
+ true);
}
break;
}
@@ -586,7 +586,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture, bool fromKeyPress)
LLAssetType::AT_SOUND,
onAssetLoadComplete,
NULL,
- TRUE);
+ true);
}
break;
}
@@ -628,12 +628,12 @@ void LLGestureMgr::playGesture(const LLUUID& item_id)
// Iterates through space delimited tokens in string, triggering any gestures found.
// Generates a revised string that has the found tokens replaced by their replacement strings
// and (as a minor side effect) has multiple spaces in a row replaced by single spaces.
-BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::string* revised_string)
+bool LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::string* revised_string)
{
std::string tokenized = utf8str;
- BOOL found_gestures = FALSE;
- BOOL first_token = TRUE;
+ bool found_gestures = false;
+ bool first_token = true;
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep(" ");
@@ -671,7 +671,7 @@ BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::strin
{
// choose one at random
{
- S32 random = ll_rand(matching.size());
+ S32 random = ll_rand(static_cast<S32>(matching.size()));
gesture = matching[random];
@@ -697,7 +697,7 @@ BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::strin
revised_string->append( gesture->mReplaceText );
}
}
- found_gestures = TRUE;
+ found_gestures = true;
}
}
}
@@ -714,14 +714,14 @@ BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::strin
revised_string->append( cur_token );
}
- first_token = FALSE;
+ first_token = false;
gesture = NULL;
}
return found_gestures;
}
-BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask)
+bool LLGestureMgr::triggerGesture(KEY key, MASK mask)
{
std::vector <LLMultiGesture *> matching;
item_map_t::iterator it;
@@ -736,7 +736,7 @@ BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask)
if (gesture->mKey == key
&& gesture->mMask == mask
- && gesture->mWaitingKeyRelease == FALSE)
+ && gesture->mWaitingKeyRelease == false)
{
matching.push_back(gesture);
}
@@ -745,18 +745,18 @@ BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask)
// choose one and play it
if (matching.size() > 0)
{
- U32 random = ll_rand(matching.size());
+ U32 random = ll_rand(static_cast<S32>(matching.size()));
LLMultiGesture* gesture = matching[random];
- playGesture(gesture, TRUE);
- return TRUE;
+ playGesture(gesture, true);
+ return true;
}
- return FALSE;
+ return false;
}
-BOOL LLGestureMgr::triggerGestureRelease(KEY key, MASK mask)
+bool LLGestureMgr::triggerGestureRelease(KEY key, MASK mask)
{
std::vector <LLMultiGesture *> matching;
item_map_t::iterator it;
@@ -772,7 +772,7 @@ BOOL LLGestureMgr::triggerGestureRelease(KEY key, MASK mask)
if (gesture->mKey == key
&& gesture->mMask == mask)
{
- gesture->mKeyReleased = TRUE;
+ gesture->mKeyReleased = true;
}
}
@@ -783,7 +783,7 @@ BOOL LLGestureMgr::triggerGestureRelease(KEY key, MASK mask)
S32 LLGestureMgr::getPlayingCount() const
{
- return mPlaying.size();
+ return static_cast<S32>(mPlaying.size());
}
@@ -890,7 +890,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
}
// Run the current steps
- BOOL waiting = FALSE;
+ bool waiting = false;
while (!waiting && gesture->mPlaying)
{
// Get the current step, if there is one.
@@ -904,7 +904,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
else
{
// step stays null, we're off the end
- gesture->mWaitingAtEnd = TRUE;
+ gesture->mWaitingAtEnd = true;
}
@@ -919,12 +919,12 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
&& gesture->mPlayingAnimIDs.empty()))
{
// all animations are done playing
- gesture->mWaitingAtEnd = FALSE;
- gesture->mPlaying = FALSE;
+ gesture->mWaitingAtEnd = false;
+ gesture->mPlaying = false;
}
else
{
- waiting = TRUE;
+ waiting = true;
}
continue;
}
@@ -937,20 +937,20 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
if (gesture->mKeyReleased)
{
// wait is done, continue execution
- gesture->mWaitingKeyRelease = FALSE;
+ gesture->mWaitingKeyRelease = false;
gesture->mCurrentStep++;
}
else if (gesture->mWaitTimer.getElapsedTimeF32() > MAX_WAIT_KEY_SECS)
{
LL_INFOS("GestureMgr") << "Waited too long for key release, continuing gesture."
<< LL_ENDL;
- gesture->mWaitingKeyRelease = FALSE;
+ gesture->mWaitingKeyRelease = false;
gesture->mCurrentStep++;
}
else
{
// we're waiting, so execution is done for now
- waiting = TRUE;
+ waiting = true;
}
continue;
}
@@ -965,7 +965,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
&& gesture->mPlayingAnimIDs.empty()))
{
// all animations are done playing
- gesture->mWaitingAnimations = FALSE;
+ gesture->mWaitingAnimations = false;
gesture->mCurrentStep++;
}
else if (gesture->mWaitTimer.getElapsedTimeF32() > MAX_WAIT_ANIM_SECS)
@@ -973,12 +973,12 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
// we've waited too long for an animation
LL_INFOS("GestureMgr") << "Waited too long for animations to stop, continuing gesture."
<< LL_ENDL;
- gesture->mWaitingAnimations = FALSE;
+ gesture->mWaitingAnimations = false;
gesture->mCurrentStep++;
}
else
{
- waiting = TRUE;
+ waiting = true;
}
continue;
}
@@ -994,13 +994,13 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
if (elapsed > wait_step->mWaitSeconds)
{
// wait is done, continue execution
- gesture->mWaitingTimer = FALSE;
+ gesture->mWaitingTimer = false;
gesture->mCurrentStep++;
}
else
{
// we're waiting, so execution is done for now
- waiting = TRUE;
+ waiting = true;
}
continue;
}
@@ -1060,7 +1060,7 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
// Don't animate the nodding, as this might not blend with
// other playing animations.
- const BOOL animate = FALSE;
+ const bool animate = false;
(LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"))->
sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate);
@@ -1072,23 +1072,23 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
{
LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
if (gesture->mTriggeredByKey // Only wait here IF we were triggered by a key!
- && gesture->mWaitingKeyRelease == FALSE // We can only do this once! Prevent gestures infinitely running
+ && gesture->mWaitingKeyRelease == false // We can only do this once! Prevent gestures infinitely running
&& wait_step->mFlags & WAIT_FLAG_KEY_RELEASE)
{
// Lets wait for the key release first so we don't hold up re-presses
- gesture->mWaitingKeyRelease = TRUE;
- gesture->mKeyReleased = FALSE;
+ gesture->mWaitingKeyRelease = true;
+ gesture->mKeyReleased = false;
// Use the wait timer as a deadlock breaker for key release waits.
gesture->mWaitTimer.reset();
}
else if (wait_step->mFlags & WAIT_FLAG_TIME)
{
- gesture->mWaitingTimer = TRUE;
+ gesture->mWaitingTimer = true;
gesture->mWaitTimer.reset();
}
else if (wait_step->mFlags & WAIT_FLAG_ALL_ANIM)
{
- gesture->mWaitingAnimations = TRUE;
+ gesture->mWaitingAnimations = true;
// Use the wait timer as a deadlock breaker for animation waits.
gesture->mWaitTimer.reset();
}
@@ -1115,8 +1115,8 @@ void LLGestureMgr::onLoadComplete(const LLUUID& asset_uuid,
LLLoadInfo* info = (LLLoadInfo*)user_data;
LLUUID item_id = info->mItemID;
- BOOL inform_server = info->mInformServer;
- BOOL deactivate_similar = info->mDeactivateSimilar;
+ bool inform_server = info->mInformServer;
+ bool deactivate_similar = info->mDeactivateSimilar;
delete info;
info = NULL;
@@ -1137,7 +1137,7 @@ void LLGestureMgr::onLoadComplete(const LLUUID& asset_uuid,
LLMultiGesture* gesture = new LLMultiGesture();
LLDataPackerAsciiBuffer dp(&buffer[0], size+1);
- BOOL ok = gesture->deserialize(dp);
+ bool ok = gesture->deserialize(dp);
if (ok)
{
@@ -1460,9 +1460,9 @@ void LLGestureMgr::notifyObservers()
}
}
-BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
+bool LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
{
- S32 in_len = in_str.length();
+ auto in_len = in_str.length();
//return whole trigger, if received text equals to it
item_map_t::iterator it;
@@ -1475,7 +1475,7 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
if (!LLStringUtil::compareInsensitive(in_str, trigger))
{
*out_str = trigger;
- return TRUE;
+ return true;
}
}
}
@@ -1490,7 +1490,7 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
{
const std::string& trigger = gesture->getTrigger();
- if (in_len > (S32)trigger.length())
+ if (in_len > trigger.length())
{
// too short, bail out
continue;
@@ -1526,7 +1526,7 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
}
if (rest_of_match.compare("") == 0)
{
- return TRUE;
+ return true;
}
if (buf.compare("") != 0)
{
@@ -1540,10 +1540,10 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
if (rest_of_match.compare("") != 0)
{
*out_str = in_str+rest_of_match;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}