]>
Commit | Line | Data |
---|---|---|
99c0151e | 1 | #ifndef __GS__INVENTORYMANAGER_H__\r |
2 | #define __GS__INVENTORYMANAGER_H__\r | |
3 | \r | |
19113e61 | 4 | #include <boost/smart_ptr/shared_ptr.hpp>\r |
5 | using boost::shared_ptr;\r | |
6 | #include <GameServ/GameLayer/GameObjects/ItemGO.h>\r | |
7 | using GameServ::GameLayer::GameObjects::ItemGO;\r | |
8 | #include <GameServ/GameLayer/GameObjects/PlayerGO.h>\r | |
9 | using GameServ::GameLayer::GameObjects::PlayerGO;\r | |
10 | \r | |
11 | #include <list>\r | |
12 | #include <map>\r | |
13 | using std::list;\r | |
14 | using std::map;\r | |
15 | \r | |
16 | \r | |
99c0151e | 17 | namespace GameServ { namespace GameLayer { namespace Helpers {\r |
18 | \r | |
19113e61 | 19 | \r |
998a0b4c | 20 | typedef list< shared_ptr<ItemGO> > ItemList;\r |
21 | typedef map<string, ItemList> PlayerInventoryMap;\r | |
22 | \r | |
19113e61 | 23 | \r |
99c0151e | 24 | class InventoryManager\r |
25 | {\r | |
26 | public:\r | |
998a0b4c | 27 | \r |
28 | \r | |
99c0151e | 29 | ~InventoryManager();\r |
30 | \r | |
998a0b4c | 31 | static shared_ptr<InventoryManager> Instance();\r |
32 | \r | |
19113e61 | 33 | void AddItem(shared_ptr<PlayerGO> spPlayer, shared_ptr<ItemGO> spItem);\r |
34 | void RemoveItem(shared_ptr<PlayerGO> spPlayer, shared_ptr<ItemGO> spItem);\r | |
998a0b4c | 35 | ItemList GetInventory(shared_ptr<PlayerGO> spPlayer) const; \r |
99c0151e | 36 | \r |
998a0b4c | 37 | protected:\r |
38 | InventoryManager();\r | |
99c0151e | 39 | private:\r |
19113e61 | 40 | \r |
998a0b4c | 41 | PlayerInventoryMap mInventoryTable;\r |
42 | static shared_ptr<InventoryManager> mInstance;\r | |
19113e61 | 43 | \r |
99c0151e | 44 | }; // InventoryManager\r |
45 | \r | |
46 | }}} // GameServ::GameLayer::Helpers\r | |
47 | \r | |
48 | #endif |