Actually update object cost based on result.

master
Dave Parks 2010-05-14 17:36:57 -05:00
parent d334a9e645
commit 8be6ad300a
2 changed files with 26 additions and 3 deletions

View File

@ -60,6 +60,7 @@
#include "llviewercamera.h"
#include "llselectmgr.h"
#include "llresmgr.h"
#include "llsdutil.h"
#include "llviewerregion.h"
#include "llviewerstats.h"
#include "llvoavatarself.h"
@ -661,7 +662,14 @@ class LLObjectCostResponder : public LLCurl::Responder
public:
void result(const LLSD& content)
{
llinfos << content << llendl;
for (LLSD::map_const_iterator iter = content.beginMap(); iter != content.endMap(); ++iter)
{
LLUUID object_id = LLUUID(iter->first);
S32 link_cost = iter->second["LinkResourceCost"].asInteger();
S32 prim_cost = iter->second["PrimResourceCost"].asInteger();
gObjectList.updateObjectCost(object_id, prim_cost, link_cost);
}
}
};
@ -768,7 +776,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
if (regionp)
{
std::string url; // = regionp->getCapability("GetObjectCost");
std::string url = regionp->getCapability("GetObjectCost");
if (!url.empty())
{
@ -785,7 +793,10 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
mPendingObjectCost = mStaleObjectCost;
mStaleObjectCost.clear();
LLHTTPClient::post(url, id_list, new LLObjectCostResponder());
if (id_list.size() > 0)
{
LLHTTPClient::post(url, id_list, new LLObjectCostResponder());
}
}
else
{
@ -1088,6 +1099,17 @@ void LLViewerObjectList::updateObjectCost(LLViewerObject* object)
mStaleObjectCost.insert(object->getID());
}
void LLViewerObjectList::updateObjectCost(LLUUID object_id, S32 prim_cost, S32 link_cost)
{
mPendingObjectCost.erase(object_id);
LLViewerObject* object = findObject(object_id);
if (object)
{
object->setObjectCost(prim_cost);
}
}
void LLViewerObjectList::shiftObjects(const LLVector3 &offset)
{
// This is called when we shift our origin when we cross region boundaries...

View File

@ -92,6 +92,7 @@ public:
void update(LLAgent &agent, LLWorld &world);
void updateObjectCost(LLViewerObject* object);
void updateObjectCost(LLUUID object_id, S32 prim_cost, S32 link_cost);
void shiftObjects(const LLVector3 &offset);