aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--linden/indra/newview/llchatbar.cpp79
1 files changed, 39 insertions, 40 deletions
diff --git a/linden/indra/newview/llchatbar.cpp b/linden/indra/newview/llchatbar.cpp
index 52397b4..9d56638 100644
--- a/linden/indra/newview/llchatbar.cpp
+++ b/linden/indra/newview/llchatbar.cpp
@@ -252,62 +252,61 @@ BOOL LLChatBar::handleKeyHere( KEY key, MASK mask )
252 else 252 else
253 return handled; 253 return handled;
254 254
255 std::string to_match_test(to_match); 255 names.clear();
256 std::transform(to_match_test.begin(), to_match_test.end(), to_match_test.begin(), tolower);
257 256
258 if (last_initials != to_match_test) 257 for (U32 i=0; i<avatar_ids.size(); i++)
259 { 258 {
260 last_initials = to_match_test; 259 if (avatar_ids[i] == gAgent.getID() || avatar_ids[i].isNull())
261 names.clear(); 260 continue;
262 current_index = 0;
263 261
264 for (U32 i=0; i<avatar_ids.size(); i++) 262 // Grab the pos again from the objects-in-view cache... LLWorld doesn't work above 1024 meters as usual :(
263 LLVector3d real_pos = positions[i];
264 if (real_pos[2] == 0.0f)
265 { 265 {
266 if (avatar_ids[i] == gAgent.getID() || avatar_ids[i].isNull()) 266 LLViewerObject *av_obj = gObjectList.findObject(avatar_ids[i]);
267 continue; 267 if (av_obj != NULL && av_obj->isAvatar())
268
269 // Grab the pos again from the objects-in-view cache... LLWorld doesn't work above 1024 meters as usual :(
270 LLVector3d real_pos = positions[i];
271 if (real_pos[2] == 0.0f)
272 { 268 {
273 LLViewerObject *av_obj = gObjectList.findObject(avatar_ids[i]); 269 LLVOAvatar* avatarp = (LLVOAvatar*)av_obj;
274 if (av_obj != NULL && av_obj->isAvatar()) 270 if (avatarp != NULL)
275 { 271 real_pos = avatarp->getPositionGlobal();
276 LLVOAvatar* avatarp = (LLVOAvatar*)av_obj;
277 if (avatarp != NULL)
278 real_pos = avatarp->getPositionGlobal();
279 }
280 } 272 }
273 }
281 274
282 F32 dist = F32(dist_vec(positions[i], gAgent.getPositionGlobal())); 275 F32 dist = F32(dist_vec(positions[i], gAgent.getPositionGlobal()));
283 if (dist > CHAT_SHOUT_RADIUS) 276 if (dist > CHAT_SHOUT_RADIUS)
284 continue; 277 continue;
285 278
286 std::string agent_name = " "; 279 std::string agent_name = " ";
287 std::string agent_surname = " "; 280 std::string agent_surname = " ";
288 281
289 if(!gCacheName->getName(avatar_ids[i], agent_name, agent_surname) && (agent_name == " " || agent_surname == " ")) 282 if(!gCacheName->getName(avatar_ids[i], agent_name, agent_surname) && (agent_name == " " || agent_surname == " "))
290 continue; 283 continue;
291 284
292 std::string test_name(agent_name); 285 std::string test_name(agent_name);
293 std::transform(test_name.begin(), test_name.end(), test_name.begin(), tolower); 286 std::transform(test_name.begin(), test_name.end(), test_name.begin(), tolower);
294 std::transform(to_match.begin(), to_match.end(), to_match.begin(), tolower); 287 std::transform(to_match.begin(), to_match.end(), to_match.begin(), tolower);
288
289 if (test_name.find(to_match) == 0)
290 names.push_back(agent_name);
291 }
295 292
296 if (test_name.find(to_match) == 0) 293 if (current_index >= names.size() || to_match != last_initials)
297 names.push_back(agent_name); 294 {
298 } 295 current_index = 0;
296 last_initials = to_match;
299 } 297 }
300 298
301 std::string current_name = names[current_index]; 299 if (names.size() > 0)
302 mInputEditor->setText(left_part.substr(0, left_part.length() - to_match.length()) + current_name + right_part); 300 {
303 mInputEditor->setSelection(cursorPos, cursorPos + (current_name.length() - to_match.length())); 301 std::string current_name = names[current_index];
304 302
305 current_index++; 303 mInputEditor->setText(left_part.substr(0, left_part.length() - to_match.length()) + current_name + right_part);
304 mInputEditor->setSelection(cursorPos, cursorPos + (current_name.length() - to_match.length()));
306 305
307 if (current_index == names.size()) 306 current_index++;
308 current_index = 0;
309 307
310 return TRUE; 308 return TRUE;
309 }
311 } 310 }
312 } 311 }
313 } 312 }