namespace GameServ { namespace GameLayer { namespace Helpers {\r
\r
\r
- typedef list< shared_ptr<ItemGO> > PlayerInventory;\r
- typedef map<shared_ptr<PlayerGO>, PlayerInventory> InventoryMap;\r
+typedef list< shared_ptr<ItemGO> > ItemList;\r
+typedef map<string, ItemList> PlayerInventoryMap;\r
+\r
\r
class InventoryManager\r
{\r
public:\r
- InventoryManager();\r
+\r
+\r
~InventoryManager();\r
\r
+ static shared_ptr<InventoryManager> Instance();\r
+\r
void AddItem(shared_ptr<PlayerGO> spPlayer, shared_ptr<ItemGO> spItem);\r
void RemoveItem(shared_ptr<PlayerGO> spPlayer, shared_ptr<ItemGO> spItem);\r
- PlayerInventory GetInventory(shared_ptr<PlayerGO> spPlayer) const; \r
+ ItemList GetInventory(shared_ptr<PlayerGO> spPlayer) const; \r
\r
+protected:\r
+ InventoryManager();\r
private:\r
\r
- InventoryMap mInventoryTable;\r
+ PlayerInventoryMap mInventoryTable;\r
+ static shared_ptr<InventoryManager> mInstance;\r
\r
}; // InventoryManager\r
\r