diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-08-01 22:05:46 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-08-01 22:45:31 -0600 |
commit | cec8045dcdad05d76141d4e27c8c9e72696ce7dc (patch) | |
tree | 0c7cded281b0ff01b2f0f0d74f44fc88e2622533 /src/playerinfo.cpp | |
parent | a3e61c0e830c46b51c0d135962ad361c02b93243 (diff) | |
download | mana-cec8045dcdad05d76141d4e27c8c9e72696ce7dc.tar.gz mana-cec8045dcdad05d76141d4e27c8c9e72696ce7dc.tar.bz2 mana-cec8045dcdad05d76141d4e27c8c9e72696ce7dc.tar.xz mana-cec8045dcdad05d76141d4e27c8c9e72696ce7dc.zip |
Remove isActive methods from NPC dialogs and InventoryWindow
Uses counts in PlayerInfo instead.
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/playerinfo.cpp')
-rw-r--r-- | src/playerinfo.cpp | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 7b2a9b19..a6438187 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -44,6 +44,11 @@ PlayerInfoBackend mData; Inventory *mInventory = 0; Equipment *mEquipment = 0; +bool mStorageCount = 0; + +bool mNPCCount = 0; +bool mNPCPostCount = 0; + BuySellState mBuySellState = BUYSELL_NONE; bool mTrading = false; @@ -206,6 +211,65 @@ void setEquipmentBackend(Equipment::Backend *backend) mEquipment->setBackend(backend); } +int getStorageCount() +{ + return mStorageCount; +} + +void setStorageCount(int count) +{ + int old = mStorageCount; + mStorageCount = count; + + if (count != old) + { + Mana::Event event("StorageCount"); + event.setBool("oldCount", old); + event.setBool("newCount", count); + Mana::EventManager::trigger("Storage", event); + } +} + +// -- NPC --------------------------------------------------------------------- + +int getNPCInteractionCount() +{ + return mNPCCount; +} + +void setNPCInteractionCount(int count) +{ + int old = mNPCCount; + mNPCCount = count; + + if (count != old) + { + Mana::Event event("NPCCount"); + event.setBool("oldCount", old); + event.setBool("newCount", count); + Mana::EventManager::trigger("NPC", event); + } +} + +int getNPCPostCount() +{ + return mNPCPostCount; +} + +void setNPCPostCount(int count) +{ + int old = mNPCPostCount; + mNPCPostCount = count; + + if (count != old) + { + Mana::Event event("PostCount"); + event.setBool("oldCount", old); + event.setBool("newCount", count); + Mana::EventManager::trigger("NPC", event); + } +} + // -- Buy/Sell/Trade ---------------------------------------------------------- BuySellState getBuySellState() @@ -270,8 +334,8 @@ void setBackend(const PlayerInfoBackend &backend) bool isTalking() { - return NpcDialog::isActive() || NpcPostDialog::isActive() || - PlayerInfo::getBuySellState() != BUYSELL_NONE; + return getNPCInteractionCount() || getNPCPostCount() + || getBuySellState() != BUYSELL_NONE; } void logic() |