summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-04-01 17:45:04 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-04-01 17:45:04 +0000
commit941cb9f4124c9ccfd5c845bc94639fa46df12c3d (patch)
treee0f525e7bd6cc76d89b2df69c6f1554d191561e8 /indra/llinventory
parentecec626dec93524f7ef5831a5ba344d6449b99bc (diff)
merge release@83343 skinning-1-merge@83714 -> release
QAR-424
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/lleconomy.cpp31
-rw-r--r--indra/llinventory/lleconomy.h11
2 files changed, 22 insertions, 20 deletions
diff --git a/indra/llinventory/lleconomy.cpp b/indra/llinventory/lleconomy.cpp
index 24e9bf1cb7..3500caa3b2 100644
--- a/indra/llinventory/lleconomy.cpp
+++ b/indra/llinventory/lleconomy.cpp
@@ -35,7 +35,6 @@
#include "message.h"
#include "v3math.h"
-LLGlobalEconomy *gGlobalEconomy = NULL;
LLGlobalEconomy::LLGlobalEconomy()
: mObjectCount( -1 ),
@@ -55,35 +54,33 @@ LLGlobalEconomy::~LLGlobalEconomy()
{ }
// static
-void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, void** user_data)
+void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data)
{
S32 i;
F32 f;
- LLGlobalEconomy *this_ptr = (LLGlobalEconomy*)user_data;
-
msg->getS32Fast(_PREHASH_Info, _PREHASH_ObjectCapacity, i);
- this_ptr->setObjectCapacity(i);
+ econ_data->setObjectCapacity(i);
msg->getS32Fast(_PREHASH_Info, _PREHASH_ObjectCount, i);
- this_ptr->setObjectCount(i);
+ econ_data->setObjectCount(i);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceEnergyUnit, i);
- this_ptr->setPriceEnergyUnit(i);
+ econ_data->setPriceEnergyUnit(i);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceObjectClaim, i);
- this_ptr->setPriceObjectClaim(i);
+ econ_data->setPriceObjectClaim(i);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PricePublicObjectDecay, i);
- this_ptr->setPricePublicObjectDecay(i);
+ econ_data->setPricePublicObjectDecay(i);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PricePublicObjectDelete, i);
- this_ptr->setPricePublicObjectDelete(i);
+ econ_data->setPricePublicObjectDelete(i);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceUpload, i);
- this_ptr->setPriceUpload(i);
+ econ_data->setPriceUpload(i);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceRentLight, i);
- this_ptr->setPriceRentLight(i);
+ econ_data->setPriceRentLight(i);
msg->getS32Fast(_PREHASH_Info, _PREHASH_TeleportMinPrice, i);
- this_ptr->setTeleportMinPrice(i);
+ econ_data->setTeleportMinPrice(i);
msg->getF32Fast(_PREHASH_Info, _PREHASH_TeleportPriceExponent, f);
- this_ptr->setTeleportPriceExponent(f);
+ econ_data->setTeleportPriceExponent(f);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceGroupCreate, i);
- this_ptr->setPriceGroupCreate(i);
+ econ_data->setPriceGroupCreate(i);
}
S32 LLGlobalEconomy::calculateTeleportCost(F32 distance) const
@@ -154,10 +151,10 @@ void LLRegionEconomy::processEconomyData(LLMessageSystem *msg, void** user_data)
S32 i;
F32 f;
- LLGlobalEconomy::processEconomyData(msg, user_data);
-
LLRegionEconomy *this_ptr = (LLRegionEconomy*)user_data;
+ LLGlobalEconomy::processEconomyData(msg, this_ptr);
+
msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceParcelClaim, i);
this_ptr->setBasePriceParcelClaimDefault(i);
msg->getF32(_PREHASH_Info, _PREHASH_PriceParcelClaimFactor, f);
diff --git a/indra/llinventory/lleconomy.h b/indra/llinventory/lleconomy.h
index d1e1adcb93..4ac7cb4605 100644
--- a/indra/llinventory/lleconomy.h
+++ b/indra/llinventory/lleconomy.h
@@ -31,6 +31,8 @@
#ifndef LL_LLECONOMY_H
#define LL_LLECONOMY_H
+#include "llmemory.h"
+
class LLMessageSystem;
class LLVector3;
@@ -40,9 +42,14 @@ public:
LLGlobalEconomy();
virtual ~LLGlobalEconomy();
+ // This class defines its singleton internally as a typedef instead of inheriting from
+ // LLSingleton like most others because the LLRegionEconomy sub-class might also
+ // become a singleton and this pattern will more easily disambiguate them.
+ typedef LLSingleton<LLGlobalEconomy> Singleton;
+
virtual void print();
- static void processEconomyData(LLMessageSystem *msg, void **user_data);
+ static void processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data);
S32 calculateTeleportCost(F32 distance) const;
S32 calculateLightRent(const LLVector3& object_size) const;
@@ -136,6 +143,4 @@ private:
};
-extern LLGlobalEconomy* gGlobalEconomy;
-
#endif