From 150a190ac5ece99fe9e2c8eafaf6dbf0af02dca1 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 25 Oct 2010 19:48:41 -0700 Subject: Cleaned up the ugly Phoenix code for #637 and made it translatable --- linden/indra/newview/llagent.cpp | 82 ++++++++++++---------- linden/indra/newview/llagent.h | 25 ++++--- linden/indra/newview/llworldmap.cpp | 4 +- .../newview/skins/default/xui/en-us/strings.xml | 6 ++ 4 files changed, 64 insertions(+), 53 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index 0a0374c..758cae2 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp @@ -109,6 +109,7 @@ #include "lltoolmgr.h" #include "lltoolpie.h" #include "lltoolview.h" +#include "lltrans.h" #include "llui.h" // for make_ui_sound #include "llurldispatcher.h" #include "llviewercamera.h" @@ -226,16 +227,6 @@ LLAgent gAgent; // BOOL LLAgent::sPhantom = FALSE; -BOOL LLAgent::lure_show = FALSE; -std::string LLAgent::lure_name; -LLVector3d LLAgent::lure_posglobal; -U16 LLAgent::lure_global_x; -U16 LLAgent::lure_global_y; -int LLAgent::lure_x; -int LLAgent::lure_y; -int LLAgent::lure_z; -std::string LLAgent::lure_maturity; - const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; std::map LLAgent::sTeleportErrorMessages; @@ -415,7 +406,17 @@ LLAgent::LLAgent() : mWearablesLoaded(FALSE), mTextureCacheQueryID(0), mAppearanceSerialNum(0), - mbTeleportKeepsLookAt(false) + mbTeleportKeepsLookAt(false), + + mLureShow(FALSE), + mLureName(""), + mLurePosGlobal(), + mLureGlobalX(0), + mLureGlobalY(0), + mLureX(0), + mLureY(0), + mLureZ(0), + mLureMaturityString("") { U32 i; for (i = 0; i < TOTAL_CONTROLS; i++) @@ -8090,7 +8091,7 @@ LLVector3 LLAgent::getLastCoords() return mLastCoordinates; } -void LLAgent::showLureDestination(const std::string fromname, const int global_x, const int global_y, const int x, const int y, const int z, const std::string maturity) +void LLAgent::showLureDestination(const std::string fromname, const S32 global_x, const S32 global_y, const S32 x, const S32 y, const S32 z, const std::string maturity) { const LLVector3d posglobal = LLVector3d(F64(global_x), F64(global_y), F64(0)); LLSimInfo* siminfo; @@ -8098,49 +8099,54 @@ void LLAgent::showLureDestination(const std::string fromname, const int global_x std::string sim_name; LLWorldMap::getInstance()->simNameFromPosGlobal( posglobal, sim_name ); - if(siminfo) + if (siminfo) { - llinfos << fromname << "'s teleport lure is to " << sim_name.c_str() << " (" << maturity << ")" << llendl; - std::string url = LLURLDispatcher::buildSLURL(sim_name.c_str(), S32(x), S32(y), S32(z)); - std::string msg; - msg = llformat("%s's teleport lure is to %s", fromname.c_str(), url.c_str()); - if(maturity != "") + LLStringUtil::format_map_t args; + args["[NAME]"] = fromname; + args["[DESTINATION]"] = LLURLDispatcher::buildSLURL(sim_name.c_str(), S32(x), S32(y), S32(z)); + std::string msg = LLTrans::getString("TeleportLureMaturity", args); + if (maturity != "") + { msg.append(llformat(" (%s)", maturity.c_str())); + } LLChat chat(msg); LLFloaterChat::addChat(chat); } else { - LLAgent::lure_show = TRUE; - LLAgent::lure_name = fromname; - LLAgent::lure_posglobal = posglobal; - LLAgent::lure_global_x = U16(global_x / 256); - LLAgent::lure_global_y = U16(global_y / 256); - LLAgent::lure_x = x; - LLAgent::lure_y = y; - LLAgent::lure_z = z; - LLAgent::lure_maturity = maturity; - LLWorldMap::getInstance()->sendMapBlockRequest(lure_global_x, lure_global_y, lure_global_x, lure_global_y, true); + mLureShow = TRUE; + mLureName = fromname; + mLurePosGlobal = posglobal; + mLureGlobalX = U16(global_x / 256); + mLureGlobalY = U16(global_y / 256); + mLureX = x; + mLureY = y; + mLureZ = z; + mLureMaturityString = maturity; + LLWorldMap::getInstance()->sendMapBlockRequest(mLureGlobalX, mLureGlobalY, mLureGlobalX, mLureGlobalY, true); } } void LLAgent::onFoundLureDestination() { - LLAgent::lure_show = FALSE; + mLureShow = FALSE; LLSimInfo* siminfo; - siminfo = LLWorldMap::getInstance()->simInfoFromPosGlobal(LLAgent::lure_posglobal); + siminfo = LLWorldMap::getInstance()->simInfoFromPosGlobal(mLurePosGlobal); std::string sim_name; - LLWorldMap::getInstance()->simNameFromPosGlobal( LLAgent::lure_posglobal, sim_name ); + LLWorldMap::getInstance()->simNameFromPosGlobal( mLurePosGlobal, sim_name ); - if(siminfo && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))) + if (siminfo && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))) { - llinfos << LLAgent::lure_name << " is offering a TP to " << sim_name.c_str() << " (" << LLAgent::lure_maturity << ")" << llendl; - std::string url = LLURLDispatcher::buildSLURL(sim_name.c_str(), S32(LLAgent::lure_x), S32(LLAgent::lure_y), S32(LLAgent::lure_z)); - std::string msg; - msg = llformat("%s is offering a TP to %s", LLAgent::lure_name.c_str(), url.c_str()); - if(LLAgent::lure_maturity != "") - msg.append(llformat(" (%s)", LLAgent::lure_maturity.c_str())); + llinfos << mLureName << " is offering a TP to " << sim_name.c_str() << " (" << mLureMaturityString << ")" << llendl; + LLStringUtil::format_map_t args; + args["[NAME]"] = mLureName; + args["[DESTINATION]"] = LLURLDispatcher::buildSLURL(sim_name.c_str(), S32(mLureX), S32(mLureY), S32(mLureZ)); + std::string msg = LLTrans::getString("TeleportOfferMaturity", args); + if (mLureMaturityString != "") + { + msg.append(llformat(" (%s)", mLureMaturityString.c_str())); + } LLChat chat(msg); LLFloaterChat::addChat(chat); } diff --git a/linden/indra/newview/llagent.h b/linden/indra/newview/llagent.h index 03b0045..6bc4dac 100644 --- a/linden/indra/newview/llagent.h +++ b/linden/indra/newview/llagent.h @@ -767,17 +767,6 @@ public: BOOL mInitialized; - static BOOL lure_show; - static std::string lure_name; - static LLVector3d lure_posglobal; - static U16 lure_global_x; - static U16 lure_global_y; - static int lure_x; - static int lure_y; - static int lure_z; - static std::string lure_maturity; - - S32 mNumPendingQueries; S32* mActiveCacheQueries; @@ -793,8 +782,18 @@ public: LLFrameTimer mDoubleTapRunTimer; EDoubleTapRunMode mDoubleTapRunMode; - static void showLureDestination(const std::string fromname, const int global_x, const int global_y, const int x, const int y, const int z, const std::string maturity); - static void onFoundLureDestination(); + BOOL mLureShow; + std::string mLureName; + LLVector3d mLurePosGlobal; + U16 mLureGlobalX; + U16 mLureGlobalY; + S32 mLureX; + S32 mLureY; + S32 mLureZ; + std::string mLureMaturityString; + + void showLureDestination(const std::string fromname, const S32 global_x, const S32 global_y, const S32 x, const S32 y, const S32 z, const std::string maturity); + void onFoundLureDestination(); private: bool mbTeleportKeepsLookAt; diff --git a/linden/indra/newview/llworldmap.cpp b/linden/indra/newview/llworldmap.cpp index 01a66d4..43d7426 100644 --- a/linden/indra/newview/llworldmap.cpp +++ b/linden/indra/newview/llworldmap.cpp @@ -735,9 +735,9 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) callback(handle, LLWorldMap::getInstance()->mSLURL, image_id, LLWorldMap::getInstance()->mSLURLTeleport); } } - if(LLAgent::lure_show) + if(gAgent.mLureShow) { - if((x_regions == LLAgent::lure_global_x) && (y_regions == LLAgent::lure_global_y)) + if((x_regions == gAgent.mLureGlobalX) && (y_regions == gAgent.mLureGlobalY)) { gAgent.onFoundLureDestination(); } diff --git a/linden/indra/newview/skins/default/xui/en-us/strings.xml b/linden/indra/newview/skins/default/xui/en-us/strings.xml index ceb6994..d3c9df1 100644 --- a/linden/indra/newview/skins/default/xui/en-us/strings.xml +++ b/linden/indra/newview/skins/default/xui/en-us/strings.xml @@ -23,6 +23,12 @@ Copied key(s) for: + + [NAME] is offering a TP to [DESTINATION] + + + [NAME]'s teleport lure is to [DESTINATION] + Logging in. [APP_NAME] may appear frozen. Please wait. -- cgit v1.1