diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2016-12-20 09:44:10 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2016-12-20 09:44:10 -0500 |
commit | 573287b50f5005a279ea1ec42c4ddc18bd9c996b (patch) | |
tree | 5a06bf7d13e586e5159b74e18b37aca981a1a44a /indra | |
parent | 2499f6bcff53812d1d8bd1a73d657ef1861d7482 (diff) |
DRTVWR-418: Fix API for LLTracker::stopTracking().
The signature for LLTracker::stopTracking() was silly: it accepted a void* for
the sole purpose of testing whether it was NULL. In other words, the parameter
was really a bool in void* clothing. Most callers passed NULL.
What got ugly was when you wanted to pass 'true', or a variable bool value.
Such values had to be cast to void*. In 64-bit land, the compiler correctly
flags that as extremely dubious practice.
But it's entirely unnecessary. Since stopTracking() wants a bool, change its
parameter to bool. Everybody wins.
(While at it, change a few related method params from BOOL to builtin bool.)
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatermap.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterworldmap.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llnetmap.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lltracker.cpp | 13 | ||||
-rw-r--r-- | indra/newview/lltracker.h | 12 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 2 |
6 files changed, 25 insertions, 26 deletions
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 333ff863e5..fc2da772f3 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -119,7 +119,7 @@ BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask) LLVector3d pos_global = mMap->viewPosToGlobal(x, y); - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance(); if (world_map) { diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index c67feb8158..d89fa03c1a 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -558,7 +558,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& } else { - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); } setDefaultBtn("Teleport"); } @@ -602,7 +602,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) } else { - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); } setDefaultBtn("Teleport"); } @@ -628,7 +628,7 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) if (!sim_info) { // We haven't found a region for that point yet, leave the tracking to the world map - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); LLWorldMap::getInstance()->setTracking(pos_global); S32 world_x = S32(pos_global.mdV[0] / 256); S32 world_y = S32(pos_global.mdV[1] / 256); @@ -644,7 +644,7 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) { // Down region. Show the blue circle of death! // i.e. let the world map that this and tell it it's invalid - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); LLWorldMap::getInstance()->setTracking(pos_global); LLWorldMap::getInstance()->setTrackingInvalid(); setDefaultBtn(""); @@ -863,7 +863,7 @@ void LLFloaterWorldMap::friendsChanged() (buddy_info && !buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) || gAgent.isGodlike()) { - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); } } } @@ -1070,7 +1070,7 @@ void LLFloaterWorldMap::onLandmarkComboPrearrange( ) if( current_choice.isNull() || !list->setCurrentByID( current_choice ) ) { - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); } } @@ -1080,7 +1080,7 @@ void LLFloaterWorldMap::onComboTextEntry() // Reset the tracking whenever we start typing into any of the search fields, // so that hitting <enter> does an auto-complete versus teleporting us to the // previously selected landmark/friend. - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); } void LLFloaterWorldMap::onSearchTextEntry( ) @@ -1103,7 +1103,7 @@ void LLFloaterWorldMap::onLandmarkComboCommit() LLUUID asset_id; LLUUID item_id = list->getCurrentID(); - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); //RN: stopTracking() clears current combobox selection, need to reassert it here list->setCurrentByID(item_id); @@ -1158,7 +1158,7 @@ void LLFloaterWorldMap::onAvatarComboPrearrange( ) if( !list->setCurrentByID( current_choice ) || current_choice.isNull() ) { - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); } } @@ -1271,7 +1271,7 @@ void LLFloaterWorldMap::onCoordinatesCommit() void LLFloaterWorldMap::onClearBtn() { mTrackedStatus = LLTracker::TRACKING_NOTHING; - LLTracker::stopTracking((void *)(intptr_t)TRUE); + LLTracker::stopTracking(true); LLWorldMap::getInstance()->cancelTracking(); mSLURL = LLSLURL(); // Clear the SLURL since it's invalid mSetToUserPosition = TRUE; // Revert back to the current user position diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 72faa5a9e7..248c361ca4 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -988,6 +988,6 @@ void LLNetMap::handleStopTracking (const LLSD& userdata) if (mPopupMenu) { mPopupMenu->setItemEnabled ("Stop Tracking", false); - LLTracker::stopTracking ((void*)LLTracker::isTracking(NULL)); + LLTracker::stopTracking (LLTracker::isTracking(NULL)); } } diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index b015cde45d..2ec5c41b88 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -100,9 +100,8 @@ LLTracker::~LLTracker() // static -void LLTracker::stopTracking(void* userdata) +void LLTracker::stopTracking(bool clear_ui) { - BOOL clear_ui = ((BOOL)(intptr_t)userdata); instance()->stopTrackingAll(clear_ui); } @@ -183,7 +182,7 @@ void LLTracker::render3D() F32 dist = gFloaterWorldMap->getDistanceToDestination(pos_global, 0.5f); if (dist < DESTINATION_REACHED_RADIUS) { - instance()->stopTrackingLocation(FALSE,TRUE); + instance()->stopTrackingLocation(false,true); } else { @@ -606,7 +605,7 @@ void LLTracker::renderBeacon(LLVector3d pos_global, } -void LLTracker::stopTrackingAll(BOOL clear_ui) +void LLTracker::stopTrackingAll(bool clear_ui) { switch (mTrackingStatus) { @@ -626,7 +625,7 @@ void LLTracker::stopTrackingAll(BOOL clear_ui) } -void LLTracker::stopTrackingAvatar(BOOL clear_ui) +void LLTracker::stopTrackingAvatar(bool clear_ui) { LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); if( !av_tracker.getAvatarID().isNull() ) @@ -640,7 +639,7 @@ void LLTracker::stopTrackingAvatar(BOOL clear_ui) } -void LLTracker::stopTrackingLandmark(BOOL clear_ui) +void LLTracker::stopTrackingLandmark(bool clear_ui) { purgeBeaconText(); mTrackedLandmarkAssetID.setNull(); @@ -655,7 +654,7 @@ void LLTracker::stopTrackingLandmark(BOOL clear_ui) } -void LLTracker::stopTrackingLocation(BOOL clear_ui, BOOL dest_reached) +void LLTracker::stopTrackingLocation(bool clear_ui, bool dest_reached) { purgeBeaconText(); mTrackedLocationName.assign(""); diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h index a1c5052c1b..4a6f10b767 100644 --- a/indra/newview/lltracker.h +++ b/indra/newview/lltracker.h @@ -74,8 +74,8 @@ public: // these are static so that they can be used a callbacks static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; } static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; } - static BOOL isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; } - static void stopTracking(void*); + static bool isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; } + static void stopTracking(bool); static void clearFocus(); static const LLUUID& getTrackedLandmarkAssetID() { return instance()->mTrackedLandmarkAssetID; } @@ -114,10 +114,10 @@ protected: LLHUDText* hud_textp, const std::string& label ); - void stopTrackingAll(BOOL clear_ui = FALSE); - void stopTrackingAvatar(BOOL clear_ui = FALSE); - void stopTrackingLocation(BOOL clear_ui = FALSE, BOOL dest_reached = FALSE); - void stopTrackingLandmark(BOOL clear_ui = FALSE); + void stopTrackingAll(bool clear_ui = false); + void stopTrackingAvatar(bool clear_ui = false); + void stopTrackingLocation(bool clear_ui = false, bool dest_reached = false); + void stopTrackingLandmark(bool clear_ui = false); void drawMarker(const LLVector3d& pos_global, const LLColor4& color); void setLandmarkVisited(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f472db080f..68d5e4ba2d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4196,7 +4196,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) LLVector3 beacon_dir(agent_pos.mV[VX] - (F32)fmod(beacon_pos.mdV[VX], 256.0), agent_pos.mV[VY] - (F32)fmod(beacon_pos.mdV[VY], 256.0), 0); if (beacon_dir.magVecSquared() < 25.f) { - LLTracker::stopTracking(NULL); + LLTracker::stopTracking(false); } else if ( is_teleport && !gAgent.getTeleportKeepsLookAt() && look_at.isExactlyZero()) { |