diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-09 01:20:48 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-09 01:20:48 +0000 |
commit | 78ab0ec914d3c5a97f162905afb3dede53f8b9ed (patch) | |
tree | 53e386c28d5621535c76c35c20f28b7dd6235ee3 /src/game.cpp | |
parent | 3bd2abeeffe9fb9b23293975b159ee2ddc868e5b (diff) | |
download | mana-78ab0ec914d3c5a97f162905afb3dede53f8b9ed.tar.gz mana-78ab0ec914d3c5a97f162905afb3dede53f8b9ed.tar.bz2 mana-78ab0ec914d3c5a97f162905afb3dede53f8b9ed.tar.xz mana-78ab0ec914d3c5a97f162905afb3dede53f8b9ed.zip |
Use std::auto_ptr in some places.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/src/game.cpp b/src/game.cpp index c1c81c67..10d87d12 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -180,7 +180,7 @@ void createGuiWindows(Network *network) //newSkillWindow = new NewSkillDialog(); setupWindow = new Setup(); minimap = new Minimap(); - equipmentWindow = new EquipmentWindow(player_node->mEquipment); + equipmentWindow = new EquipmentWindow(player_node->mEquipment.get()); chargeDialog = new ChargeDialog(); tradeWindow = new TradeWindow(network); //buddyWindow = new BuddyWindow(); @@ -250,7 +250,17 @@ void destroyGuiWindows() } Game::Game(Network *network): - mNetwork(network) + mNetwork(network), + mBeingHandler(new BeingHandler()), + mBuySellHandler(new BuySellHandler()), + mChatHandler(new ChatHandler()), + mEquipmentHandler(new EquipmentHandler()), + mInventoryHandler(new InventoryHandler()), + mItemHandler(new ItemHandler()), + mNpcHandler(new NPCHandler()), + mPlayerHandler(new PlayerHandler()), + mSkillHandler(new SkillHandler()), + mTradeHandler(new TradeHandler()) { createGuiWindows(network); engine = new Engine(network); @@ -276,42 +286,20 @@ Game::Game(Network *network): joystick = new Joystick(0); } - mBeingHandler = new BeingHandler(); - mBuySellHandler = new BuySellHandler(); - mChatHandler = new ChatHandler(); - mEquipmentHandler = new EquipmentHandler(); - mInventoryHandler = new InventoryHandler(); - mItemHandler = new ItemHandler(); - mNpcHandler = new NPCHandler(); - mPlayerHandler = new PlayerHandler(); - mSkillHandler = new SkillHandler(); - mTradeHandler = new TradeHandler(); - - network->registerHandler(mBeingHandler); - network->registerHandler(mBuySellHandler); - network->registerHandler(mChatHandler); - network->registerHandler(mEquipmentHandler); - network->registerHandler(mInventoryHandler); - network->registerHandler(mItemHandler); - network->registerHandler(mNpcHandler); - network->registerHandler(mPlayerHandler); - network->registerHandler(mSkillHandler); - network->registerHandler(mTradeHandler); + network->registerHandler(mBeingHandler.get()); + network->registerHandler(mBuySellHandler.get()); + network->registerHandler(mChatHandler.get()); + network->registerHandler(mEquipmentHandler.get()); + network->registerHandler(mInventoryHandler.get()); + network->registerHandler(mItemHandler.get()); + network->registerHandler(mNpcHandler.get()); + network->registerHandler(mPlayerHandler.get()); + network->registerHandler(mSkillHandler.get()); + network->registerHandler(mTradeHandler.get()); } Game::~Game() { - delete mBeingHandler; - delete mBuySellHandler; - delete mChatHandler; - delete mEquipmentHandler; - delete mInventoryHandler; - delete mItemHandler; - delete mNpcHandler; - delete mPlayerHandler; - delete mSkillHandler; - delete mTradeHandler; - delete engine; delete player_node; destroyGuiWindows(); |