diff options
Diffstat (limited to 'src/net/tmwa')
34 files changed, 234 insertions, 234 deletions
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index 71c37a09..f91a093d 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -34,27 +34,27 @@ class AdminHandler : public MessageHandler, public Net::AdminHandler public: AdminHandler(); - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void announce(const std::string &text); + void announce(const std::string &text) override; - void localAnnounce(const std::string &text); + void localAnnounce(const std::string &text) override; - void hide(bool hide); + void hide(bool hide) override; - void kick(int playerId); + void kick(int playerId) override; - void kick(const std::string &name); + void kick(const std::string &name) override; - void ban(int playerId); + void ban(int playerId) override; - void ban(const std::string &name); + void ban(const std::string &name) override; - void unban(int playerId); + void unban(int playerId) override; - void unban(const std::string &name); + void unban(const std::string &name) override; - void mute(int playerId, int type, int limit); + void mute(int playerId, int type, int limit) override; }; } // namespace TmwAthena diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 12c97feb..3027efc8 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -90,7 +90,7 @@ static Being *createBeing(int id, short job) else if (job > 1000 && job <= 2000) type = ActorSprite::MONSTER; else if (job == 45) - return NULL; // Skip portals + return nullptr; // Skip portals Being *being = actorSpriteManager->createBeing(id, type, job); diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h index 81bbad74..1ec1583c 100644 --- a/src/net/tmwa/beinghandler.h +++ b/src/net/tmwa/beinghandler.h @@ -31,7 +31,7 @@ class BeingHandler : public MessageHandler public: BeingHandler(bool enableSync); - virtual void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; private: // Should we honor server "Stop Walking" packets diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 908e1d6d..00a36f15 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -88,7 +88,7 @@ void BuySellHandler::handleMessage(MessageIn &msg) n_items = (msg.getLength() - 4) / 10; if (n_items > 0) { - SellDialog *dialog = new SellDialog(mNpcId); + auto *dialog = new SellDialog(mNpcId); dialog->setMoney(PlayerInfo::getAttribute(MONEY)); for (int k = 0; k < n_items; k++) diff --git a/src/net/tmwa/buysellhandler.h b/src/net/tmwa/buysellhandler.h index b5229e0f..6e22b4af 100644 --- a/src/net/tmwa/buysellhandler.h +++ b/src/net/tmwa/buysellhandler.h @@ -33,7 +33,7 @@ class BuySellHandler : public MessageHandler public: BuySellHandler(); - virtual void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; private: int mNpcId; diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index a8e87622..45c07bec 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -87,7 +87,7 @@ void CharServerHandler::handleMessage(MessageIn &msg) for (int i = 0; i < count; ++i) { - Net::Character *character = new Net::Character; + auto *character = new Net::Character; readPlayerData(msg, character); mCharacters.push_back(character); logger->log("CharServer: Player: %s (%d)", @@ -117,7 +117,7 @@ void CharServerHandler::handleMessage(MessageIn &msg) case SMSG_CHAR_CREATE_SUCCEEDED: { - Net::Character *character = new Net::Character; + auto *character = new Net::Character; readPlayerData(msg, character); mCharacters.push_back(character); @@ -127,7 +127,7 @@ void CharServerHandler::handleMessage(MessageIn &msg) if (mCharCreateDialog) { mCharCreateDialog->scheduleDelete(); - mCharCreateDialog = 0; + mCharCreateDialog = nullptr; } } break; @@ -142,7 +142,7 @@ void CharServerHandler::handleMessage(MessageIn &msg) case SMSG_CHAR_DELETE_SUCCEEDED: delete mSelectedCharacter; mCharacters.remove(mSelectedCharacter); - mSelectedCharacter = 0; + mSelectedCharacter = nullptr; updateCharSelectDialog(); unlockCharSelectDialog(); new OkDialog(_("Info"), _("Character deleted.")); @@ -156,7 +156,7 @@ void CharServerHandler::handleMessage(MessageIn &msg) case SMSG_CHAR_MAP_INFO: { msg.skip(4); // CharID, must be the same as local_player->charID - GameHandler *gh = static_cast<GameHandler*>(Net::getGameHandler()); + auto *gh = static_cast<GameHandler*>(Net::getGameHandler()); gh->setMap(msg.readString(16)); const auto ip = msg.readInt32(); @@ -172,7 +172,7 @@ void CharServerHandler::handleMessage(MessageIn &msg) PlayerInfo::setBackend(mSelectedCharacter->data); // Prevent the selected local player from being deleted - mSelectedCharacter->dummy = 0; + mSelectedCharacter->dummy = nullptr; delete_all(mCharacters); mCharacters.clear(); @@ -185,7 +185,7 @@ void CharServerHandler::handleMessage(MessageIn &msg) case SMSG_CHANGE_MAP_SERVER: { - GameHandler *gh = static_cast<GameHandler*>(Net::getGameHandler()); + auto *gh = static_cast<GameHandler*>(Net::getGameHandler()); gh->setMap(msg.readString(16)); int x = msg.readInt16(); int y = msg.readInt16(); @@ -199,7 +199,7 @@ void CharServerHandler::handleMessage(MessageIn &msg) const int tileHeight = map->getTileHeight(); local_player->setPosition(Vector(x * tileWidth + tileWidth / 2, y * tileHeight + tileHeight / 2)); - local_player->setMap(0); + local_player->setMap(nullptr); } break; } @@ -210,7 +210,7 @@ void CharServerHandler::readPlayerData(MessageIn &msg, Net::Character *character const Token &token = static_cast<LoginHandler*>(Net::getLoginHandler())->getToken(); - LocalPlayer *tempPlayer = new LocalPlayer(msg.readInt32(), 0); + auto *tempPlayer = new LocalPlayer(msg.readInt32(), 0); tempPlayer->setGender(token.sex); character->data.mAttributes[EXP] = msg.readInt32(); @@ -309,7 +309,7 @@ void CharServerHandler::requestCharacters() void CharServerHandler::chooseCharacter(Net::Character *character) { mSelectedCharacter = character; - mCharSelectDialog = 0; + mCharSelectDialog = nullptr; MessageOut outMsg(CMSG_CHAR_SELECT); outMsg.writeInt8(mSelectedCharacter->slot); diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h index 7e4fc2d9..cf673a4d 100644 --- a/src/net/tmwa/charserverhandler.h +++ b/src/net/tmwa/charserverhandler.h @@ -40,37 +40,37 @@ class CharServerHandler : public MessageHandler, public Net::CharHandler public: CharServerHandler(); - virtual void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void setCharSelectDialog(CharSelectDialog *window); + void setCharSelectDialog(CharSelectDialog *window) override; /** * Sets the character create dialog. The handler will clean up this * dialog when a new character is succesfully created, and will unlock * the dialog when a new character failed to be created. */ - void setCharCreateDialog(CharCreateDialog *window); + void setCharCreateDialog(CharCreateDialog *window) override; - void requestCharacters(); + void requestCharacters() override; - void chooseCharacter(Net::Character *character); + void chooseCharacter(Net::Character *character) override; void newCharacter(const std::string &name, int slot, bool gender, int hairstyle, int hairColor, - const std::vector<int> &stats); + const std::vector<int> &stats) override; - void deleteCharacter(Net::Character *character); + void deleteCharacter(Net::Character *character) override; - void switchCharacter(); + void switchCharacter() override; - unsigned int baseSprite() const; + unsigned int baseSprite() const override; - unsigned int hairSprite() const; + unsigned int hairSprite() const override; - unsigned int maxSprite() const; + unsigned int maxSprite() const override; - int getCharCreateMaxHairColorId() const; - int getCharCreateMaxHairStyleId() const; + int getCharCreateMaxHairColorId() const override; + int getCharCreateMaxHairStyleId() const override; void connect(); diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index fa3a8ec3..682a3743 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/chathandler.h @@ -36,36 +36,36 @@ class ChatHandler : public MessageHandler, public Net::ChatHandler public: ChatHandler(); - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void talk(const std::string &text); + void talk(const std::string &text) override; - void me(const std::string &text); + void me(const std::string &text) override; void privateMessage(const std::string &recipient, - const std::string &text); + const std::string &text) override; - void channelList(); + void channelList() override; void enterChannel(const std::string &channel, - const std::string &password); + const std::string &password) override; - void quitChannel(int channelId); + void quitChannel(int channelId) override; - void sendToChannel(int channelId, const std::string &text); + void sendToChannel(int channelId, const std::string &text) override; - void userList(const std::string &channel); + void userList(const std::string &channel) override; - void setChannelTopic(int channelId, const std::string &text); + void setChannelTopic(int channelId, const std::string &text) override; - void setUserMode(int channelId, const std::string &name, int mode); + void setUserMode(int channelId, const std::string &name, int mode) override; - void kickUser(int channelId, const std::string &name); + void kickUser(int channelId, const std::string &name) override; - void who(); + void who() override; private: - typedef std::queue<std::string> WhisperQueue; + using WhisperQueue = std::queue<std::string>; WhisperQueue mSentWhispers; }; diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 68ed62b0..44ce6bc0 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -93,7 +93,7 @@ void GameHandler::handleMessage(MessageIn &msg) if (msg.readInt8()) { new OkDialog(_("Game"), _("Request to quit denied!"), false, - NULL); + nullptr); } break; } diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h index a6bcde0a..8859c9c6 100644 --- a/src/net/tmwa/gamehandler.h +++ b/src/net/tmwa/gamehandler.h @@ -39,32 +39,32 @@ class GameHandler : public MessageHandler, public Net::GameHandler, public: GameHandler(); - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void event(Event::Channel channel, const Event &event); + void event(Event::Channel channel, const Event &event) override; - void connect(); + void connect() override; - bool isConnected(); + bool isConnected() override; - void disconnect(); + void disconnect() override; - void who(); + void who() override; - void quit(); + void quit() override; - bool removeDeadBeings() const { return true; } + bool removeDeadBeings() const override { return true; } void clear(); void setMap(const std::string map); /** The tmwAthena protocol is making use of the MP status bar. */ - bool canUseMagicBar() const { return true; } + bool canUseMagicBar() const override { return true; } - int getPickupRange() const; + int getPickupRange() const override; - int getNpcTalkRange() const { return DEFAULT_TILE_LENGTH * 30; } + int getNpcTalkRange() const override { return DEFAULT_TILE_LENGTH * 30; } private: std::string mMap; ///< Keeps the map filename. diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 5e445eaf..4053e17c 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -184,8 +184,8 @@ void GeneralHandler::reload() mNetwork->disconnect(); static_cast<LoginHandler*>(mLoginHandler.get())->clearWorlds(); - static_cast<CharServerHandler*>(mCharHandler.get())->setCharCreateDialog(0); - static_cast<CharServerHandler*>(mCharHandler.get())->setCharSelectDialog(0); + static_cast<CharServerHandler*>(mCharHandler.get())->setCharCreateDialog(nullptr); + static_cast<CharServerHandler*>(mCharHandler.get())->setCharSelectDialog(nullptr); } void GeneralHandler::unload() @@ -255,10 +255,10 @@ void GeneralHandler::event(Event::Channel channel, socialWindow->removeTab(taParty); delete guildTab; - guildTab = 0; + guildTab = nullptr; delete partyTab; - partyTab = 0; + partyTab = nullptr; } } } diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index a34852fd..22c6b650 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -37,21 +37,21 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler, public: GeneralHandler(); - ~GeneralHandler(); + ~GeneralHandler() override; - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void load(); + void load() override; - void reload(); + void reload() override; - void unload(); + void unload() override; - void flushNetwork(); + void flushNetwork() override; - void clearHandlers(); + void clearHandlers() override; - void event(Event::Channel channel, const Event &event); + void event(Event::Channel channel, const Event &event) override; protected: MessageHandlerPtr mAdminHandler; diff --git a/src/net/tmwa/gui/guildtab.h b/src/net/tmwa/gui/guildtab.h index 0e208e93..e7d7b7cc 100644 --- a/src/net/tmwa/gui/guildtab.h +++ b/src/net/tmwa/gui/guildtab.h @@ -33,18 +33,18 @@ class GuildTab : public ChatTab { public: GuildTab(); - ~GuildTab(); + ~GuildTab() override; - void showHelp(); + void showHelp() override; - bool handleCommand(const std::string &type, const std::string &args); + bool handleCommand(const std::string &type, const std::string &args) override; - void saveToLogFile(std::string &msg); + void saveToLogFile(std::string &msg) override; protected: - void handleInput(const std::string &msg); + void handleInput(const std::string &msg) override; - void getAutoCompleteList(std::vector<std::string> &names) const; + void getAutoCompleteList(std::vector<std::string> &names) const override; }; extern GuildTab *guildTab; diff --git a/src/net/tmwa/gui/partytab.h b/src/net/tmwa/gui/partytab.h index 1049b770..61ccf37a 100644 --- a/src/net/tmwa/gui/partytab.h +++ b/src/net/tmwa/gui/partytab.h @@ -33,18 +33,18 @@ class PartyTab : public ChatTab { public: PartyTab(); - ~PartyTab(); + ~PartyTab() override; - void showHelp(); + void showHelp() override; - bool handleCommand(const std::string &type, const std::string &args); + bool handleCommand(const std::string &type, const std::string &args) override; - void saveToLogFile(std::string &msg); + void saveToLogFile(std::string &msg) override; protected: - void handleInput(const std::string &msg); + void handleInput(const std::string &msg) override; - virtual void getAutoCompleteList(std::vector<std::string>&) const; + void getAutoCompleteList(std::vector<std::string>&) const override; }; extern PartyTab *partyTab; diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index a3194991..180d1dfb 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -39,7 +39,7 @@ extern Net::GuildHandler *guildHandler; namespace TmwAthena { -GuildTab *guildTab = 0; +GuildTab *guildTab = nullptr; Guild *taGuild; GuildHandler::GuildHandler() @@ -83,7 +83,7 @@ GuildHandler::GuildHandler() GuildHandler::~GuildHandler() { delete guildTab; - guildTab = 0; + guildTab = nullptr; } void GuildHandler::handleMessage(MessageIn &msg) diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index 4a74a26b..5f8c987c 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -32,34 +32,34 @@ class GuildHandler : public Net::GuildHandler, public MessageHandler public: GuildHandler(); - ~GuildHandler(); + ~GuildHandler() override; - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void create(const std::string &name); + void create(const std::string &name) override; - void invite(int guildId, const std::string &name); + void invite(int guildId, const std::string &name) override; - void invite(int guildId, Being *being); + void invite(int guildId, Being *being) override; - void inviteResponse(int guildId, bool response); + void inviteResponse(int guildId, bool response) override; - void leave(int guildId); + void leave(int guildId) override; - void kick(GuildMember *member, std::string reason = ""); + void kick(GuildMember *member, std::string reason = "") override; - void chat(int guildId, const std::string &text); + void chat(int guildId, const std::string &text) override; - void memberList(int guildId); + void memberList(int guildId) override; - void changeMemberPostion(GuildMember *member, int level); + void changeMemberPostion(GuildMember *member, int level) override; - void requestAlliance(int guildId, int otherGuildId); + void requestAlliance(int guildId, int otherGuildId) override; void requestAllianceResponse(int guildId, int otherGuildId, - bool response); + bool response) override; - void endAlliance(int guildId, int otherGuildId); + void endAlliance(int guildId, int otherGuildId) override; private: // TmwAthena (and eAthena) only supports one guild per player diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 256e7159..6f32fb3d 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -107,8 +107,8 @@ InventoryHandler::InventoryHandler() handledMessages = _messages; inventoryHandler = this; - mStorage = 0; - mStorageWindow = 0; + mStorage = nullptr; + mStorageWindow = nullptr; listen(Event::ItemChannel); } @@ -118,7 +118,7 @@ InventoryHandler::~InventoryHandler() if (mStorageWindow) { mStorageWindow->close(); - mStorageWindow = 0; + mStorageWindow = nullptr; } delete mStorage; @@ -312,8 +312,8 @@ void InventoryHandler::handleMessage(MessageIn &msg) if (!mStorage) mStorage = new Inventory(Inventory::STORAGE, size); - InventoryItems::iterator it = mInventoryItems.begin(); - InventoryItems::iterator it_end = mInventoryItems.end(); + auto it = mInventoryItems.begin(); + auto it_end = mInventoryItems.end(); for (; it != it_end; it++) mStorage->setItem((*it).slot, (*it).id, (*it).quantity); mInventoryItems.clear(); @@ -359,11 +359,11 @@ void InventoryHandler::handleMessage(MessageIn &msg) // Storage access has been closed // Storage window deletes itself - mStorageWindow = 0; + mStorageWindow = nullptr; mStorage->clear(); delete mStorage; - mStorage = 0; + mStorage = nullptr; break; case SMSG_PLAYER_EQUIPMENT: diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index 3eefdd9b..6224b572 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -51,13 +51,13 @@ class EquipBackend : public Equipment::Backend memset(mEquipment, -1, sizeof(mEquipment)); } - Item *getEquipment(int index) const + Item *getEquipment(int index) const override { int invyIndex = mEquipment[index]; return PlayerInfo::getInventory()->getItem(invyIndex); } - std::string getSlotName(int slotIndex) const + std::string getSlotName(int slotIndex) const override { switch (slotIndex) { @@ -88,7 +88,7 @@ class EquipBackend : public Equipment::Backend } } - void clear() + void clear() override { for (int i = 0; i < EQUIP_VECTOR_END; i++) { @@ -126,14 +126,14 @@ class EquipBackend : public Equipment::Backend inventoryWindow->updateButtons(); } - void triggerUnequip(int slotIndex) const + void triggerUnequip(int slotIndex) const override { Item *item = getEquipment(slotIndex); if (item) item->doEvent(Event::DoUnequip); } - int getSlotNumber() const + int getSlotNumber() const override { return EQUIP_VECTOR_END; } // Note the slot type id is equal to the slot Index for tA. @@ -172,7 +172,7 @@ class InventoryItem } }; -typedef std::list<InventoryItem> InventoryItems; +using InventoryItems = std::list<InventoryItem>; class InventoryHandler : public MessageHandler, public Net::InventoryHandler, public EventListener @@ -185,20 +185,20 @@ class InventoryHandler : public MessageHandler, public Net::InventoryHandler, InventoryHandler(); - ~InventoryHandler(); + ~InventoryHandler() override; - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void event(Event::Channel channel, const Event &event); + void event(Event::Channel channel, const Event &event) override; - bool canSplit(const Item *item); + bool canSplit(const Item *item) override; - size_t getSize(int type) const; + size_t getSize(int type) const override; - bool isWeaponSlot(unsigned int slotTypeId) const + bool isWeaponSlot(unsigned int slotTypeId) const override { return mEquips.isWeaponSlot(slotTypeId); } - bool isAmmoSlot(unsigned int slotTypeId) const + bool isAmmoSlot(unsigned int slotTypeId) const override { return mEquips.isAmmoSlot(slotTypeId); } private: diff --git a/src/net/tmwa/itemhandler.h b/src/net/tmwa/itemhandler.h index 3f58a172..29ed8246 100644 --- a/src/net/tmwa/itemhandler.h +++ b/src/net/tmwa/itemhandler.h @@ -31,7 +31,7 @@ class ItemHandler : public MessageHandler public: ItemHandler(); - virtual void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; }; } // namespace TmwAthena diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 2fbc02d4..3e742f88 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -127,7 +127,7 @@ void LoginHandler::handleMessage(MessageIn &msg) for (int i = 0; i < worldCount; i++) { - WorldInfo *world = new WorldInfo; + auto *world = new WorldInfo; world->address = msg.readInt32(); world->port = msg.readInt16(); diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index fcc7c5cc..92a268f1 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -38,43 +38,43 @@ class LoginHandler : public MessageHandler, public Net::LoginHandler public: LoginHandler(); - ~LoginHandler(); + ~LoginHandler() override; - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void connect(); + void connect() override; - bool isConnected(); + bool isConnected() override; - void disconnect(); + void disconnect() override; - int supportedOptionalActions() const + int supportedOptionalActions() const override { return SetGenderOnRegister; } - bool isRegistrationEnabled(); + bool isRegistrationEnabled() override; - void getRegistrationDetails(); + void getRegistrationDetails() override; - unsigned int getMaxPasswordLength() const { return 25; } + unsigned int getMaxPasswordLength() const override { return 25; } - void loginAccount(LoginData *loginData); + void loginAccount(LoginData *loginData) override; - void logout(); + void logout() override; - void changeEmail(const std::string &email); + void changeEmail(const std::string &email) override; void changePassword(const std::string &username, const std::string &oldPassword, - const std::string &newPassword); + const std::string &newPassword) override; - void chooseServer(unsigned int server); + void chooseServer(unsigned int server) override; - void registerAccount(LoginData *loginData); + void registerAccount(LoginData *loginData) override; void unregisterAccount(const std::string &username, - const std::string &password); + const std::string &password) override; - Worlds getWorlds() const; + Worlds getWorlds() const override; void clearWorlds(); const Token &getToken() const { return mToken; } diff --git a/src/net/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp index b22b623e..e9ce33b1 100644 --- a/src/net/tmwa/messagehandler.cpp +++ b/src/net/tmwa/messagehandler.cpp @@ -28,7 +28,7 @@ namespace TmwAthena { MessageHandler::MessageHandler() - : mNetwork(NULL) + : mNetwork(nullptr) { } diff --git a/src/net/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h index b598f896..0d278c15 100644 --- a/src/net/tmwa/messagehandler.h +++ b/src/net/tmwa/messagehandler.h @@ -39,7 +39,7 @@ class MessageHandler : public Net::MessageHandler public: MessageHandler(); - ~MessageHandler(); + ~MessageHandler() override; virtual void handleMessage(MessageIn &msg) = 0; @@ -49,7 +49,7 @@ class MessageHandler : public Net::MessageHandler Network *mNetwork; }; -typedef const std::unique_ptr<MessageHandler> MessageHandlerPtr; +using MessageHandlerPtr = const std::unique_ptr<MessageHandler>; } diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 5ff4f7e5..c1ba615f 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -91,7 +91,7 @@ namespace TmwAthena { int networkThread(void *data) { - Network *network = static_cast<Network*>(data); + auto *network = static_cast<Network*>(data); if (!network->realConnect()) return -1; @@ -101,16 +101,16 @@ int networkThread(void *data) return 0; } -Network *Network::mInstance = 0; +Network *Network::mInstance = nullptr; Network::Network(): - mSocket(0), + mSocket(nullptr), mInBuffer(new char[BUFFER_SIZE]), mOutBuffer(new char[BUFFER_SIZE]), mInSize(0), mOutSize(0), mToSkip(0), mState(IDLE), - mWorkerThread(0) + mWorkerThread(nullptr) { SDLNet_Init(); @@ -124,7 +124,7 @@ Network::~Network() if (mState != IDLE && mState != NET_ERROR) disconnect(); - mInstance = 0; + mInstance = nullptr; delete[] mInBuffer; delete[] mOutBuffer; @@ -175,14 +175,14 @@ void Network::disconnect() if (mWorkerThread) { - SDL_WaitThread(mWorkerThread, NULL); - mWorkerThread = NULL; + SDL_WaitThread(mWorkerThread, nullptr); + mWorkerThread = nullptr; } if (mSocket) { SDLNet_TCP_Close(mSocket); - mSocket = 0; + mSocket = nullptr; } } @@ -203,7 +203,7 @@ void Network::unregisterHandler(MessageHandler *handler) mMessageHandlers.erase(*i); } - handler->setNetwork(0); + handler->setNetwork(nullptr); } void Network::clearHandlers() @@ -211,7 +211,7 @@ void Network::clearHandlers() MessageHandlerIterator i; for (i = mMessageHandlers.begin(); i != mMessageHandlers.end(); ++i) { - i->second->setNetwork(0); + i->second->setNetwork(nullptr); } mMessageHandlers.clear(); } @@ -222,7 +222,7 @@ void Network::dispatchMessages() { MessageIn msg = getNextMessage(); - MessageHandlerIterator iter = mMessageHandlers.find(msg.getId()); + auto iter = mMessageHandlers.find(msg.getId()); if (msg.getLength() == 0) logger->error("Zero length packet received. Exiting."); diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index 079e71ca..97c7970f 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -120,8 +120,8 @@ class Network SDL_Thread *mWorkerThread; Mutex mMutex; - typedef std::map<Uint16, MessageHandler*> MessageHandlers; - typedef MessageHandlers::iterator MessageHandlerIterator; + using MessageHandlers = std::map<Uint16, MessageHandler *>; + using MessageHandlerIterator = MessageHandlers::iterator; MessageHandlers mMessageHandlers; static Network *mInstance; diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 2b0a5b0a..9bd15572 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -76,7 +76,7 @@ void NpcHandler::handleMessage(MessageIn &msg) } int npcId = msg.readInt32(); - Event *event = 0; + Event *event = nullptr; switch (msg.getId()) { diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index 71486a40..0a0cd130 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/npchandler.h @@ -37,34 +37,34 @@ class NpcHandler : public MessageHandler, public Net::NpcHandler public: NpcHandler(); - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void startShopping(int beingId); + void startShopping(int beingId) override; - void buy(int beingId); + void buy(int beingId) override; - void sell(int beingId); + void sell(int beingId) override; - void buyItem(int beingId, int itemId, int amount); + void buyItem(int beingId, int itemId, int amount) override; - void sellItem(int beingId, int itemId, int amount); + void sellItem(int beingId, int itemId, int amount) override; - void endShopping(int beingId); + void endShopping(int beingId) override; - void talk(int npcId); + void talk(int npcId) override; - void nextDialog(int npcId); + void nextDialog(int npcId) override; - void closeDialog(int npcId); + void closeDialog(int npcId) override; - void menuSelect(int npcId, int choice); + void menuSelect(int npcId, int choice) override; - void integerInput(int npcId, int value); + void integerInput(int npcId, int value) override; - void stringInput(int npcId, const std::string &value); + void stringInput(int npcId, const std::string &value) override; void sendLetter(int npcId, const std::string &recipient, - const std::string &text); + const std::string &text) override; }; diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 4753dac1..b8d9c3c7 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -43,7 +43,7 @@ extern Net::PartyHandler *partyHandler; namespace TmwAthena { -PartyTab *partyTab = 0; +PartyTab *partyTab = nullptr; Party *taParty; PartyHandler::PartyHandler(): @@ -70,7 +70,7 @@ PartyHandler::PartyHandler(): PartyHandler::~PartyHandler() { delete partyTab; - partyTab = 0; + partyTab = nullptr; } void PartyHandler::handleMessage(MessageIn &msg) @@ -237,7 +237,7 @@ void PartyHandler::handleMessage(MessageIn &msg) if (partyTab) { delete partyTab; - partyTab = 0; + partyTab = nullptr; } socialWindow->removeTab(taParty); } @@ -248,7 +248,7 @@ void PartyHandler::handleMessage(MessageIn &msg) if (Being *b = actorSpriteManager->findBeing(id)) { - b->setParty(NULL); + b->setParty(nullptr); } taParty->removeMember(id); diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h index 9a3570a8..5268f395 100644 --- a/src/net/tmwa/partyhandler.h +++ b/src/net/tmwa/partyhandler.h @@ -36,37 +36,37 @@ class PartyHandler : public MessageHandler, public Net::PartyHandler public: PartyHandler(); - ~PartyHandler(); + ~PartyHandler() override; - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void create(const std::string &name = ""); + void create(const std::string &name = "") override; - void join(int partyId); + void join(int partyId) override; - void invite(Being *being); + void invite(Being *being) override; - void invite(const std::string &name); + void invite(const std::string &name) override; - void inviteResponse(const std::string &inviter, bool accept); + void inviteResponse(const std::string &inviter, bool accept) override; - void leave(); + void leave() override; - void kick(Being *being); + void kick(Being *being) override; - void kick(const std::string &name); + void kick(const std::string &name) override; - void chat(const std::string &text); + void chat(const std::string &text) override; - void requestPartyMembers(); + void requestPartyMembers() override; - PartyShare getShareExperience() { return mShareExp; } + PartyShare getShareExperience() override { return mShareExp; } - void setShareExperience(PartyShare share); + void setShareExperience(PartyShare share) override; - PartyShare getShareItems() { return mShareItems; } + PartyShare getShareItems() override { return mShareItems; } - void setShareItems(PartyShare share); + void setShareItems(PartyShare share) override; private: PartyShare mShareExp, mShareItems; diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index c598c5f9..6ef669e4 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -60,9 +60,9 @@ namespace { */ struct WeightListener : public gcn::ActionListener { - void action(const gcn::ActionEvent &event) + void action(const gcn::ActionEvent &event) override { - weightNotice = NULL; + weightNotice = nullptr; } } weightListener; @@ -71,10 +71,10 @@ namespace { */ struct DeathListener : public gcn::ActionListener { - void action(const gcn::ActionEvent &event) + void action(const gcn::ActionEvent &event) override { Net::getPlayerHandler()->respawn(); - deathNotice = NULL; + deathNotice = nullptr; BuyDialog::closeAll(); BuySellDialog::closeAll(); diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h index 2c4b6194..24284ee4 100644 --- a/src/net/tmwa/playerhandler.h +++ b/src/net/tmwa/playerhandler.h @@ -34,35 +34,35 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler public: PlayerHandler(); - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void attack(int id); - void emote(int emoteId); + void attack(int id) override; + void emote(int emoteId) override; - void increaseAttribute(int attr); - void decreaseAttribute(int attr); - void increaseSkill(int skillId); + void increaseAttribute(int attr) override; + void decreaseAttribute(int attr) override; + void increaseSkill(int skillId) override; - void pickUp(FloorItem *floorItem); - void setDirection(char direction); - void setDestination(int x, int y, int direction = -1); - void changeAction(Being::Action action); + void pickUp(FloorItem *floorItem) override; + void setDirection(char direction) override; + void setDestination(int x, int y, int direction = -1) override; + void changeAction(Being::Action action) override; - void respawn(); + void respawn() override; - void ignorePlayer(const std::string &player, bool ignore); - void ignoreAll(bool ignore); + void ignorePlayer(const std::string &player, bool ignore) override; + void ignoreAll(bool ignore) override; - bool canUseMagic(); - bool canCorrectAttributes(); + bool canUseMagic() override; + bool canCorrectAttributes() override; - int getJobLocation(); + int getJobLocation() override; - Vector getDefaultMoveSpeed() const; + Vector getDefaultMoveSpeed() const override; - Vector getPixelsPerTickMoveSpeed(const Vector &speed, Map *map = 0); + Vector getPixelsPerTickMoveSpeed(const Vector &speed, Map *map = nullptr) override; - bool usePixelPrecision() + bool usePixelPrecision() override { return false; } }; diff --git a/src/net/tmwa/specialhandler.h b/src/net/tmwa/specialhandler.h index bb772ff1..f43c900e 100644 --- a/src/net/tmwa/specialhandler.h +++ b/src/net/tmwa/specialhandler.h @@ -34,15 +34,15 @@ class SpecialHandler : public MessageHandler, public Net::SpecialHandler public: SpecialHandler(); - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void use(int id); + void use(int id) override; - void use(int id, int level, int beingId); + void use(int id, int level, int beingId) override; - void use(int id, int level, int x, int y); + void use(int id, int level, int x, int y) override; - void use(int id, const std::string &map); + void use(int id, const std::string &map) override; }; } // namespace TmwAthena diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index a02056a4..2441d83a 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -51,9 +51,9 @@ ConfirmDialog *confirmDlg; namespace { struct RequestTradeListener : public gcn::ActionListener { - void action(const gcn::ActionEvent &event) + void action(const gcn::ActionEvent &event) override { - confirmDlg = 0; + confirmDlg = nullptr; Net::getTradeHandler()->respond(event.getId() == "yes"); } } listener; @@ -77,7 +77,7 @@ TradeHandler::TradeHandler() }; handledMessages = _messages; tradeHandler = this; - confirmDlg = 0; + confirmDlg = nullptr; } diff --git a/src/net/tmwa/tradehandler.h b/src/net/tmwa/tradehandler.h index 60ee4444..d4f2494f 100644 --- a/src/net/tmwa/tradehandler.h +++ b/src/net/tmwa/tradehandler.h @@ -34,23 +34,23 @@ class TradeHandler : public MessageHandler, public Net::TradeHandler public: TradeHandler(); - void handleMessage(MessageIn &msg); + void handleMessage(MessageIn &msg) override; - void request(Being *being); + void request(Being *being) override; - void respond(bool accept); + void respond(bool accept) override; - void addItem(Item *item, int amount); + void addItem(Item *item, int amount) override; - void removeItem(int slotNum, int amount); + void removeItem(int slotNum, int amount) override; - void setMoney(int amount); + void setMoney(int amount) override; - void confirm(); + void confirm() override; - void finish(); + void finish() override; - void cancel(); + void cancel() override; private: bool mTrading; |