diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-12-02 14:35:42 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-12-02 14:35:42 -0700 |
commit | 91761b7926c2503664c4db24c5aa44f817384227 (patch) | |
tree | a6c1c5d31593048326f1026fa52997b3003df471 /src/net | |
parent | d12c93d4d6fc38eb86b5cb8515f4b8f8a7e96b54 (diff) | |
download | mana-91761b7926c2503664c4db24c5aa44f817384227.tar.gz mana-91761b7926c2503664c4db24c5aa44f817384227.tar.bz2 mana-91761b7926c2503664c4db24c5aa44f817384227.tar.xz mana-91761b7926c2503664c4db24c5aa44f817384227.zip |
Centralize netcode handler instances in Net
Instead of each netcode making the global variables and Net referencing them, Net now makes them and the netcodes reference them.
Also remove an innappropriate ChatHandler reference from eA's AdminHandler.
Diffstat (limited to 'src/net')
27 files changed, 41 insertions, 45 deletions
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp index 62fe9ea8..a58154f6 100644 --- a/src/net/ea/adminhandler.cpp +++ b/src/net/ea/adminhandler.cpp @@ -38,9 +38,7 @@ #include <string> -extern Net::ChatHandler *chatHandler; - -Net::AdminHandler *adminHandler; +extern Net::AdminHandler *adminHandler; namespace EAthena { @@ -97,7 +95,7 @@ void AdminHandler::kick(int playerId) void AdminHandler::kick(const std::string &name) { - chatHandler->talk("@kick " + name); + Net::getChatHandler()->talk("@kick " + name); } void AdminHandler::ban(int playerId) @@ -107,7 +105,7 @@ void AdminHandler::ban(int playerId) void AdminHandler::ban(const std::string &name) { - chatHandler->talk("@ban " + name); + Net::getChatHandler()->talk("@ban " + name); } void AdminHandler::unban(int playerId) diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 47eddc12..8dacb06f 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -42,7 +42,7 @@ #include "utils/gettext.h" #include "utils/stringutils.h" -Net::CharHandler *charHandler; +extern Net::CharHandler *charHandler; namespace EAthena { diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 913cfacf..b3104e36 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -39,7 +39,7 @@ #include <string> -Net::ChatHandler *chatHandler; +extern Net::ChatHandler *chatHandler; namespace EAthena { diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 5becfe1b..41c86d4d 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -40,8 +40,7 @@ #include "utils/gettext.h" #include "utils/stringutils.h" -Net::GameHandler *gameHandler; -extern Game *game; +extern Net::GameHandler *gameHandler; namespace EAthena { diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index dc022557..3818afec 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -62,7 +62,7 @@ #include <assert.h> #include <list> -Net::GeneralHandler *generalHandler = NULL; +extern Net::GeneralHandler *generalHandler; namespace EAthena { diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 0cccd8f4..c61e88ac 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -27,7 +27,7 @@ #include "localplayer.h" #include "log.h" -Net::GuildHandler *guildHandler; +extern Net::GuildHandler *guildHandler; namespace EAthena { diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index f24b2d0a..fbd5c9b3 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -46,7 +46,7 @@ #include <SDL_types.h> -Net::InventoryHandler *inventoryHandler; +extern Net::InventoryHandler *inventoryHandler; namespace EAthena { diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index a57eee8a..e91925de 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -35,7 +35,7 @@ #include "utils/gettext.h" #include "utils/stringutils.h" -Net::LoginHandler *loginHandler; +extern Net::LoginHandler *loginHandler; namespace EAthena { diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp index 24d8fb64..5800504c 100644 --- a/src/net/ea/npchandler.cpp +++ b/src/net/ea/npchandler.cpp @@ -36,7 +36,7 @@ #include <SDL_types.h> -Net::NpcHandler *npcHandler; +extern Net::NpcHandler *npcHandler; namespace EAthena { diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 21d63ae5..de17855f 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -38,7 +38,7 @@ #include "utils/stringutils.h" PartyTab *partyTab = 0; -Net::PartyHandler *partyHandler = 0; +extern Net::PartyHandler *partyHandler; namespace EAthena { diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index dd0d099a..5db4acbe 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -140,7 +140,7 @@ static const char *randomDeathMessage() return gettext(deadMsg[random]); } -Net::PlayerHandler *playerHandler; +extern Net::PlayerHandler *playerHandler; namespace EAthena { diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp index 5def63b7..b9335553 100644 --- a/src/net/ea/specialhandler.cpp +++ b/src/net/ea/specialhandler.cpp @@ -67,7 +67,7 @@ /** should always be zero if failed */ #define SKILL_FAILED 0x00 -Net::SpecialHandler *specialHandler; +extern Net::SpecialHandler *specialHandler; namespace EAthena { diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index bfd01f89..2f5186df 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -55,7 +55,7 @@ namespace { } listener; } -Net::TradeHandler *tradeHandler; +extern Net::TradeHandler *tradeHandler; namespace EAthena { diff --git a/src/net/manaserv/adminhandler.cpp b/src/net/manaserv/adminhandler.cpp index e77d2bec..033e4db9 100644 --- a/src/net/manaserv/adminhandler.cpp +++ b/src/net/manaserv/adminhandler.cpp @@ -25,7 +25,7 @@ #include "net/manaserv/messageout.h" #include "net/manaserv/protocol.h" -Net::AdminHandler *adminHandler; +extern Net::AdminHandler *adminHandler; namespace ManaServ { diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index a239e2d1..ee32c5ae 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -43,7 +43,7 @@ #include "utils/gettext.h" -Net::CharHandler *charHandler; +extern Net::CharHandler *charHandler; struct CharInfo { unsigned char slot; diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp index a72fc8fd..4efde53a 100644 --- a/src/net/manaserv/chathandler.cpp +++ b/src/net/manaserv/chathandler.cpp @@ -45,7 +45,7 @@ extern Being *player_node; -Net::ChatHandler *chatHandler; +extern Net::ChatHandler *chatHandler; namespace ManaServ { diff --git a/src/net/manaserv/gamehandler.cpp b/src/net/manaserv/gamehandler.cpp index c2d20233..8b8b9d0f 100644 --- a/src/net/manaserv/gamehandler.cpp +++ b/src/net/manaserv/gamehandler.cpp @@ -28,7 +28,7 @@ #include "main.h" -Net::GameHandler *gameHandler; +extern Net::GameHandler *gameHandler; extern ManaServ::ChatHandler *chatHandler; diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index bd8e42ee..e526a4bb 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -55,7 +55,7 @@ #include <list> -Net::GeneralHandler *generalHandler = NULL; +extern Net::GeneralHandler *generalHandler; extern ManaServ::LoginHandler *loginHandler; diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp index dfc0e8c5..c87671ea 100644 --- a/src/net/manaserv/guildhandler.cpp +++ b/src/net/manaserv/guildhandler.cpp @@ -43,7 +43,7 @@ #include <iostream> -Net::GuildHandler *guildHandler; +extern Net::GuildHandler *guildHandler; namespace ManaServ { diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp index e2a579fd..ba4031ec 100644 --- a/src/net/manaserv/inventoryhandler.cpp +++ b/src/net/manaserv/inventoryhandler.cpp @@ -38,7 +38,7 @@ #include "log.h" // <<< REMOVE ME! -Net::InventoryHandler *inventoryHandler; +extern Net::InventoryHandler *inventoryHandler; namespace ManaServ { diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp index 4a0339b4..ff8d142d 100644 --- a/src/net/manaserv/loginhandler.cpp +++ b/src/net/manaserv/loginhandler.cpp @@ -33,8 +33,7 @@ #include "utils/gettext.h" #include "utils/sha256.h" -Net::LoginHandler *loginHandler; - +extern Net::LoginHandler *loginHandler; namespace ManaServ { diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp index 4c4aa53f..9856daeb 100644 --- a/src/net/manaserv/npchandler.cpp +++ b/src/net/manaserv/npchandler.cpp @@ -32,7 +32,7 @@ #include "gui/npcpostdialog.h" #include "gui/npcdialog.h" -Net::NpcHandler *npcHandler; +extern Net::NpcHandler *npcHandler; namespace ManaServ { diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp index 2426f17e..ae33ead6 100644 --- a/src/net/manaserv/partyhandler.cpp +++ b/src/net/manaserv/partyhandler.cpp @@ -38,7 +38,7 @@ #include <iostream> -Net::PartyHandler *partyHandler; +extern Net::PartyHandler *partyHandler; namespace ManaServ { diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index 276b2c3a..b0f299b6 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -87,7 +87,7 @@ namespace { } deathListener; } -Net::PlayerHandler *playerHandler; +extern Net::PlayerHandler *playerHandler; namespace ManaServ { diff --git a/src/net/manaserv/specialhandler.cpp b/src/net/manaserv/specialhandler.cpp index 17d26d07..c270971d 100644 --- a/src/net/manaserv/specialhandler.cpp +++ b/src/net/manaserv/specialhandler.cpp @@ -26,7 +26,7 @@ #include "net/manaserv/messageout.h" #include "net/manaserv/protocol.h" -Net::SpecialHandler *specialHandler; +extern Net::SpecialHandler *specialHandler; namespace ManaServ { diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp index bcfe20e9..cbcc29dc 100644 --- a/src/net/manaserv/tradehandler.cpp +++ b/src/net/manaserv/tradehandler.cpp @@ -43,7 +43,7 @@ std::string tradePartnerName; int tradePartnerID; -Net::TradeHandler *tradeHandler; +extern Net::TradeHandler *tradeHandler; namespace ManaServ { diff --git a/src/net/net.cpp b/src/net/net.cpp index ddf09730..337e55a1 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -43,19 +43,19 @@ #include "net/ea/generalhandler.h" #endif -extern Net::AdminHandler *adminHandler; -extern Net::CharHandler *charHandler; -extern Net::ChatHandler *chatHandler; -extern Net::GeneralHandler *generalHandler; -extern Net::InventoryHandler *inventoryHandler; -extern Net::LoginHandler *loginHandler; -extern Net::GameHandler *gameHandler; -extern Net::GuildHandler *guildHandler; -extern Net::NpcHandler *npcHandler; -extern Net::PartyHandler *partyHandler; -extern Net::PlayerHandler *playerHandler; -extern Net::SpecialHandler *specialHandler; -extern Net::TradeHandler *tradeHandler; +Net::AdminHandler *adminHandler = NULL; +Net::CharHandler *charHandler = NULL; +Net::ChatHandler *chatHandler = NULL; +Net::GeneralHandler *generalHandler = NULL; +Net::InventoryHandler *inventoryHandler = NULL; +Net::LoginHandler *loginHandler = NULL; +Net::GameHandler *gameHandler = NULL; +Net::GuildHandler *guildHandler = NULL; +Net::NpcHandler *npcHandler = NULL; +Net::PartyHandler *partyHandler = NULL; +Net::PlayerHandler *playerHandler = NULL; +Net::SpecialHandler *specialHandler = NULL; +Net::TradeHandler *tradeHandler = NULL; Net::AdminHandler *Net::getAdminHandler() { |