diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-31 21:52:04 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-31 21:52:04 -0600 |
commit | 78e67de6f70aab502a85578264b60493a818b39f (patch) | |
tree | 33e99673a23bd5d08ba116c3f8756cffc5f6779f /src/net | |
parent | 37432edac65a6b85c7a3414a421f2afd3e67a14e (diff) | |
download | mana-78e67de6f70aab502a85578264b60493a818b39f.tar.gz mana-78e67de6f70aab502a85578264b60493a818b39f.tar.bz2 mana-78e67de6f70aab502a85578264b60493a818b39f.tar.xz mana-78e67de6f70aab502a85578264b60493a818b39f.zip |
Make network handler functions virtual
Diffstat (limited to 'src/net')
29 files changed, 220 insertions, 208 deletions
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index df013eb3..c3a029b1 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -25,29 +25,29 @@ #include <iosfwd> namespace Net { - class AdminHandler - { - public: - void announce(const std::string &text) {} +class AdminHandler +{ + public: + virtual void announce(const std::string &text) {} - void localAnnounce(const std::string &text) {} + virtual void localAnnounce(const std::string &text) {} - void hide(bool hide) {} + virtual void hide(bool hide) {} - void kick(int playerId) {} + virtual void kick(int playerId) {} - void kick(const std::string &name) {} + virtual void kick(const std::string &name) {} - void ban(int playerId) {} + virtual void ban(int playerId) {} - void ban(const std::string &name) {} + virtual void ban(const std::string &name) {} - void unban(int playerId) {} + virtual void unban(int playerId) {} - void unban(const std::string &name) {} + virtual void unban(const std::string &name) {} - // TODO - }; + // TODO +}; } #endif // ADMINHANDLER_H diff --git a/src/net/charhandler.h b/src/net/charhandler.h index f1535ac3..e7871aab 100644 --- a/src/net/charhandler.h +++ b/src/net/charhandler.h @@ -25,16 +25,16 @@ #include <iosfwd> namespace Net { - class CharHandler - { - public: - void ChooseCharacter(int slot); +class CharHandler +{ + public: + virtual void ChooseCharacter(int slot) {} - void NewCharacter(const std::string &name, bool gender, - int hairstyle, int hairColor); + virtual void NewCharacter(const std::string &name, bool gender, + int hairstyle, int hairColor) {} - void DeleteCharacter(int slot); - }; + virtual void DeleteCharacter(int slot) {} +}; } #endif // CHARHANDLER_H diff --git a/src/net/chathandler.h b/src/net/chathandler.h index 237ab929..8e32313a 100644 --- a/src/net/chathandler.h +++ b/src/net/chathandler.h @@ -25,32 +25,32 @@ #include <iosfwd> namespace Net { - class ChatHandler - { - public: - void talk(const std::string &text); +class ChatHandler +{ + public: + virtual void talk(const std::string &text) {} - void me(const std::string &text); + virtual void me(const std::string &text) {} - void privateMessage(const std::string &recipient, - const std::string &text); + virtual void privateMessage(const std::string &recipient, + const std::string &text) {} - void channelList() {} + virtual void channelList() {} - void enterChannel(int channelId, const std::string &password) {} + virtual void enterChannel(int channelId, const std::string &password) {} - void quitChannel(int channelId) {} + virtual void quitChannel(int channelId) {} - void sendToChannel(int channelId, const std::string &text) {} + virtual void sendToChannel(int channelId, const std::string &text) {} - void userList(int channelId) {} + virtual void userList(int channelId) {} - void setChannelTopic(int channelId, const std::string &text) {} + virtual void setChannelTopic(int channelId, const std::string &text) {} - void setUserMode(int channelId, const std::string &name, int mode) {} + virtual void setUserMode(int channelId, const std::string &name, int mode) {} - void kickUser(int channelId, const std::string &name) {} - }; + virtual void kickUser(int channelId, const std::string &name) {} +}; } #endif // CHATHANDLER_H diff --git a/src/net/ea/beinghandler.h b/src/net/ea/beinghandler.h index 1246f1c1..83ac9fb4 100644 --- a/src/net/ea/beinghandler.h +++ b/src/net/ea/beinghandler.h @@ -29,7 +29,7 @@ class BeingHandler : public MessageHandler public: BeingHandler(bool enableSync); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); private: // Should we honor server "Stop Walking" packets diff --git a/src/net/ea/buysellhandler.h b/src/net/ea/buysellhandler.h index 7b85b65d..983fd67a 100644 --- a/src/net/ea/buysellhandler.h +++ b/src/net/ea/buysellhandler.h @@ -29,7 +29,7 @@ class BuySellHandler : public MessageHandler public: BuySellHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_BUYSELLHANDLER_H diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h index 3b5a4cd8..ec21a357 100644 --- a/src/net/ea/charserverhandler.h +++ b/src/net/ea/charserverhandler.h @@ -38,7 +38,7 @@ class CharServerHandler : public MessageHandler public: CharServerHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); void setCharInfo(LockedArray<LocalPlayer*> *charInfo) { mCharInfo = charInfo; } diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h index 62a8c663..93e3e272 100644 --- a/src/net/ea/chathandler.h +++ b/src/net/ea/chathandler.h @@ -29,7 +29,7 @@ class ChatHandler : public MessageHandler public: ChatHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_CHATHANDLER_H diff --git a/src/net/ea/equipmenthandler.h b/src/net/ea/equipmenthandler.h index 2bb73c97..afac0c30 100644 --- a/src/net/ea/equipmenthandler.h +++ b/src/net/ea/equipmenthandler.h @@ -29,7 +29,7 @@ class EquipmentHandler : public MessageHandler public: EquipmentHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_EQUIPMENTHANDLER_H diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 7374fed9..a35021f5 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -29,7 +29,7 @@ class InventoryHandler : public MessageHandler public: InventoryHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_INVENTORYHANDLER_H diff --git a/src/net/ea/itemhandler.h b/src/net/ea/itemhandler.h index 42a9e4e7..412d8783 100644 --- a/src/net/ea/itemhandler.h +++ b/src/net/ea/itemhandler.h @@ -29,7 +29,7 @@ class ItemHandler : public MessageHandler public: ItemHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_ITEMHANDLER_H diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index 074bc9e2..9afaab23 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -33,7 +33,7 @@ class LoginHandler : public MessageHandler public: LoginHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); void setLoginData(LoginData *loginData) { mLoginData = loginData; } diff --git a/src/net/ea/maploginhandler.h b/src/net/ea/maploginhandler.h index 40f8e7bc..33ac9ee7 100644 --- a/src/net/ea/maploginhandler.h +++ b/src/net/ea/maploginhandler.h @@ -29,7 +29,7 @@ class MapLoginHandler : public MessageHandler public: MapLoginHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_MAPLOGINHANDLER_H diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp index 136f07fd..0b9a4cf6 100644 --- a/src/net/ea/npchandler.cpp +++ b/src/net/ea/npchandler.cpp @@ -25,6 +25,8 @@ #include "net/messagein.h" #include "net/messageout.h" +#include "net/net.h" +#include "net/npchandler.h" #include "beingmanager.h" #include "localplayer.h" diff --git a/src/net/ea/npchandler.h b/src/net/ea/npchandler.h index 71e15e02..a8212ce0 100644 --- a/src/net/ea/npchandler.h +++ b/src/net/ea/npchandler.h @@ -30,27 +30,27 @@ class NPCHandler : public MessageHandler, public Net::NpcHandler public: NPCHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); - void talk(int npcId); + virtual void talk(int npcId); - void nextDialog(int npcId); + virtual void nextDialog(int npcId); - void closeDialog(int npcId); + virtual void closeDialog(int npcId); - void listInput(int npcId, int value); + virtual void listInput(int npcId, int value); - void integerInput(int npcId, int value); + virtual void integerInput(int npcId, int value); - void stringInput(int npcId, const std::string &value); + virtual void stringInput(int npcId, const std::string &value); - void buy(int beingId); + virtual void buy(int beingId); - void sell(int beingId); + virtual void sell(int beingId); - void buyItem(int beingId, int itemId, int amount); + virtual void buyItem(int beingId, int itemId, int amount); - void sellItem(int beingId, int itemId, int amount); + virtual void sellItem(int beingId, int itemId, int amount); }; extern NPCHandler *npcHandler; diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h index c6ee261b..34c3022e 100644 --- a/src/net/ea/partyhandler.h +++ b/src/net/ea/partyhandler.h @@ -31,7 +31,7 @@ class PartyHandler : public MessageHandler ~PartyHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_PARTYHANDLER_H diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index 9fb2c982..6b36d86f 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -29,7 +29,7 @@ class PlayerHandler : public MessageHandler public: PlayerHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_PLAYERHANDLER_H diff --git a/src/net/ea/skillhandler.h b/src/net/ea/skillhandler.h index f2c950c9..8aa35c19 100644 --- a/src/net/ea/skillhandler.h +++ b/src/net/ea/skillhandler.h @@ -29,7 +29,7 @@ class SkillHandler : public MessageHandler public: SkillHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_SKILLHANDLER_H diff --git a/src/net/ea/tradehandler.h b/src/net/ea/tradehandler.h index e141f6b5..04a3c3e3 100644 --- a/src/net/ea/tradehandler.h +++ b/src/net/ea/tradehandler.h @@ -29,7 +29,7 @@ class TradeHandler : public MessageHandler public: TradeHandler(); - void handleMessage(MessageIn &msg); + virtual void handleMessage(MessageIn &msg); }; #endif // NET_EA_TRADEHANDLER_H diff --git a/src/net/generalhandler.h b/src/net/generalhandler.h index dd823240..573e5062 100644 --- a/src/net/generalhandler.h +++ b/src/net/generalhandler.h @@ -23,13 +23,15 @@ #define GENERALHANDLER_H namespace Net { - class GeneralHandler - { - public: - virtual void load(); - virtual void unload(); - virtual void guiWindowsLoaded() {} - }; +class GeneralHandler +{ + public: + virtual void load() {} + + virtual void unload() {} + + virtual void guiWindowsLoaded() {} +}; } #endif // GENERALHANDLER_H diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h index 2385819a..d7bd73e6 100644 --- a/src/net/guildhandler.h +++ b/src/net/guildhandler.h @@ -25,33 +25,33 @@ #include <iosfwd> namespace Net { - class GuildHandler - { - public: - void create(const std::string &name) {} +class GuildHandler +{ + public: + virtual void create(const std::string &name) {} - void join(int guildId) {} + virtual void join(int guildId) {} - void invite(int guidId, int playerId) {} + virtual void invite(int guidId, int playerId) {} - void inviteResponse(int guidId, bool response) {} + virtual void inviteResponse(int guidId, bool response) {} - void leave(int guidId) {} + virtual void leave(int guidId) {} - void kick(int guidId, int playerId) {} + virtual void kick(int guidId, int playerId) {} - void chat(int guidId, const std::string &text) {} + virtual void chat(int guidId, const std::string &text) {} - void memberList(int guidId) {} + virtual void memberList(int guidId) {} - void changeMemberPostion(int guildId, int playerId, int level) {} + virtual void changeMemberPostion(int guildId, int playerId, int level) {} - void requestAlliance(int guildId, int otherGuildId) {} + virtual void requestAlliance(int guildId, int otherGuildId) {} - void requestAllianceResponse(int guildId, int otherGuildId, bool response) {} + virtual void requestAllianceResponse(int guildId, int otherGuildId, bool response) {} - void endAlliance(int guildId, int otherGuildId) {} - }; + virtual void endAlliance(int guildId, int otherGuildId) {} +}; } #endif // GUILDHANDLER_H diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h index 22427099..ebd35489 100644 --- a/src/net/inventoryhandler.h +++ b/src/net/inventoryhandler.h @@ -27,34 +27,34 @@ #include <iosfwd> namespace Net { - class InvyHandler - { - public: - void equipItem(Item *item); +class InvyHandler +{ + public: + virtual void equipItem(Item *item) {} - void unequipItem(Item *item); + virtual void unequipItem(Item *item) {} - void useItem(int slot, Item *item); + virtual void useItem(int slot, Item *item) {} - void dropItem(int slot, int amount); + virtual void dropItem(int slot, int amount) {} - void splitItem(int slot, int amount) {} + virtual void splitItem(int slot, int amount) {} - void openStorage() {} + virtual void openStorage() {} - void closeStorage() {} + virtual void closeStorage() {} - //void changeCart() {} + //void changeCart() {} - enum StorageType { - INVENTORY, - STORAGE, - CART - }; + enum StorageType { + INVENTORY, + STORAGE, + CART + }; - void moveItem(StorageType source, int slot, int amount, - StorageType destination) {} - }; + virtual void moveItem(StorageType source, int slot, int amount, + StorageType destination) {} +}; } #endif // INVENTORYHANDLER_H diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index ca72248a..19f8c90b 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.h @@ -25,22 +25,27 @@ #include <iosfwd> namespace Net { - class LoginHandler - { - public: - virtual void loginAccount(const std::string &username, - const std::string &password); - virtual void changeEmail(const std::string &email) {} - virtual void changePassword(const std::string &username, - const std::string &oldPassword, - const std::string &newPassword) {} - virtual void chooseServer(int server) {} - virtual void registerAccount(const std::string &username, - const std::string &password, - const std::string &email = ""); - virtual void unregisterAccount(const std::string &username, - const std::string &password); - }; +class LoginHandler +{ + public: + virtual void loginAccount(const std::string &username, + const std::string &password) {} + + virtual void changeEmail(const std::string &email) {} + + virtual void changePassword(const std::string &username, + const std::string &oldPassword, + const std::string &newPassword) {} + + virtual void chooseServer(int server) {} + + virtual void registerAccount(const std::string &username, + const std::string &password, + const std::string &email = "") {} + + virtual void unregisterAccount(const std::string &username, + const std::string &password) {} +}; } #endif // LOGINHANDLER_H diff --git a/src/net/maphandler.h b/src/net/maphandler.h index e5157fc6..be33e074 100644 --- a/src/net/maphandler.h +++ b/src/net/maphandler.h @@ -25,17 +25,17 @@ #include <iosfwd> namespace Net { - class MapHandler - { - public: - void connect() {} +class MapHandler +{ + public: + virtual void connect() {} - void mapLoaded(const std::string &mapName) {} + virtual void mapLoaded(const std::string &mapName) {} - void who() {} + virtual void who() {} - void quit() {} - }; + virtual void quit() {} +}; } #endif // MAPHANDLER_H diff --git a/src/net/net.h b/src/net/net.h index 0d2beffc..aa2c8a27 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -37,31 +37,31 @@ #include "net/tradehandler.h" namespace Net { - Net::AdminHandler *getAdminHandler(); +Net::AdminHandler *getAdminHandler(); - Net::CharHandler *getCharHandler(); +Net::CharHandler *getCharHandler(); - Net::ChatHandler *getChatHandler(); +Net::ChatHandler *getChatHandler(); - Net::GeneralHandler *getGeneralHandler(); +Net::GeneralHandler *getGeneralHandler(); - Net::GuildHandler *getGuildHandler(); +Net::GuildHandler *getGuildHandler(); - Net::InvyHandler *getInvyHandler(); +Net::InvyHandler *getInvyHandler(); - Net::LoginHandler *getLoginHandler(); +Net::LoginHandler *getLoginHandler(); - Net::MapHandler *getMapHandler(); +Net::MapHandler *getMapHandler(); - Net::NpcHandler *getNpcHandler(); +Net::NpcHandler *getNpcHandler(); - Net::PartyHandler *getPartyHandler(); +Net::PartyHandler *getPartyHandler(); - Net::PlayerHandler *getPlayerHandler(); +Net::PlayerHandler *getPlayerHandler(); - Net::SkillHandler *getSkillHandler(); +Net::SkillHandler *getSkillHandler(); - Net::TradeHandler *getTradeHandler(); +Net::TradeHandler *getTradeHandler(); } #endif // NET_H diff --git a/src/net/npchandler.h b/src/net/npchandler.h index 9ff02f28..18e52b48 100644 --- a/src/net/npchandler.h +++ b/src/net/npchandler.h @@ -25,36 +25,36 @@ #include <iosfwd> namespace Net { - class NpcHandler - { - public: - void talk(int npcId); +class NpcHandler +{ + public: + virtual void talk(int npcId) {} - void nextDialog(int npcId); + virtual void nextDialog(int npcId) {} - void closeDialog(int npcId); + virtual void closeDialog(int npcId) {} - void listInput(int npcId, int value) {} + virtual void listInput(int npcId, int value) {} - void integerInput(int npcId, int value){} + virtual void integerInput(int npcId, int value){} - void stringInput(int npcId, const std::string &value) {} + virtual void stringInput(int npcId, const std::string &value) {} - void sendLetter(int npcId, const std::string &recipient, - const std::string &text) {} + virtual void sendLetter(int npcId, const std::string &recipient, + const std::string &text) {} - void startShoping(int beingId) {} + virtual void startShoping(int beingId) {} - void buy(int beingId) {} + virtual void buy(int beingId) {} - void sell(int beingId) {} + virtual void sell(int beingId) {} - void buyItem(int beingId, int itemId, int ammount) {} + virtual void buyItem(int beingId, int itemId, int ammount) {} - void sellItem(int beingId, int itemId, int ammount) {} + virtual void sellItem(int beingId, int itemId, int ammount) {} - void endShoping(int beingId) {} - }; + virtual void endShoping(int beingId) {} +}; } #endif // NPCHANDLER_H diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h index 6c400bf1..b58bd5f4 100644 --- a/src/net/partyhandler.h +++ b/src/net/partyhandler.h @@ -25,29 +25,29 @@ #include <iosfwd> namespace Net { - class PartyHandler - { - public: - void create(const std::string &name="") {} +class PartyHandler +{ + public: + virtual void create(const std::string &name="") {} - void join(int partyId) {} + virtual void join(int partyId) {} - void invite(int playerId) {} + virtual void invite(int playerId) {} - void inviteResponse(bool accept) {} + virtual void inviteResponse(bool accept) {} - void leave() {} + virtual void leave() {} - void kick(int playerId) {} + virtual void kick(int playerId) {} - void chat(const std::string &text) {} + virtual void chat(const std::string &text) {} - void partyMembers() {} + virtual void partyMembers() {} - // void options() {} + // virtual void options() {} - // void message() {} - }; + // virtual void message() {} +}; } #endif // PARTYHANDLER_H diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index df5e341e..87b51e2f 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.h @@ -28,31 +28,31 @@ #include <iosfwd> namespace Net { - class PlayerHandler - { - public: - void attack(Being *being); +class PlayerHandler +{ + public: + virtual void attack(Being *being) {} - void emote(int emoteId) {} + virtual void emote(int emoteId) {} - void increaseStat(int statId) {} + virtual void increaseStat(int statId) {} - void decreaseStat(int statId) {} + virtual void decreaseStat(int statId) {} - void pickUp(FloorItem *floorItem) {} + virtual void pickUp(FloorItem *floorItem) {} - void setDirection(int direction) {} + virtual void setDirection(int direction) {} - void setDestination(int x, int y, int direction = -1); + virtual void setDestination(int x, int y, int direction = -1); - void sit() {} + virtual void sit() {} - void respawn() {} + virtual void respawn() {} - void ingorePlayer(const std::string &player, bool ignore) {} + virtual void ingorePlayer(const std::string &player, bool ignore) {} - void ingoreAll(bool ignore) {} - }; + virtual void ingoreAll(bool ignore) {} +}; } #endif // PLAYERHANDLER_H diff --git a/src/net/skillhandler.h b/src/net/skillhandler.h index 1ab16f05..d0e6cd23 100644 --- a/src/net/skillhandler.h +++ b/src/net/skillhandler.h @@ -25,14 +25,17 @@ #include <iosfwd> namespace Net { - class SkillHandler - { - public: - void up(int skillId) {} - void use(int skillId, int level, int beingId) {} - void use(int skillId, int level, int x, int y) {} - void use(int skillId, const std::string &map) {} - }; +class SkillHandler +{ + public: + virtual void up(int skillId) {} + + virtual void use(int skillId, int level, int beingId) {} + + virtual void use(int skillId, int level, int x, int y) {} + + virtual void use(int skillId, const std::string &map) {} +}; } #endif // SKILLHANDLER_H diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h index 84de3196..912e336d 100644 --- a/src/net/tradehandler.h +++ b/src/net/tradehandler.h @@ -27,25 +27,25 @@ #include <iosfwd> namespace Net { - class TradeHandler - { - public: - void request(Being *being) {} +class TradeHandler +{ + public: + virtual void request(Being *being) {} - void respond(bool accepet) {} + virtual void respond(bool accepet) {} - void addItem(int slotNum, int amount) {} + virtual void addItem(int slotNum, int amount) {} - void removeItem(int slotNum, int amount) {} + virtual void removeItem(int slotNum, int amount) {} - void setMoney(int amount) {} + virtual void setMoney(int amount) {} - void confirm() {} + virtual void confirm() {} - void finish() {} + virtual void finish() {} - void cancel() {} - }; + virtual void cancel() {} +}; } #endif // TRADEHANDLER_H |