diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-06 00:00:54 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-06 00:05:22 +0200 |
commit | 9113afb868f6c1da5911437d3ddabdcf169cbec2 (patch) | |
tree | 4efb107417b369e8362630fd49ea10fa38210f2a /src/game.cpp | |
parent | 96e56ba80110b54af0ee8ebb3410bd4d9d21cdfe (diff) | |
download | mana-9113afb868f6c1da5911437d3ddabdcf169cbec2.tar.gz mana-9113afb868f6c1da5911437d3ddabdcf169cbec2.tar.bz2 mana-9113afb868f6c1da5911437d3ddabdcf169cbec2.tar.xz mana-9113afb868f6c1da5911437d3ddabdcf169cbec2.zip |
Use a namespace to keep apart implementations of network handlers
Since we'll have three "InventoryHandler" classes, etc. this shows an
example of how we can compile with all of them at the same time using
namespaces. We'll have:
Net::InventoryHandler - the interface
EAthena::InventoryHandler - the eAthena implementation
TmwServ::InventoryHandler - the tmwserv implementation
Maybe we'll find a better way later, but for now this works. I'm not
convinced yet that using namespaces is better than just using longer
class names like EAthenaInventoryHandler.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp index 2f66b86f..c6031eba 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -85,6 +85,9 @@ #include "gui/storagewindow.h" #endif +#include "net/tmwserv/inventoryhandler.h" +#include "net/ea/inventoryhandler.h" + #ifdef TMWSERV_SUPPORT #include "net/tmwserv/chathandler.h" #include "net/tmwserv/itemhandler.h" @@ -96,7 +99,6 @@ #include "net/tmwserv/buysellhandler.h" #include "net/tmwserv/effecthandler.h" #include "net/tmwserv/guildhandler.h" -#include "net/tmwserv/inventoryhandler.h" #include "net/tmwserv/partyhandler.h" #else #include "net/ea/gui/partytab.h" @@ -105,7 +107,6 @@ #include "net/ea/beinghandler.h" #include "net/ea/buysellhandler.h" #include "net/ea/equipmenthandler.h" -#include "net/ea/inventoryhandler.h" #include "net/ea/itemhandler.h" #include "net/ea/maphandler.h" #include "net/ea/npchandler.h" @@ -367,7 +368,11 @@ Game::Game(Network *network): mPartyHandler(new PartyHandler), mBuySellHandler(new BuySellHandler), mChatHandler(new ChatHandler), - mInventoryHandler(new InventoryHandler), +#ifdef TMWSERV_SUPPORT + mInventoryHandler(new TmwServ::InventoryHandler), +#else + mInventoryHandler(new EAthena::InventoryHandler), +#endif mItemHandler(new ItemHandler), mNpcHandler(new NpcHandler), mPlayerHandler(new PlayerHandler), |