aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llworld.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llworld.cpp')
-rw-r--r--linden/indra/newview/llworld.cpp66
1 files changed, 61 insertions, 5 deletions
diff --git a/linden/indra/newview/llworld.cpp b/linden/indra/newview/llworld.cpp
index 04f9e25..9ee789a 100644
--- a/linden/indra/newview/llworld.cpp
+++ b/linden/indra/newview/llworld.cpp
@@ -951,7 +951,7 @@ void LLWorld::updateWaterObjects()
951 951
952void LLWorld::shiftRegions(const LLVector3& offset) 952void LLWorld::shiftRegions(const LLVector3& offset)
953{ 953{
954 for (region_list_t::iterator i = getRegionList().begin(); i != getRegionList().end(); ++i) 954 for (region_list_t::const_iterator i = getRegionList().begin(); i != getRegionList().end(); ++i)
955 { 955 {
956 LLViewerRegion* region = *i; 956 LLViewerRegion* region = *i;
957 region->updateRenderMatrix(); 957 region->updateRenderMatrix();
@@ -1137,8 +1137,8 @@ void send_agent_pause()
1137 gAgentPauseSerialNum++; 1137 gAgentPauseSerialNum++;
1138 gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum); 1138 gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum);
1139 1139
1140 for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin(); 1140 for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
1141 iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter) 1141 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
1142 { 1142 {
1143 LLViewerRegion* regionp = *iter; 1143 LLViewerRegion* regionp = *iter;
1144 gMessageSystem->sendReliable(regionp->getHost()); 1144 gMessageSystem->sendReliable(regionp->getHost());
@@ -1167,8 +1167,8 @@ void send_agent_resume()
1167 gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum); 1167 gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum);
1168 1168
1169 1169
1170 for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin(); 1170 for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
1171 iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter) 1171 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
1172 { 1172 {
1173 LLViewerRegion* regionp = *iter; 1173 LLViewerRegion* regionp = *iter;
1174 gMessageSystem->sendReliable(regionp->getHost()); 1174 gMessageSystem->sendReliable(regionp->getHost());
@@ -1180,6 +1180,62 @@ void send_agent_resume()
1180 LLAppViewer::instance()->resumeMainloopTimeout(); 1180 LLAppViewer::instance()->resumeMainloopTimeout();
1181} 1181}
1182 1182
1183static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin)
1184{
1185 LLVector3d pos_global;
1186 LLVector3 pos_local;
1187 U8 bits;
1188
1189 bits = compact_local & 0xFF;
1190 pos_local.mV[VZ] = F32(bits) * 4.f;
1191 compact_local >>= 8;
1192
1193 bits = compact_local & 0xFF;
1194 pos_local.mV[VY] = (F32)bits;
1195 compact_local >>= 8;
1196
1197 bits = compact_local & 0xFF;
1198 pos_local.mV[VX] = (F32)bits;
1199
1200 pos_global.setVec( pos_local );
1201 pos_global += region_origin;
1202 return pos_global;
1203}
1204
1205void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
1206{
1207 if(avatar_ids != NULL)
1208 {
1209 avatar_ids->clear();
1210 }
1211 if(positions != NULL)
1212 {
1213 positions->clear();
1214 }
1215 for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
1216 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
1217 {
1218 LLViewerRegion* regionp = *iter;
1219 const LLVector3d& origin_global = regionp->getOriginGlobal();
1220 S32 count = regionp->mMapAvatars.count();
1221 for (S32 i = 0; i < count; i++)
1222 {
1223 LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global);
1224 if(dist_vec(pos_global, relative_to) <= radius)
1225 {
1226 if(positions != NULL)
1227 {
1228 positions->push_back(pos_global);
1229 }
1230 if(avatar_ids != NULL)
1231 {
1232 avatar_ids->push_back(regionp->mMapAvatarIDs.get(i));
1233 }
1234 }
1235 }
1236 }
1237}
1238
1183 1239
1184LLHTTPRegistration<LLEstablishAgentCommunication> 1240LLHTTPRegistration<LLEstablishAgentCommunication>
1185 gHTTPRegistrationEstablishAgentCommunication( 1241 gHTTPRegistrationEstablishAgentCommunication(