summaryrefslogtreecommitdiff
path: root/indra/llinventory/lleconomy.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2011-11-22 09:49:05 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2011-11-22 09:49:05 -0500
commit4b0d2f8209f496f90e2c13643b0307a86797bdb2 (patch)
tree5d520cbd416b5f8a7624239a2a1b1b6e8c55f3bb /indra/llinventory/lleconomy.cpp
parent147b14089916bd2cbb078b0bc47c76458ab31e79 (diff)
parent1dd24cfcf85f4807410bb8d5320a692e2d7e121c (diff)
merge
Diffstat (limited to 'indra/llinventory/lleconomy.cpp')
-rw-r--r--indra/llinventory/lleconomy.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/indra/llinventory/lleconomy.cpp b/indra/llinventory/lleconomy.cpp
index c6eaa6d3e1..d643ea6ed9 100644
--- a/indra/llinventory/lleconomy.cpp
+++ b/indra/llinventory/lleconomy.cpp
@@ -48,6 +48,31 @@ LLGlobalEconomy::LLGlobalEconomy()
LLGlobalEconomy::~LLGlobalEconomy()
{ }
+void LLGlobalEconomy::addObserver(LLEconomyObserver* observer)
+{
+ mObservers.push_back(observer);
+}
+
+void LLGlobalEconomy::removeObserver(LLEconomyObserver* observer)
+{
+ std::list<LLEconomyObserver*>::iterator it =
+ std::find(mObservers.begin(), mObservers.end(), observer);
+ if (it != mObservers.end())
+ {
+ mObservers.erase(it);
+ }
+}
+
+void LLGlobalEconomy::notifyObservers()
+{
+ for (std::list<LLEconomyObserver*>::iterator it = mObservers.begin();
+ it != mObservers.end();
+ ++it)
+ {
+ (*it)->onEconomyDataChange();
+ }
+}
+
// static
void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data)
{
@@ -88,6 +113,8 @@ void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy*
econ_data->setTeleportPriceExponent(f);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceGroupCreate, i);
econ_data->setPriceGroupCreate(i);
+
+ econ_data->notifyObservers();
}
S32 LLGlobalEconomy::calculateTeleportCost(F32 distance) const