diff options
author | McCabe Maxsted | 2010-10-23 23:54:22 -0700 |
---|---|---|
committer | McCabe Maxsted | 2010-10-23 23:54:22 -0700 |
commit | 06bbe1bb663e099c5b15c07e8d8433ec065edcc3 (patch) | |
tree | ded5879a1edd037ffe90fe145ebc1e752befacc4 | |
parent | Fixed xml files from the German translation missing from the repo (diff) | |
download | meta-impy-06bbe1bb663e099c5b15c07e8d8433ec065edcc3.zip meta-impy-06bbe1bb663e099c5b15c07e8d8433ec065edcc3.tar.gz meta-impy-06bbe1bb663e099c5b15c07e8d8433ec065edcc3.tar.bz2 meta-impy-06bbe1bb663e099c5b15c07e8d8433ec065edcc3.tar.xz |
#637: teleport target location in local chat, ported from Phoenix by Ansariel Hiller
-rw-r--r-- | linden/indra/newview/llagent.cpp | 65 | ||||
-rw-r--r-- | linden/indra/newview/llagent.h | 14 | ||||
-rwxr-xr-x | linden/indra/newview/llviewermessage.cpp | 56 | ||||
-rw-r--r-- | linden/indra/newview/llworldmap.cpp | 7 |
4 files changed, 142 insertions, 0 deletions
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index eb5cf9b..0a0374c 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp | |||
@@ -226,6 +226,16 @@ LLAgent gAgent; | |||
226 | // | 226 | // |
227 | BOOL LLAgent::sPhantom = FALSE; | 227 | BOOL LLAgent::sPhantom = FALSE; |
228 | 228 | ||
229 | BOOL LLAgent::lure_show = FALSE; | ||
230 | std::string LLAgent::lure_name; | ||
231 | LLVector3d LLAgent::lure_posglobal; | ||
232 | U16 LLAgent::lure_global_x; | ||
233 | U16 LLAgent::lure_global_y; | ||
234 | int LLAgent::lure_x; | ||
235 | int LLAgent::lure_y; | ||
236 | int LLAgent::lure_z; | ||
237 | std::string LLAgent::lure_maturity; | ||
238 | |||
229 | const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; | 239 | const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; |
230 | 240 | ||
231 | std::map<std::string, std::string> LLAgent::sTeleportErrorMessages; | 241 | std::map<std::string, std::string> LLAgent::sTeleportErrorMessages; |
@@ -8080,5 +8090,60 @@ LLVector3 LLAgent::getLastCoords() | |||
8080 | return mLastCoordinates; | 8090 | return mLastCoordinates; |
8081 | } | 8091 | } |
8082 | 8092 | ||
8093 | 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) | ||
8094 | { | ||
8095 | const LLVector3d posglobal = LLVector3d(F64(global_x), F64(global_y), F64(0)); | ||
8096 | LLSimInfo* siminfo; | ||
8097 | siminfo = LLWorldMap::getInstance()->simInfoFromPosGlobal(posglobal); | ||
8098 | std::string sim_name; | ||
8099 | LLWorldMap::getInstance()->simNameFromPosGlobal( posglobal, sim_name ); | ||
8100 | |||
8101 | if(siminfo) | ||
8102 | { | ||
8103 | |||
8104 | llinfos << fromname << "'s teleport lure is to " << sim_name.c_str() << " (" << maturity << ")" << llendl; | ||
8105 | std::string url = LLURLDispatcher::buildSLURL(sim_name.c_str(), S32(x), S32(y), S32(z)); | ||
8106 | std::string msg; | ||
8107 | msg = llformat("%s's teleport lure is to %s", fromname.c_str(), url.c_str()); | ||
8108 | if(maturity != "") | ||
8109 | msg.append(llformat(" (%s)", maturity.c_str())); | ||
8110 | LLChat chat(msg); | ||
8111 | LLFloaterChat::addChat(chat); | ||
8112 | } | ||
8113 | else | ||
8114 | { | ||
8115 | LLAgent::lure_show = TRUE; | ||
8116 | LLAgent::lure_name = fromname; | ||
8117 | LLAgent::lure_posglobal = posglobal; | ||
8118 | LLAgent::lure_global_x = U16(global_x / 256); | ||
8119 | LLAgent::lure_global_y = U16(global_y / 256); | ||
8120 | LLAgent::lure_x = x; | ||
8121 | LLAgent::lure_y = y; | ||
8122 | LLAgent::lure_z = z; | ||
8123 | LLAgent::lure_maturity = maturity; | ||
8124 | LLWorldMap::getInstance()->sendMapBlockRequest(lure_global_x, lure_global_y, lure_global_x, lure_global_y, true); | ||
8125 | } | ||
8126 | } | ||
8127 | |||
8128 | void LLAgent::onFoundLureDestination() | ||
8129 | { | ||
8130 | LLAgent::lure_show = FALSE; | ||
8131 | LLSimInfo* siminfo; | ||
8132 | siminfo = LLWorldMap::getInstance()->simInfoFromPosGlobal(LLAgent::lure_posglobal); | ||
8133 | std::string sim_name; | ||
8134 | LLWorldMap::getInstance()->simNameFromPosGlobal( LLAgent::lure_posglobal, sim_name ); | ||
8135 | |||
8136 | if(siminfo && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))) | ||
8137 | { | ||
8138 | llinfos << LLAgent::lure_name << " is offering a TP to " << sim_name.c_str() << " (" << LLAgent::lure_maturity << ")" << llendl; | ||
8139 | std::string url = LLURLDispatcher::buildSLURL(sim_name.c_str(), S32(LLAgent::lure_x), S32(LLAgent::lure_y), S32(LLAgent::lure_z)); | ||
8140 | std::string msg; | ||
8141 | msg = llformat("%s is offering a TP to %s", LLAgent::lure_name.c_str(), url.c_str()); | ||
8142 | if(LLAgent::lure_maturity != "") | ||
8143 | msg.append(llformat(" (%s)", LLAgent::lure_maturity.c_str())); | ||
8144 | LLChat chat(msg); | ||
8145 | LLFloaterChat::addChat(chat); | ||
8146 | } | ||
8147 | } | ||
8083 | 8148 | ||
8084 | // EOF | 8149 | // EOF |
diff --git a/linden/indra/newview/llagent.h b/linden/indra/newview/llagent.h index 141c72c..03b0045 100644 --- a/linden/indra/newview/llagent.h +++ b/linden/indra/newview/llagent.h | |||
@@ -767,6 +767,17 @@ public: | |||
767 | 767 | ||
768 | BOOL mInitialized; | 768 | BOOL mInitialized; |
769 | 769 | ||
770 | static BOOL lure_show; | ||
771 | static std::string lure_name; | ||
772 | static LLVector3d lure_posglobal; | ||
773 | static U16 lure_global_x; | ||
774 | static U16 lure_global_y; | ||
775 | static int lure_x; | ||
776 | static int lure_y; | ||
777 | static int lure_z; | ||
778 | static std::string lure_maturity; | ||
779 | |||
780 | |||
770 | S32 mNumPendingQueries; | 781 | S32 mNumPendingQueries; |
771 | S32* mActiveCacheQueries; | 782 | S32* mActiveCacheQueries; |
772 | 783 | ||
@@ -782,6 +793,9 @@ public: | |||
782 | LLFrameTimer mDoubleTapRunTimer; | 793 | LLFrameTimer mDoubleTapRunTimer; |
783 | EDoubleTapRunMode mDoubleTapRunMode; | 794 | EDoubleTapRunMode mDoubleTapRunMode; |
784 | 795 | ||
796 | 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); | ||
797 | static void onFoundLureDestination(); | ||
798 | |||
785 | private: | 799 | private: |
786 | bool mbTeleportKeepsLookAt; | 800 | bool mbTeleportKeepsLookAt; |
787 | bool mbAlwaysRun; // should the avatar run by default rather than walk | 801 | bool mbAlwaysRun; // should the avatar run by default rather than walk |
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index dbf9d72..d3ca5f6 100755 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp | |||
@@ -2520,6 +2520,62 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
2520 | else | 2520 | else |
2521 | { | 2521 | { |
2522 | LLNotifications::instance().add("TeleportOffered", args, payload); | 2522 | LLNotifications::instance().add("TeleportOffered", args, payload); |
2523 | if(binary_bucket_size) | ||
2524 | { | ||
2525 | char* dest = new char[binary_bucket_size]; | ||
2526 | strncpy(dest, (char*)binary_bucket, binary_bucket_size-1); /* Flawfinder: ignore */ | ||
2527 | dest[binary_bucket_size-1] = '\0'; | ||
2528 | |||
2529 | llinfos << "IM_LURE_USER binary_bucket " << dest << llendl; | ||
2530 | |||
2531 | std::string str(dest); | ||
2532 | typedef boost::tokenizer<boost::char_separator<char> > tokenizer; | ||
2533 | boost::char_separator<char> sep("|","",boost::keep_empty_tokens); | ||
2534 | tokenizer tokens(str, sep); | ||
2535 | tokenizer::iterator iter = tokens.begin(); | ||
2536 | std::string global_x_str(*iter++); | ||
2537 | std::string global_y_str(*iter++); | ||
2538 | std::string x_str(*iter++); | ||
2539 | std::string y_str(*iter++); | ||
2540 | std::string z_str(*iter++); | ||
2541 | // skip what I think must be LookAt | ||
2542 | if(iter != tokens.end()) | ||
2543 | iter++; // x | ||
2544 | if(iter != tokens.end()) | ||
2545 | iter++; // y | ||
2546 | if(iter != tokens.end()) | ||
2547 | iter++; // z | ||
2548 | std::string mat_str(""); | ||
2549 | if(iter != tokens.end()) | ||
2550 | mat_str.assign(*iter++); | ||
2551 | mat_str = utf8str_trim(mat_str); | ||
2552 | |||
2553 | llinfos << "IM_LURE_USER tokenized " << global_x_str << "|" << global_y_str << "|" << x_str << "|" << y_str << "|" << z_str << "|" << mat_str << llendl; | ||
2554 | |||
2555 | std::istringstream gxstr(global_x_str); | ||
2556 | int global_x; | ||
2557 | gxstr >> global_x; | ||
2558 | |||
2559 | std::istringstream gystr(global_y_str); | ||
2560 | int global_y; | ||
2561 | gystr >> global_y; | ||
2562 | |||
2563 | std::istringstream xstr(x_str); | ||
2564 | int x; | ||
2565 | xstr >> x; | ||
2566 | |||
2567 | std::istringstream ystr(y_str); | ||
2568 | int y; | ||
2569 | ystr >> y; | ||
2570 | |||
2571 | std::istringstream zstr(z_str); | ||
2572 | int z; | ||
2573 | zstr >> z; | ||
2574 | |||
2575 | llinfos << "IM_LURE_USER parsed " << global_x << "|" << global_y << "|" << x << "|" << y << "|" << z << "|" << mat_str << llendl; | ||
2576 | |||
2577 | gAgent.showLureDestination(name, global_x, global_y, x, y, z, mat_str); | ||
2578 | } | ||
2523 | } | 2579 | } |
2524 | // [/RLVa:KB] | 2580 | // [/RLVa:KB] |
2525 | //LLNotifications::instance().add("TeleportOffered", args, payload); | 2581 | //LLNotifications::instance().add("TeleportOffered", args, payload); |
diff --git a/linden/indra/newview/llworldmap.cpp b/linden/indra/newview/llworldmap.cpp index c6242f6..01a66d4 100644 --- a/linden/indra/newview/llworldmap.cpp +++ b/linden/indra/newview/llworldmap.cpp | |||
@@ -735,6 +735,13 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) | |||
735 | callback(handle, LLWorldMap::getInstance()->mSLURL, image_id, LLWorldMap::getInstance()->mSLURLTeleport); | 735 | callback(handle, LLWorldMap::getInstance()->mSLURL, image_id, LLWorldMap::getInstance()->mSLURLTeleport); |
736 | } | 736 | } |
737 | } | 737 | } |
738 | if(LLAgent::lure_show) | ||
739 | { | ||
740 | if((x_regions == LLAgent::lure_global_x) && (y_regions == LLAgent::lure_global_y)) | ||
741 | { | ||
742 | gAgent.onFoundLureDestination(); | ||
743 | } | ||
744 | } | ||
738 | } | 745 | } |
739 | 746 | ||
740 | if(adjust) gFloaterWorldMap->adjustZoomSliderBounds(); | 747 | if(adjust) gFloaterWorldMap->adjustZoomSliderBounds(); |