diff options
author | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-11-11 01:37:41 +0200 |
---|---|---|
committer | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-11-11 01:37:41 +0200 |
commit | 4005a820f26d4287bf5c14ec011d4f792c5b82bc (patch) | |
tree | c812b4c6111acc0b8f7e0acc654b1791c9b05d3c /indra/llinventory/lleconomy.cpp | |
parent | d1d8ae974c7dc65f9de40e6caf4edf9a1b7442cb (diff) |
EXP-1563 FIXED Negative upload cost displayed on the "Save to My Inventory" button.
Update upload cost in the button label when economy data arrives from server.
Diffstat (limited to 'indra/llinventory/lleconomy.cpp')
-rw-r--r-- | indra/llinventory/lleconomy.cpp | 27 |
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 |