From 941cb9f4124c9ccfd5c845bc94639fa46df12c3d Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Tue, 1 Apr 2008 17:45:04 +0000 Subject: merge release@83343 skinning-1-merge@83714 -> release QAR-424 --- indra/llinventory/lleconomy.cpp | 31 ++++++++++++++----------------- indra/llinventory/lleconomy.h | 11 ++++++++--- 2 files changed, 22 insertions(+), 20 deletions(-) (limited to 'indra/llinventory') 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 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 -- cgit v1.2.3