From 351821c1f18f9285be58df0a05339936311f6490 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 12 Apr 2013 18:39:00 +0300 Subject: first part of style fixed after cpplint checks. --- src/actionmanager.cpp | 2 +- src/actionmanager.h | 2 +- src/being.cpp | 14 +-- src/chatlogger.cpp | 2 +- src/client.cpp | 37 +++---- src/commands.cpp | 7 +- src/configuration.cpp | 5 +- src/graphicsvertexes.cpp | 9 -- src/gui/botcheckerwindow.cpp | 6 +- src/gui/buydialog.cpp | 3 +- src/gui/buyselldialog.cpp | 3 +- src/gui/changeemaildialog.cpp | 1 - src/gui/changepassworddialog.cpp | 2 +- src/gui/charcreatedialog.cpp | 2 +- src/gui/confirmdialog.cpp | 2 +- src/gui/editserverdialog.cpp | 6 +- src/gui/equipmentwindow.cpp | 30 +++--- src/gui/gui.cpp | 4 +- src/gui/helpwindow.cpp | 1 - src/gui/inventorywindow.cpp | 6 -- src/gui/minimap.cpp | 2 +- src/gui/npcdialog.cpp | 1 - src/gui/popupmenu.cpp | 3 +- src/gui/quitdialog.cpp | 4 +- src/gui/sdlinput.cpp | 5 +- src/gui/selldialog.cpp | 5 +- src/gui/serverdialog.cpp | 11 +- src/gui/setup_relations.cpp | 8 +- src/gui/shopwindow.cpp | 2 - src/gui/textcommandeditor.cpp | 1 - src/gui/theme.cpp | 6 +- src/gui/tradewindow.cpp | 8 +- src/gui/updaterwindow.cpp | 14 +-- src/gui/viewport.cpp | 2 +- src/gui/whoisonline.cpp | 8 +- src/gui/widgets/browserbox.cpp | 25 ++--- src/gui/widgets/button.cpp | 10 +- src/gui/widgets/chattab.cpp | 5 +- src/gui/widgets/dropdown.cpp | 4 +- src/gui/widgets/emoteshortcutcontainer.cpp | 1 - src/gui/widgets/guitable.cpp | 34 +++--- src/gui/widgets/inttextfield.cpp | 2 - src/gui/widgets/itemcontainer.cpp | 2 +- src/gui/widgets/itemlinkhandler.cpp | 2 +- src/gui/widgets/progressbar.cpp | 15 +-- src/gui/widgets/scrollarea.cpp | 2 +- src/gui/widgets/setupitem.cpp | 1 - src/gui/widgets/shopitems.cpp | 2 +- src/gui/widgets/tab.cpp | 10 +- src/gui/widgets/tablemodel.cpp | 4 +- src/gui/widgets/textbox.cpp | 5 +- src/gui/widgets/textfield.cpp | 20 ++-- src/gui/widgets/window.cpp | 3 +- src/inputmanager.cpp | 1 - src/inventory.cpp | 8 +- src/localplayer.cpp | 43 ++++---- src/main.cpp | 4 +- src/map.cpp | 10 +- src/mobileopenglgraphics.cpp | 2 - src/mumblemanager.cpp | 3 +- src/net/adminhandler.h | 4 +- src/net/beinghandler.h | 4 +- src/net/buysellhandler.h | 4 +- src/net/charserverhandler.cpp | 2 +- src/net/charserverhandler.h | 4 +- src/net/chathandler.h | 3 +- src/net/download.cpp | 23 ++-- src/net/download.h | 4 +- src/net/ea/adminhandler.cpp | 2 +- src/net/ea/beinghandler.cpp | 58 ++++------- src/net/ea/buysellhandler.cpp | 2 +- src/net/ea/charserverhandler.cpp | 2 +- src/net/ea/chathandler.cpp | 6 +- src/net/ea/gamehandler.cpp | 2 +- src/net/ea/gui/guildtab.cpp | 2 +- src/net/ea/gui/partytab.cpp | 2 +- src/net/ea/guildhandler.cpp | 162 ++++++++++++++--------------- src/net/ea/inventoryhandler.cpp | 27 +++-- src/net/ea/itemhandler.cpp | 2 +- src/net/ea/loginhandler.cpp | 6 +- src/net/ea/network.cpp | 4 +- src/net/ea/npchandler.cpp | 2 +- src/net/ea/partyhandler.cpp | 24 ++--- src/net/ea/playerhandler.cpp | 9 +- src/net/ea/skillhandler.cpp | 10 +- src/net/ea/tradehandler.cpp | 16 +-- src/net/eathena/adminhandler.cpp | 4 +- src/net/eathena/beinghandler.cpp | 58 ++++------- src/net/eathena/buysellhandler.cpp | 5 +- src/net/eathena/charserverhandler.cpp | 20 ++-- src/net/eathena/chathandler.cpp | 4 +- src/net/eathena/gamehandler.cpp | 4 +- src/net/eathena/generalhandler.cpp | 2 +- src/net/eathena/gui/guildtab.cpp | 2 +- src/net/eathena/gui/partytab.cpp | 2 +- src/net/eathena/guildhandler.cpp | 42 ++++---- src/net/eathena/inventoryhandler.cpp | 4 +- src/net/eathena/itemhandler.cpp | 2 +- src/net/eathena/loginhandler.cpp | 4 +- src/net/eathena/messagehandler.cpp | 2 +- src/net/eathena/messagein.cpp | 4 +- src/net/eathena/messageout.cpp | 2 +- src/net/eathena/network.cpp | 2 +- src/net/eathena/npchandler.cpp | 28 ++--- src/net/eathena/partyhandler.cpp | 6 +- src/net/eathena/playerhandler.cpp | 14 +-- src/net/eathena/skillhandler.cpp | 2 +- src/net/eathena/tradehandler.cpp | 2 +- src/net/gamehandler.h | 4 +- src/net/generalhandler.h | 4 +- src/net/guildhandler.h | 4 +- src/net/inventoryhandler.h | 4 +- src/net/logindata.h | 2 +- src/net/loginhandler.h | 4 +- src/net/messagehandler.h | 4 +- src/net/messagein.cpp | 4 +- src/net/messagein.h | 4 +- src/net/messageout.cpp | 2 +- src/net/messageout.h | 4 +- src/net/net.cpp | 2 +- src/net/net.h | 4 +- src/net/npchandler.h | 4 +- src/net/partyhandler.h | 4 +- src/net/playerhandler.h | 4 +- src/net/sdltcpnet.h | 2 +- src/net/serverinfo.h | 2 +- src/net/skillhandler.h | 5 +- src/net/tmwa/adminhandler.cpp | 4 +- src/net/tmwa/beinghandler.cpp | 26 ++--- src/net/tmwa/buysellhandler.cpp | 2 +- src/net/tmwa/charserverhandler.cpp | 29 +++--- src/net/tmwa/chathandler.cpp | 4 +- src/net/tmwa/gamehandler.cpp | 2 +- src/net/tmwa/generalhandler.cpp | 3 +- src/net/tmwa/gui/guildtab.cpp | 2 +- src/net/tmwa/gui/partytab.cpp | 2 +- src/net/tmwa/guildhandler.cpp | 44 ++++---- src/net/tmwa/inventoryhandler.cpp | 4 +- src/net/tmwa/itemhandler.cpp | 2 +- src/net/tmwa/loginhandler.cpp | 16 +-- src/net/tmwa/messagehandler.cpp | 2 +- src/net/tmwa/messagein.cpp | 4 +- src/net/tmwa/messageout.cpp | 2 +- src/net/tmwa/network.cpp | 2 +- src/net/tmwa/npchandler.cpp | 34 +++--- src/net/tmwa/partyhandler.cpp | 6 +- src/net/tmwa/playerhandler.cpp | 6 +- src/net/tmwa/questhandler.cpp | 5 +- src/net/tmwa/skillhandler.cpp | 5 +- src/net/tmwa/tradehandler.cpp | 2 +- src/net/tradehandler.h | 5 +- src/net/worldinfo.h | 2 +- src/normalopenglgraphics.cpp | 8 +- src/notifymanager.cpp | 2 +- src/notifymanager.h | 2 +- src/particle.cpp | 15 ++- src/particleemitter.cpp | 19 ++-- src/playerinfo.cpp | 2 +- src/playerrelations.cpp | 12 +-- src/shopitem.cpp | 4 +- src/simpleanimation.cpp | 3 +- src/spellmanager.cpp | 3 +- src/statuseffect.cpp | 1 - src/test/testlauncher.cpp | 2 - src/test/testmain.cpp | 8 +- src/textmanager.cpp | 24 ++--- src/utils/copynpaste.cpp | 29 +----- src/utils/paths.cpp | 2 +- src/utils/perfomance.cpp | 3 +- src/utils/physfstools.cpp | 2 +- src/utils/process.cpp | 18 ++-- src/utils/stringutils.cpp | 2 +- src/utils/xml.cpp | 4 +- 173 files changed, 665 insertions(+), 825 deletions(-) (limited to 'src') diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index 3516a1909..5fb91d174 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -1107,4 +1107,4 @@ impHandler0(showWindows) return false; } -} +} // namespace ActionManager diff --git a/src/actionmanager.h b/src/actionmanager.h index 9c446ccff..765abbaf2 100644 --- a/src/actionmanager.h +++ b/src/actionmanager.h @@ -120,7 +120,7 @@ namespace ActionManager decHandler(whoIsOnlineWindowShow); decHandler(didYouKnowWindowShow); decHandler(questsWindowShow); -} +} // namespace ActionManager #undef decHandler diff --git a/src/being.cpp b/src/being.cpp index 9092b0750..c37550638 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -73,7 +73,7 @@ const unsigned int CACHE_SIZE = 50; class BeingCacheEntry final { public: - BeingCacheEntry(const int id): + explicit BeingCacheEntry(const int id): mId(id), mName(""), mPartyName(""), @@ -1075,7 +1075,6 @@ void Being::fireMissile(Being *const victim, const std::string &particle) const missile->setDieDistance(8); missile->setLifetime(900); } - } std::string Being::getSitAction() const @@ -1122,7 +1121,6 @@ void Being::setAction(const Action &action, const int attackId) } break; case ATTACK: -// mAttackId = attackId; if (mEquippedWeapon) { currentAction = mEquippedWeapon->getAttackAction(); @@ -1136,7 +1134,7 @@ void Being::setAction(const Action &action, const int attackId) currentAction = mInfo->getAttack(attackId)->mAction; reset(); - //attack particle effect + // attack particle effect if (Particle::enabled) { const int effectId = mInfo->getAttack(attackId)->mEffectId; @@ -1169,10 +1167,6 @@ void Being::setAction(const Action &action, const int attackId) soundManager.playSfx(mInfo->getSound( SOUND_EVENT_HURT), mX, mY); } - //currentAction = SpriteAction::HURT;// Buggy: makes the player stop - // attacking and unable to attack - // again until he moves. - // TODO: fix this! break; case DEAD: currentAction = SpriteAction::DEAD; @@ -2471,7 +2465,6 @@ void Being::recalcSpritesOrder() const int id2 = mSpriteIDs[info.mDrawAfter[dir]]; if (itemSlotRemap.find(id2) != itemSlotRemap.end()) { -// logger->log("found duplicate (after)"); const ItemInfo &info2 = ItemDB::get(id2); if (info.mDrawPriority[dir] < info2.mDrawPriority[dir]) { @@ -2486,7 +2479,7 @@ void Being::recalcSpritesOrder() } itemSlotRemap[id] = info.mDrawAfter[dir]; -// logger->log("item slot->slot %d %d->%d", id, slot, itemSlotRemap[id]); +// logger->log("item slot->slot %d %d->%d", id, slot, itemSlotRemap[id]); } } // logger->log("preparation end"); @@ -2762,7 +2755,6 @@ void Being::setEmote(const uint8_t emotion, const int emote_time) { mEmotionTime = 0; } - } } diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp index a7a660036..62968d8b7 100644 --- a/src/chatlogger.cpp +++ b/src/chatlogger.cpp @@ -124,7 +124,7 @@ std::string ChatLogger::getDir() const time_t rawtime; char buffer [81]; - time (&rawtime); + time(&rawtime); struct tm *const timeinfo = localtime(&rawtime); strftime(buffer, 79, "%Y-%m/%d", timeinfo); diff --git a/src/client.cpp b/src/client.cpp index a5986c58b..af12ea50c 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -466,7 +466,7 @@ void Client::gameInit() fprintf(stderr, "Can't find Resources directory\n"); } CFRelease(resourcesURL); - //possible crash + // possible crash strncat(path, "/data", PATH_MAX - 1); resman->addToSearchPath(path, false); // possible this need for support run client from dmg images. @@ -853,12 +853,7 @@ void Client::gameClear() delete chatLogger; chatLogger = nullptr; - - //delete logger; - //logger = nullptr; - TranslationManager::close(); - mInstance = nullptr; } @@ -1507,7 +1502,7 @@ int Client::gameExec() mCurrentDialog = new OkDialog(_("Error"), errorMessage, DIALOG_ERROR); mCurrentDialog->addActionListener(&loginListener); - mCurrentDialog = nullptr; // OkDialog deletes itself + mCurrentDialog = nullptr; // OkDialog deletes itself BLOCK_END("Client::gameExec STATE_LOGIN_ERROR") break; @@ -1517,7 +1512,7 @@ int Client::gameExec() mCurrentDialog = new OkDialog(_("Error"), errorMessage, DIALOG_ERROR); mCurrentDialog->addActionListener(&accountListener); - mCurrentDialog = nullptr; // OkDialog deletes itself + mCurrentDialog = nullptr; // OkDialog deletes itself BLOCK_END("Client::gameExec STATE_ACCOUNTCHANGE_ERROR") break; @@ -1565,7 +1560,7 @@ int Client::gameExec() mCurrentDialog = new OkDialog(_("Password Change"), _("Password changed successfully!"), DIALOG_ERROR); mCurrentDialog->addActionListener(&accountListener); - mCurrentDialog = nullptr; // OkDialog deletes itself + mCurrentDialog = nullptr; // OkDialog deletes itself loginData.password = loginData.newPassword; loginData.newPassword.clear(); BLOCK_END("Client::gameExec STATE_CHANGEPASSWORD_SUCCESS") @@ -1586,7 +1581,7 @@ int Client::gameExec() mCurrentDialog = new OkDialog(_("Email Change"), _("Email changed successfully!"), DIALOG_ERROR); mCurrentDialog->addActionListener(&accountListener); - mCurrentDialog = nullptr; // OkDialog deletes itself + mCurrentDialog = nullptr; // OkDialog deletes itself break; case STATE_UNREGISTER: @@ -1607,9 +1602,9 @@ int Client::gameExec() mCurrentDialog = new OkDialog(_("Unregister Successful"), _("Farewell, come back any time..."), DIALOG_ERROR); loginData.clear(); - //The errorlistener sets the state to STATE_CHOOSE_SERVER + // The errorlistener sets the state to STATE_CHOOSE_SERVER mCurrentDialog->addActionListener(&errorListener); - mCurrentDialog = nullptr; // OkDialog deletes itself + mCurrentDialog = nullptr; // OkDialog deletes itself break; case STATE_SWITCH_SERVER: @@ -1677,7 +1672,7 @@ int Client::gameExec() mCurrentDialog = new OkDialog(_("Error"), errorMessage, DIALOG_ERROR); mCurrentDialog->addActionListener(&errorListener); - mCurrentDialog = nullptr; // OkDialog deletes itself + mCurrentDialog = nullptr; // OkDialog deletes itself Net::getGameHandler()->disconnect(); BLOCK_END("Client::gameExec STATE_ERROR") break; @@ -2152,7 +2147,7 @@ void Client::initScreenshotDir() mScreenshotDir = getDesktopDir(); #endif - //config.setValue("screenshotDirectory", mScreenshotDir); +// config.setValue("screenshotDirectory", mScreenshotDir); logger->log("screenshotDirectory: " + mScreenshotDir); if (config.getBoolValue("useScreenshotDirectorySuffix")) @@ -2382,19 +2377,19 @@ void Client::initPacketLimiter() mPacketLimits[PACKET_CHAT].cntLimit = 1; mPacketLimits[PACKET_CHAT].cnt = 0; - //10 + // 10 mPacketLimits[PACKET_PICKUP].timeLimit = 10 + 5; mPacketLimits[PACKET_PICKUP].lastTime = 0; mPacketLimits[PACKET_PICKUP].cntLimit = 1; mPacketLimits[PACKET_PICKUP].cnt = 0; - //10 5 + // 10 5 mPacketLimits[PACKET_DROP].timeLimit = 5; mPacketLimits[PACKET_DROP].lastTime = 0; mPacketLimits[PACKET_DROP].cntLimit = 1; mPacketLimits[PACKET_DROP].cnt = 0; - //100 + // 100 mPacketLimits[PACKET_NPC_NEXT].timeLimit = 0; mPacketLimits[PACKET_NPC_NEXT].lastTime = 0; mPacketLimits[PACKET_NPC_NEXT].cntLimit = 1; @@ -2405,19 +2400,19 @@ void Client::initPacketLimiter() mPacketLimits[PACKET_NPC_INPUT].cntLimit = 1; mPacketLimits[PACKET_NPC_INPUT].cnt = 0; - //50 + // 50 mPacketLimits[PACKET_NPC_TALK].timeLimit = 60; mPacketLimits[PACKET_NPC_TALK].lastTime = 0; mPacketLimits[PACKET_NPC_TALK].cntLimit = 1; mPacketLimits[PACKET_NPC_TALK].cnt = 0; - //10 + // 10 mPacketLimits[PACKET_EMOTE].timeLimit = 10 + 5; mPacketLimits[PACKET_EMOTE].lastTime = 0; mPacketLimits[PACKET_EMOTE].cntLimit = 1; mPacketLimits[PACKET_EMOTE].cnt = 0; - //100 + // 100 mPacketLimits[PACKET_SIT].timeLimit = 100; mPacketLimits[PACKET_SIT].lastTime = 0; mPacketLimits[PACKET_SIT].cntLimit = 1; @@ -2428,7 +2423,7 @@ void Client::initPacketLimiter() mPacketLimits[PACKET_DIRECTION].cntLimit = 1; mPacketLimits[PACKET_DIRECTION].cnt = 0; - //2+ + // 2+ mPacketLimits[PACKET_ATTACK].timeLimit = 2 + 10; mPacketLimits[PACKET_ATTACK].lastTime = 0; mPacketLimits[PACKET_ATTACK].cntLimit = 1; diff --git a/src/commands.cpp b/src/commands.cpp index 9b3a776d4..9044a83a5 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -350,7 +350,8 @@ impHandler0(cleanGraphics) { ResourceManager *const resman = ResourceManager::getInstance(); resman->cleanProtected(); - while (resman->cleanOrphans(true)); + while (resman->cleanOrphans(true)) + continue; if (debugChatTab) debugChatTab->chatLog(_("Cache cleaned")); @@ -961,7 +962,7 @@ impHandler0(serverUnIgnoreAll) impHandler2(dumpGraphics) { - std::string str = strprintf ("%s,%s,%dX%dX%d,", PACKAGE_OS, SMALL_VERSION, + std::string str = strprintf("%s,%s,%dX%dX%d,", PACKAGE_OS, SMALL_VERSION, mainGraphics->getWidth(), mainGraphics->getHeight(), mainGraphics->getBpp()); @@ -1225,4 +1226,4 @@ void replaceVars(std::string &str) } } -} +} // namespace Commands diff --git a/src/configuration.cpp b/src/configuration.cpp index d43cca15e..c65c68695 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -656,11 +656,10 @@ void ConfigurationObject::initFromXML(const XmlNodePtr parent_node) && subnode->type == XML_ELEMENT_NODE) { ConfigurationObject *const cobj = new ConfigurationObject; - cobj->initFromXML(subnode); // recurse + cobj->initFromXML(subnode); // recurse mContainerOptions[name].push_back(cobj); } } - } else if (xmlNameEqual(node, "option")) { @@ -672,7 +671,7 @@ void ConfigurationObject::initFromXML(const XmlNodePtr parent_node) mOptions[name] = XML::getProperty(node, "value", std::string()); } - } // otherwise ignore + } // otherwise ignore } } diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp index 4b5b28c6a..9ee5790ac 100644 --- a/src/graphicsvertexes.cpp +++ b/src/graphicsvertexes.cpp @@ -26,7 +26,6 @@ #ifdef USE_OPENGL unsigned int vertexBufSize = 500; -//int GraphicsVertexes::mUseOpenGL = 0; #endif SDLGraphicsVertexes::SDLGraphicsVertexes() @@ -216,13 +215,6 @@ GLint *NormalOpenGLGraphicsVertexes::continueIntTexArray() } #endif -#ifdef USE_OPENGL -//void GraphicsVertexes::setLoadAsOpenGL(int useOpenGL) -//{ -// mUseOpenGL = useOpenGL; -//} -#endif - ImageVertexes::ImageVertexes() : image(nullptr) { @@ -242,7 +234,6 @@ ImageCollection::ImageCollection() : currentImage(nullptr), currentVert(nullptr) { - } ImageCollection::~ImageCollection() diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index ec6125db4..78bc20fca 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -45,12 +45,12 @@ #include "debug.h" -const int COLUMNS_NR = 5; // name plus listbox +const int COLUMNS_NR = 5; // name plus listbox const int NAME_COLUMN = 0; const int TIME_COLUMN = 1; const int ROW_HEIGHT = 12; -// The following column widths really shouldn't be hardcoded but should +// The following column widths really shouldn't be hardcoded but should // scale with the size of the widget... excep // that, right now, the widget doesn't exactly scale either. const int NAME_COLUMN_WIDTH = 185; @@ -232,7 +232,6 @@ public: widget = new Label(this, str); mWidgets.push_back(widget); - } signalAfterUpdate(); @@ -242,7 +241,6 @@ public: { } - virtual gcn::Widget *getElementAt(const int row, const int column) const { return mWidgets[WIDGET_AT(row, column)]; diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp index 06f878797..936adc2d5 100644 --- a/src/gui/buydialog.cpp +++ b/src/gui/buydialog.cpp @@ -418,7 +418,8 @@ void BuyDialog::action(const gcn::ActionEvent &event) Net::getNpcHandler()->buyItem(mNpcId, item->getId(), item->getColor(), mAmountItems); - // Update money and adjust the max number of items that can be bought + // Update money and adjust the max number of items + // that can be bought mMaxItems -= mAmountItems; setMoney(mMoney - mAmountItems * mShopItems->at(selectedItem)->getPrice()); diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp index 7db437c4f..ae031fffe 100644 --- a/src/gui/buyselldialog.cpp +++ b/src/gui/buyselldialog.cpp @@ -57,7 +57,6 @@ BuySellDialog::BuySellDialog(std::string nick) : void BuySellDialog::init() { setWindowName("BuySell"); - //setupWindow->registerWindowForReset(this); setCloseButton(true); static const char *buttonNames[] = @@ -72,7 +71,7 @@ void BuySellDialog::init() { Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this); if (!mBuyButton) - mBuyButton = btn; // For focus request + mBuyButton = btn; // For focus request btn->setPosition(x, y); add(btn); x += btn->getWidth() + buttonPadding; diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index 9b202e046..7e23b7918 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -114,7 +114,6 @@ void ChangeEmailDialog::action(const gcn::ActionEvent &event) } else if (eventId == "change_email") { - const std::string username = mLoginData->username.c_str(); const std::string newFirstEmail = mFirstEmailField->getText(); const std::string newSecondEmail = mSecondEmailField->getText(); diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index 5c4fd4ec5..bf1ebc984 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -55,7 +55,7 @@ ChangePasswordDialog::ChangePasswordDialog(LoginData *const data): mWrongDataNoticeListener(new WrongDataNoticeListener), mLoginData(data) { - Label *const accountLabel = new Label(this, + Label *const accountLabel = new Label(this, strprintf(_("Account: %s"), mLoginData->username.c_str())); place(0, 0, accountLabel, 3); diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 9ff4b038e..6c5430526 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -89,7 +89,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mMale(new RadioButton(this, _("Male"), "gender")), mFemale(new RadioButton(this, _("Female"), "gender")), mOther(new RadioButton(this, _("Other"), "gender")), - mAttributesLeft(new Label(this, + mAttributesLeft(new Label(this, strprintf(_("Please distribute %d points"), 99))), mMaxPoints(0), mUsedPoints(0), diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index 3fef0d5bc..66d7d1375 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -54,7 +54,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, ignoreButton = new Button(this, _("Ignore"), "ignore", this); const int numRows = mTextBox->getNumberOfRows(); - int inWidth = yesButton->getWidth() + noButton->getWidth() + + int inWidth = yesButton->getWidth() + noButton->getWidth() + (2 * getPadding()); if (ignoreButton) diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp index bdfbdd1d5..f6da1d5bc 100644 --- a/src/gui/editserverdialog.cpp +++ b/src/gui/editserverdialog.cpp @@ -89,7 +89,7 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, mPortField->setNumeric(true); mPortField->setRange(1, 65535); - mTypeField->setSelected(0); // TmwAthena by default for now. + mTypeField->setSelected(0); // TmwAthena by default mServerAddressField->addActionListener(this); mPortField->addActionListener(this); @@ -214,7 +214,7 @@ void EditServerDialog::action(const gcn::ActionEvent &event) mServer.name = mNameField->getText(); mServer.description = mDescriptionField->getText(); mServer.hostname = mServerAddressField->getText(); - mServer.port = static_cast(atoi( + mServer.port = static_cast(atoi( mPortField->getText().c_str())); if (mTypeField) @@ -255,7 +255,7 @@ void EditServerDialog::action(const gcn::ActionEvent &event) // Tell the server has to be saved mServer.save = true; - //Add server + // Add server mServerDialog->updateServer(mServer, mIndex); if (eventId == "connect") mServerDialog->connectToSelectedServer(); diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index af2c8f083..dd9968585 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -212,8 +212,8 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) Image *const image = item->getImage(); if (image) { - image->setAlpha(1.0f); // Ensure the image is drawn - // with maximum opacity + image->setAlpha(1.0f); // Ensure the image is drawn + // with maximum opacity g->drawImage(image, box->x + mItemPadding, box->y + mItemPadding); if (i == EQUIP_PROJECTILE_SLOT) @@ -536,19 +536,19 @@ void EquipmentWindow::fillDefault() mImageSet = Theme::getImageSetFromTheme( "equipmentbox.png", 32, 32); - addBox(0, 90, 40, 0); // torso - addBox(1, 8, 78, 1); // gloves - addBox(2, 70, 0, 2); // hat - addBox(3, 50, 253, 3); // pants - addBox(4, 90, 253, 4); // boots - addBox(5, 8, 213, 5); // FREE - addBox(6, 129, 213, 6); // wings - addBox(7, 50, 40, 5); // scarf - addBox(8, 8, 168, 7); // weapon - addBox(9, 129, 168, 8); // shield - addBox(10, 129, 78, 9); // ammo - addBox(11, 8, 123, 5); // amulet - addBox(12, 129, 123, 5); // ring + addBox(0, 90, 40, 0); // torso + addBox(1, 8, 78, 1); // gloves + addBox(2, 70, 0, 2); // hat + addBox(3, 50, 253, 3); // pants + addBox(4, 90, 253, 4); // boots + addBox(5, 8, 213, 5); // FREE + addBox(6, 129, 213, 6); // wings + addBox(7, 50, 40, 5); // scarf + addBox(8, 8, 168, 7); // weapon + addBox(9, 129, 168, 8); // shield + addBox(10, 129, 78, 9); // ammo + addBox(11, 8, 123, 5); // amulet + addBox(12, 129, 123, 5); // ring } void EquipmentWindow::addBox(const int idx, int x, int y, const int imageIndex) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index a89711137..b0b9de0a8 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -59,7 +59,7 @@ SDLFont *boldFont = nullptr; class GuiConfigListener final : public ConfigListener { public: - GuiConfigListener(Gui *const g): + explicit GuiConfigListener(Gui *const g): mGui(g) {} @@ -405,7 +405,7 @@ bool Gui::handleKeyInput2() mFocusHandler->tabNext(); } } - } // end while + } // end while BLOCK_END("Gui::handleKeyInput2") return consumed; } diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index 3c091ce65..fb00495ce 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -93,7 +93,6 @@ void HelpWindow::action(const gcn::ActionEvent &event) didYouKnowWindow->requestMoveToTop(); } } - } void HelpWindow::handleLink(const std::string &link, diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index dfbe8b8b8..ae8fa5b15 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -726,23 +726,17 @@ void InventoryWindow::widgetResized(const gcn::Event &event) { if (!mCompactMode) { - //mSortDropDown->setVisible(false); mNameFilter->setVisible(false); - //mSortDropDownCell->setType(LayoutCell::NONE); mNameFilterCell->setType(LayoutCell::NONE); mFilterCell->setWidth(mFilterCell->getWidth() + 2); - //mSlotsBarCell->setWidth(mSlotsBarCell->getWidth() + 3); mCompactMode = true; } } else if (mCompactMode) { - //mSortDropDown->setVisible(true); mNameFilter->setVisible(true); - //mSortDropDownCell->setType(LayoutCell::WIDGET); mNameFilterCell->setType(LayoutCell::WIDGET); mFilterCell->setWidth(mFilterCell->getWidth() - 2); - //mSlotsBarCell->setWidth(mSlotsBarCell->getWidth() - 3); mCompactMode = false; } } diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index d9ec8c52b..e2087117d 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -62,7 +62,7 @@ Minimap::Minimap(): setDefaultSize(5, 25, 100, 100); // set this to false as the minimap window size is changed - //depending on the map size + // depending on the map size setResizable(true); setupWindow->registerWindowForReset(this); diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 5a886c454..2de27ff6c 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -98,7 +98,6 @@ NpcDialog::NpcDialog(const int npcId) : // Basic Window Setup setWindowName("NpcText"); setResizable(true); - //setupWindow->registerWindowForReset(this); setFocusable(true); setStickyButtonLock(true); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index b6e4598ac..9ff5e19f1 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -112,7 +112,7 @@ PopupMenu::PopupMenu(): mPlayerListener.setDialog(nullptr); mPlayerListener.setType(static_cast(Being::UNKNOWN)); mScrollArea = new ScrollArea(mBrowserBox, false); - mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); + mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); add(mScrollArea); } @@ -1730,7 +1730,6 @@ void PopupMenu::showPopup(Window *const parent, const int x, const int y, if (Net::getInventoryHandler()->canSplit(item)) mBrowserBox->addRow("split", _("Split")); - } // Assume in storage for now // TODO: make this whole system more flexible, if needed diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index 76937b936..1063296d4 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -91,8 +91,8 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe): placeOption(placer, mSwitchCharacter); } -//#ifdef ANDROID /* +#ifdef ANDROID if (config.getBoolValue("rated") == false && config.getIntValue("gamecount") > 3) { @@ -101,8 +101,8 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe): mOptions[mOptions.size() - 1]->setSelected(true); } else +#endif */ -//#endif { mOptions[0]->setSelected(true); } diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index bf8bd040f..add3daf31 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -60,7 +60,7 @@ #include "inputmanager.h" #include "keydata.h" -#include "mouseinput.h" +#include "mouseinput.h" #include @@ -242,8 +242,7 @@ void SDLInput::pushInput(const SDL_Event &event) default: break; - - } // end switch + } // end switch } int SDLInput::convertMouseButton(const int button) diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp index 1d076b72a..d0d9809ac 100644 --- a/src/gui/selldialog.cpp +++ b/src/gui/selldialog.cpp @@ -68,7 +68,6 @@ SellDialog::SellDialog(std::string nick): void SellDialog::init() { setWindowName("Sell"); - //setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setStickyButtonLock(true); @@ -231,8 +230,8 @@ void SellDialog::action(const gcn::ActionEvent &event) mMaxItems -= mAmountItems; while (mAmountItems > 0) { - // This order is important, item->getCurrentInvIndex() would return - // the inventory index of the next Duplicate otherwise. + // This order is important, item->getCurrentInvIndex() would + // return the inventory index of the next Duplicate otherwise. int itemIndex = item->getCurrentInvIndex(); const int sellCount = item->sellCurrentDuplicate(mAmountItems); #ifdef MANASERV_SUPPORT diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 4a9960beb..29189c12b 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -324,7 +324,7 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo, loadServers(true); - mServersList->setSelected(0); // Do this after for the Delete button + mServersList->setSelected(0); // Do this after for the Delete button if (needUpdateServers()) downloadServerList(); @@ -530,7 +530,8 @@ void ServerDialog::downloadServerList() if (listFile.empty()) listFile = config.getStringValue("onlineServerList"); - // Fall back to manaplus.evolonline.org when neither branding nor config set it + // Fall back to manaplus.evolonline.org when neither branding + // nor config set it if (listFile.empty()) listFile = "http://manaplus.evolonline.org/serverlist.xml"; @@ -780,12 +781,12 @@ int ServerDialog::downloadUpdate(void *ptr, DownloadStatus status, if (progress != progress) { - progress = 0.0f; // check for NaN + progress = 0.0f; // check for NaN } else if (progress < 0.0f) { - progress = 0.0f; // no idea how this could ever happen, - // but why not check for it anyway. + progress = 0.0f; // no idea how this could ever happen, + // but why not check for it anyway. } else if (progress > 1.0f) { diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 77aa3b1b9..562e86e6f 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -40,7 +40,7 @@ #include "utils/dtor.h" #include "utils/gettext.h" -static const int COLUMNS_NR = 2; // name plus listbox +static const int COLUMNS_NR = 2; // name plus listbox static const int NAME_COLUMN = 0; static const unsigned int RELATION_CHOICE_COLUMN = 1; @@ -279,7 +279,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : mIgnoreActionChoicesBox->setActionEventId(ACTION_STRATEGY); mIgnoreActionChoicesBox->addActionListener(this); - int ignore_strategy_index = 0; // safe default + int ignore_strategy_index = 0; // safe default if (player_relations.getPlayerIgnoreStrategy()) { @@ -330,7 +330,6 @@ void Setup_Relations::reset() if ((*player_relations.getPlayerIgnoreStrategies())[i] == player_relations.getPlayerIgnoreStrategy()) { - selection = static_cast(i); break; } @@ -377,7 +376,6 @@ void Setup_Relations::action(const gcn::ActionEvent &event) mPlayerTableModel->updateModelInRow(row); player_relations.addListener(this); - } else if (eventId == ACTION_DELETE) { @@ -417,7 +415,7 @@ void Setup_Relations::updateAll() mPlayerTable->setModel(model); delete mPlayerTableModel; mPlayerTableModel = model; - int ignore_strategy_index = 0; // safe default + int ignore_strategy_index = 0; // safe default if (player_relations.getPlayerIgnoreStrategy()) { diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 0ed8065ae..bc6ca117d 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -265,7 +265,6 @@ void ShopWindow::action(const gcn::ActionEvent &event) this, item, sumAmount(item)); } } - } void ShopWindow::startTrade() @@ -614,7 +613,6 @@ void ShopWindow::sendMessage(const std::string &nick, Net::getChatHandler()->privateMessage(nick, data); else if (chatWindow) chatWindow->addWhisper(nick, data, BY_PLAYER); -//here was true } void ShopWindow::showList(const std::string &nick, std::string data) const diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 152417ee6..076a7a7f2 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -199,7 +199,6 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : keyboard.setEnabled(false); setWindowName("TextCommandEditor"); - //setCloseButton(true); setDefaultSize(w, h, ImageRect::CENTER); mAdvanced = false; diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 846bb45c4..0d2e7d16f 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -990,7 +990,7 @@ void Theme::loadColors(std::string file) if (xmlNameEqual(paletteNode, "progressbar")) { type = readProgressType(XML::getProperty(paletteNode, "id", "")); - if (type < 0) // invalid or no type given + if (type < 0) // invalid or no type given continue; mProgressColors[type] = new DyePalette(XML::getProperty( @@ -1011,11 +1011,11 @@ void Theme::loadColors(std::string file) { std::string id = XML::getProperty(node, "id", ""); type = readColorType(id); - if (type < 0) // invalid or no type given + if (type < 0) // invalid or no type given continue; temp = XML::getProperty(node, "color", ""); - if (temp.empty()) // no color set, so move on + if (temp.empty()) // no color set, so move on continue; color = readColor(temp); diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index 48dbf1d27..a6f5b8d3e 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -68,7 +68,7 @@ TradeWindow::TradeWindow(): mPartnerItemContainer(new ItemContainer(this, mPartnerInventory.get())), mMoneyLabel(new Label(this, strprintf(_("You get %s"), ""))), mAddButton(new Button(this, _("Add"), "add", this)), - mOkButton(new Button(this, "", "", this)), // Will be filled in later + mOkButton(new Button(this, "", "", this)), // Will be filled in later mMoneyChangeButton(new Button(this, _("Change"), "money", this)), mMoneyField(new TextField(this)), mStatus(PROPOSING), @@ -246,11 +246,7 @@ void TradeWindow::receivedOk(const bool own) mOkOther = true; if (mOkMe && mOkOther) - { - //mOkMe = false; - //mOkOther = false; setStatus(ACCEPTING); - } } void TradeWindow::tradeItem(Item *const item, const int quantity, @@ -371,7 +367,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) } else if (eventId == "money") { - if (mStatus != PREPARING) + if (mStatus != PREPARING) return; int v = atoi(mMoneyField->getText().c_str()); diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index fb102f724..7ec4c42f2 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -432,10 +432,10 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus status, static_cast(dt); if (progress != progress) - progress = 0.0f; // check for NaN + progress = 0.0f; // check for NaN if (progress < 0.0f) - progress = 0.0f; // no idea how this could ever happen, - // but why not check for it anyway. + progress = 0.0f; // no idea how this could ever happen, + // but why not check for it anyway. if (progress > 1.0f) progress = 1.0f; @@ -565,7 +565,7 @@ void UpdaterWindow::loadLocalUpdates(const std::string &dir) for (unsigned int updateIndex = 0, sz = static_cast( updateFiles.size()); updateIndex < sz; updateIndex ++) { - UpdaterWindow::addUpdateFile(resman, dir, fixPath, + UpdaterWindow::addUpdateFile(resman, dir, fixPath, updateFiles[updateIndex].name, false); } loadManaPlusUpdates(dir, resman); @@ -666,7 +666,7 @@ void UpdaterWindow::logic() mCurrentFile = xmlUpdateFile; mStoreInMemory = false; mDownloadStatus = UPDATE_LIST; - download(); // download() changes mDownloadComplete to false + download(); // download() changes mDownloadComplete to false } break; case UPDATE_PATCH: @@ -769,8 +769,8 @@ void UpdaterWindow::logic() mCurrentFile = "latest.txt"; mStoreInMemory = true; mDownloadStatus = UPDATE_PATCH; - download(); // download() changes - // mDownloadComplete to false + download(); // download() changes + // mDownloadComplete to false } } break; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index a9011f595..e4bbc8f5c 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -150,7 +150,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) - midTileY + mCameraRelativeY; if (mScrollLaziness < 1) - mScrollLaziness = 1; // Avoids division by zero + mScrollLaziness = 1; // Avoids division by zero if (mEnableLazyScrolling) { diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index b280ae4f8..0c1a2998d 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -196,10 +196,10 @@ void WhoIsOnline::updateWindow(std::vector &friends, std::vector enemy, size_t numOnline) { - //Set window caption + // Set window caption setCaption(_("Who Is Online - ") + toString(numOnline)); - //List the online people + // List the online people std::sort(friends.begin(), friends.end(), nameCompare); std::sort(neutral.begin(), neutral.end(), nameCompare); std::sort(disregard.begin(), disregard.end(), nameCompare); @@ -298,7 +298,7 @@ void WhoIsOnline::loadList(std::vector &list) case PlayerRelation::IGNORED: case PlayerRelation::ERASED: - //Ignore the ignored. + // Ignore the ignored. break; } } @@ -447,7 +447,7 @@ void WhoIsOnline::loadWebList() case PlayerRelation::IGNORED: case PlayerRelation::ERASED: - //Ignore the ignored. + // Ignore the ignored. break; } } diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index a946f352e..4ac0a3632 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -214,7 +214,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) mTextRowLinksCount.push_back(linksCount); } - //discard older rows when a row limit has been set + // discard older rows when a row limit has been set if (mMaxRows > 0 && !mTextRows.empty()) { while (mTextRows.size() > mMaxRows) @@ -281,7 +281,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) if ((x + nextWordWidth + 10) > static_cast(getWidth())) { - x = mNewLinePadding; // Ident in new line + x = mNewLinePadding; // Ident in new line y += 1; j ++; } @@ -290,7 +290,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) else if ((x + 2 * hyphenWidth) > static_cast(getWidth())) { - x = mNewLinePadding; // Ident in new line + x = mNewLinePadding; // Ident in new line y += 1; } } @@ -401,8 +401,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) mLinks[mSelectedLink].x1, mLinks[mSelectedLink].y1, mLinks[mSelectedLink].x2 - mLinks[mSelectedLink].x1, - mLinks[mSelectedLink].y2 - mLinks[mSelectedLink].y1 - )); + mLinks[mSelectedLink].y2 - mLinks[mSelectedLink].y1)); } if ((mHighMode & UNDERLINE)) @@ -573,7 +572,6 @@ int BrowserBox::calcHeight() } else { - switch (c) { case '1': @@ -670,14 +668,14 @@ int BrowserBox::calcHeight() { forced = true; end = row.size(); - x += hyphenWidth; // Account for the wrap-notifier + x += hyphenWidth; // Account for the wrap-notifier continue; } // Skip to the start of the current character while ((row[end] & 192) == 128) end--; - end--; // And then to the last byte of the previous one + end--; // And then to the last byte of the previous one part = row.substr(start, end - start + 1); if (bold) @@ -689,14 +687,14 @@ int BrowserBox::calcHeight() if (forced) { - x -= hyphenWidth; // Remove the wrap-notifier accounting + x -= hyphenWidth; // Remove the wrap-notifier accounting mLineParts.push_back(LinePart(wWidth - hyphenWidth, y, selColor[0], selColor[1], hyphen, bold)); - end++; // Skip to the next character + end++; // Skip to the next character } else { - end += 2; // Skip to after the space + end += 2; // Skip to after the space } wrapped = true; @@ -747,13 +745,10 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) const getAbsolutePosition(textX, textY); if (x < textX || y < textY) - return ""; // mouse position ourside of correct widget (outside of tab) + return ""; -// textX = x - textX; textY = y - textY; - std::string str; - int lastY = 0; FOR_EACH (LinePartCIter, i, mLineParts) diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 02e05a643..ec0215206 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -42,11 +42,11 @@ float Button::mAlpha = 1.0; enum { - BUTTON_STANDARD = 0, // 0 - BUTTON_HIGHLIGHTED, // 1 - BUTTON_PRESSED, // 2 - BUTTON_DISABLED, // 3 - BUTTON_COUNT // 4 - Must be last. + BUTTON_STANDARD = 0, // 0 + BUTTON_HIGHLIGHTED, // 1 + BUTTON_PRESSED, // 2 + BUTTON_DISABLED, // 3 + BUTTON_COUNT // 4 - Must be last. }; static std::string const data[BUTTON_COUNT] = diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index fc3e4e69f..b4eef0352 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -155,7 +155,7 @@ void ChatTab::chatLog(std::string line, Own own, { tmp.nick = strprintf(_("Global announcement from %s:"), tmp.nick.c_str()).append(" "); - lineColor = "##1"; // Equiv. to BrowserBox::RED + lineColor = "##1"; // Equiv. to BrowserBox::RED } break; case BY_PLAYER: @@ -175,7 +175,7 @@ void ChatTab::chatLog(std::string line, Own own, case BY_CHANNEL: tmp.nick.clear(); // TODO: Use a predefined color - lineColor = "##2"; // Equiv. to BrowserBox::GREEN + lineColor = "##2"; // Equiv. to BrowserBox::GREEN break; case ACT_WHISPER: tmp.nick = strprintf(_("%s whispers: %s"), tmp.nick.c_str(), ""); @@ -260,7 +260,6 @@ void ChatTab::chatLog(std::string line, Own own, addRow(line); mScrollArea->setVerticalScrollAmount( mScrollArea->getVerticalMaxScroll()); - } else { diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index daec2e7fa..31a41307c 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -517,7 +517,7 @@ gcn::Rectangle DropDown::getChildrenArea() if (mDroppedDown) { // Calculate the children area (with the one pixel border in mind) - return gcn::Rectangle(1, mFoldedUpHeight + 1, + return gcn::Rectangle(1, mFoldedUpHeight + 1, getWidth() - 2, getHeight() - mFoldedUpHeight - 2); } @@ -549,7 +549,7 @@ void DropDown::removeSelectionListener(SelectionListener* listener) void DropDown::distributeValueChangedEvent() { for (SelectionListenerIterator iter = mSelectionListeners.begin(); - iter != mSelectionListeners.end(); + iter != mSelectionListeners.end(); ++iter) { gcn::SelectionEvent event(this); diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index d5b853552..8be6a4197 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -68,7 +68,6 @@ EmoteShortcutContainer::EmoteShortcutContainer(): mEmoteImg.push_back(sprite); } -// mMaxItems = EmoteDB::getLast() < MAX_ITEMS ? EmoteDB::getLast() : MAX_ITEMS; mMaxItems = MAX_ITEMS; if (mBackgroundImg) diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 42f9c9350..5a53a27b4 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -193,7 +193,7 @@ void GuiTable::setLinewiseSelection(const bool linewise) int GuiTable::getRowHeight() const { if (mModel) - return mModel->getRowHeight() + 1; // border + return mModel->getRowHeight() + 1; // border else return 0; } @@ -201,7 +201,7 @@ int GuiTable::getRowHeight() const int GuiTable::getColumnWidth(int i) const { if (mModel) - return mModel->getColumnWidth(i) + 1; // border + return mModel->getColumnWidth(i) + 1; // border else return 0; } @@ -287,7 +287,7 @@ void GuiTable::installActionListeners() } } - _setFocusHandler(_getFocusHandler()); // propagate focus handler to widgets + _setFocusHandler(_getFocusHandler()); } // -- widget ops @@ -307,20 +307,21 @@ void GuiTable::draw(gcn::Graphics* graphics) graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight())); } - // First, determine how many rows we need to draw, and where we should start. + // First, determine how many rows we need to draw, + // and where we should start. int first_row = -(getY() / getRowHeight()); if (first_row < 0) first_row = 0; - unsigned rows_nr = 1 + (getHeight() / getRowHeight()); // May overestimate - // by one. + unsigned rows_nr = 1 + (getHeight() / getRowHeight()); // May overestimate + // by one. unsigned max_rows_nr; if (mModel->getRows() < first_row) max_rows_nr = 0; else - max_rows_nr = mModel->getRows() - first_row; // clip if neccessary: + max_rows_nr = mModel->getRows() - first_row; // clip if neccessary: if (max_rows_nr < rows_nr) rows_nr = max_rows_nr; @@ -512,7 +513,6 @@ void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent) setSelectedColumn(getColumnForX(x)); } -// -- TableModelListener notifications void GuiTable::modelUpdated(bool completed) { if (completed) @@ -521,8 +521,8 @@ void GuiTable::modelUpdated(bool completed) installActionListeners(); } else - { // before the update? - mTopWidget = nullptr; // No longer valid in general + { // before the update? + mTopWidget = nullptr; // No longer valid in general uninstallActionListeners(); } } @@ -541,7 +541,7 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y) if (w && w->isFocusable()) return w; else - return nullptr; // Grab the event locally + return nullptr; // Grab the event locally } else return nullptr; @@ -549,15 +549,15 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y) int GuiTable::getRowForY(int y) const { - int row = -1; + int row = -1; - if (getRowHeight() > 0) + if (getRowHeight() > 0) row = y / getRowHeight(); - if (!mModel || row < 0 || row >= mModel->getRows()) - return -1; - else - return row; + if (!mModel || row < 0 || row >= mModel->getRows()) + return -1; + else + return row; } int GuiTable::getColumnForX(int x) const diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index 236fdaf43..be8b2e310 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -27,8 +27,6 @@ #include "gui/sdlinput.h" -//#include "utils/stringutils.h" - #include "debug.h" IntTextField::IntTextField(const Widget2 *const widget, const int def, diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index a6a594c46..50ab7dfca 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -276,7 +276,7 @@ void ItemContainer::draw(gcn::Graphics *graphics) g->drawImage(mSelImg, itemX, itemY); } } - image->setAlpha(1.0f); // ensure the image if fully drawn... + image->setAlpha(1.0f); // ensure the image if fully drawn... g->drawImage(image, itemX + mPaddingItemX, itemY + mPaddingItemY); } diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index e2999c8ad..5a7eb3462 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -77,7 +77,7 @@ void ItemLinkHandler::handleLink(const std::string &link, { ConfirmDialog *const confirmDlg = new ConfirmDialog( _("Open url"), url, false, true); - confirmDlg->addActionListener(&listener); + confirmDlg->addActionListener(&listener); } else if (button == gcn::MouseInput::RIGHT) { diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index ce5c9c01e..de5543680 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -127,20 +127,7 @@ void ProgressBar::updateAlpha() { const float alpha = std::max(Client::getGuiAlpha(), Theme::instance()->getMinimumOpacity()); - - if (mAlpha != alpha) - { - mAlpha = alpha; -/* - ImageRect &rect = mSkin->getBorder(); - for (int i = 0; i < 9; i++) - { - if (rect.grid[i]) - rect.grid[i]->setAlpha(mAlpha); - } -*/ - } - + mAlpha = alpha; } void ProgressBar::draw(gcn::Graphics *graphics) diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index b143f5c21..69b1f6d8e 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -809,7 +809,7 @@ void ScrollArea::mouseDragged(gcn::MouseEvent &event) { const gcn::Rectangle barDim = getHorizontalBarDimension(); - const int pos = event.getX() - barDim.x + const int pos = event.getX() - barDim.x - mHorizontalMarkerDragOffset; const int length = getHorizontalMarkerDimension().width; diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 54e1102a6..e44ec74a7 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -87,7 +87,6 @@ SetupItem::SetupItem(std::string text, std::string description, SetupItem::~SetupItem() { - } Configuration *SetupItem::getConfig() const diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp index 22049e944..74cb6a716 100644 --- a/src/gui/widgets/shopitems.cpp +++ b/src/gui/widgets/shopitems.cpp @@ -73,7 +73,7 @@ void ShopItems::addItem2(const int inventoryIndex, const int id, if (item) { - item->addDuplicate (inventoryIndex, quantity); + item->addDuplicate(inventoryIndex, quantity); } else { diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 29b2e70c4..ae7d426a8 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -38,11 +38,11 @@ float Tab::mAlpha = 1.0; enum { - TAB_STANDARD = 0, // 0 - TAB_HIGHLIGHTED, // 1 - TAB_SELECTED, // 2 - TAB_UNUSED, // 3 - TAB_COUNT // 4 - Must be last. + TAB_STANDARD = 0, // 0 + TAB_HIGHLIGHTED, // 1 + TAB_SELECTED, // 2 + TAB_UNUSED, // 3 + TAB_COUNT // 4 - Must be last. }; static std::string const data[TAB_COUNT] = diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp index 294759a77..543c50ebd 100644 --- a/src/gui/widgets/tablemodel.cpp +++ b/src/gui/widgets/tablemodel.cpp @@ -127,7 +127,7 @@ void StaticTableModel::fixColumnWidth(const int column, const int width) if (width < 0 || column < 0 || column >= mColumns) return; - mWidths[column] = -width; // Negate to tag as fixed + mWidths[column] = -width; // Negate to tag as fixed } void StaticTableModel::fixRowHeight(const int height) @@ -145,7 +145,7 @@ int StaticTableModel::getRowHeight() const int StaticTableModel::getColumnWidth(int column) const { - if (column < 0 || column >= mColumns) + if (column < 0 || column >= mColumns) return 0; return abs(mWidths[column]); diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index dec73768e..b0281e9bd 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -53,7 +53,8 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) if (getParent()) getParent()->logic(); - // Take the supplied minimum dimension as a starting point and try to beat it + // Take the supplied minimum dimension as a starting + // point and try to beat it mMinWidth = minDimension; std::stringstream wrappedStream; @@ -104,7 +105,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) xpos = width; wrappedStream << word; } - else if (xpos != 0 && xpos + getFont()->getWidth(" ") + width <= + else if (xpos != 0 && xpos + getFont()->getWidth(" ") + width <= mMinWidth) { xpos += getFont()->getWidth(" ") + width; diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index e4568d391..23cedfde9 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -37,7 +37,7 @@ #include -#undef DELETE //Win32 compatibility hack +#undef DELETE // Win32 compatibility hack #include "debug.h" @@ -250,7 +250,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) bool consumed(false); switch (val) { - case 2: // Ctrl+b + case 2: // Ctrl+b { while (mCaretPosition > 0) { @@ -262,7 +262,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) break; } - case 6: // Ctrl+f + case 6: // Ctrl+f { const unsigned sz = static_cast(mText.size()); while (mCaretPosition < sz) @@ -278,7 +278,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) break; } - case 4: // Ctrl+d + case 4: // Ctrl+d { unsigned sz = static_cast(mText.size()); while (mCaretPosition < sz) @@ -295,22 +295,22 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) break; } - case 8: // Ctrl+h + case 8: // Ctrl+h deleteCharLeft(mText, &mCaretPosition); consumed = true; break; - case 5: // Ctrl+e + case 5: // Ctrl+e mCaretPosition = static_cast(mText.size()); consumed = true; break; - case 11: // Ctrl+k + case 11: // Ctrl+k mText = mText.substr(0, mCaretPosition); consumed = true; break; - case 21: // Ctrl+u + case 21: // Ctrl+u if (mCaretPosition > 0) { mText = mText.substr(mCaretPosition); @@ -324,7 +324,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) consumed = true; break; - case 22: // Control code 22, SYNCHRONOUS IDLE, sent on Ctrl+v + case 22: // Control code 22, SYNCHRONOUS IDLE, sent on Ctrl+v // hack to prevent paste key sticking if (mLastEventPaste && mLastEventPaste > cur_time) break; @@ -333,7 +333,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) consumed = true; break; - case 23: // Ctrl+w + case 23: // Ctrl+w while (mCaretPosition > 0) { deleteCharLeft(mText, &mCaretPosition); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 926821f18..4d16937e2 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -241,7 +241,6 @@ void Window::draw(gcn::Graphics *graphics) if (mGrip) g->calcTile(mVertexes, mGrip, mGripRect.x, mGripRect.y); - } else { @@ -562,7 +561,7 @@ void Window::setVisible(bool visible) void Window::setVisible(bool visible, bool forceSticky) { if (visible == isWindowVisible()) - return; // Nothing to do + return; // Check if the window is off screen... if (visible) diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp index 416e003eb..55b13e82c 100644 --- a/src/inputmanager.cpp +++ b/src/inputmanager.cpp @@ -60,7 +60,6 @@ static class KeyFunctor final } const KeyData *keys; - } keyDataSorter; diff --git a/src/inventory.cpp b/src/inventory.cpp index 3dce0e079..0a82aae7b 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -154,7 +154,7 @@ void Inventory::removeItemAt(const int index) delete mItems[index]; mItems[index] = nullptr; mUsed--; - if (mUsed < 0) // Already at 0, no need to distribute event + if (mUsed < 0) // Already at 0, no need to distribute event mUsed = 0; else distributeSlotsChangedEvent(); @@ -216,10 +216,8 @@ const Item *Inventory::findItemBySprite(std::string spritePath, const int race) const { spritePath = removeSpriteIndex(spritePath); -// logger->log1("Inventory::FindItemBySprite sprite: " + spritePath); const std::string spritePathShort = extractNameFromSprite(spritePath); -// logger->log1("Inventory::FindItemBySprite spriteShort: " + spritePathShort); int partialIndex = -1; for (unsigned i = 0; i < mSize; i++) @@ -231,14 +229,10 @@ const Item *Inventory::findItemBySprite(std::string spritePath, if (!path.empty()) { path = removeSpriteIndex(path); - -// logger->log("Inventory::FindItemBySprite normal: " + path); - if (spritePath == path) return item; path = extractNameFromSprite(path); -// logger->log("Inventory::FindItemBySprite short: " + path); if (spritePathShort == path) partialIndex = i; } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 7cc69ec9f..aabb024e7 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -472,7 +472,7 @@ Position LocalPlayer::getNextWalkPosition(const unsigned char dir) const return Position(tileX * 32 + 32 - radius, tileY * 32 + getCollisionRadius()); } - else // Both straight direction are walkable + else // Both straight direction are walkable { // Go right when below the corner if (offsetY >= (offsetX / mMap->getTileHeight() @@ -481,13 +481,13 @@ Position LocalPlayer::getNextWalkPosition(const unsigned char dir) const { dy = 0; } - else // Go up otherwise + else // Go up otherwise { dx = 0; } } } - else // The diagonal is walkable + else // The diagonal is walkable { return mMap->checkNodeOffsets(radius, walkMask, Position(posX + 32, posY - 32)); @@ -513,7 +513,7 @@ Position LocalPlayer::getNextWalkPosition(const unsigned char dir) const return Position(tileX * 32 + radius, tileY * 32 + radius); } - else // Both straight direction are walkable + else // Both straight direction are walkable { // Go left when below the corner if (offsetY >= (offsetX / mMap->getTileWidth() @@ -521,13 +521,13 @@ Position LocalPlayer::getNextWalkPosition(const unsigned char dir) const { dy = 0; } - else // Go up otherwise + else // Go up otherwise { dx = 0; } } } - else // The diagonal is walkable + else // The diagonal is walkable { return mMap->checkNodeOffsets(radius, walkMask, Position(posX - 32, posY - 32)); @@ -553,7 +553,7 @@ Position LocalPlayer::getNextWalkPosition(const unsigned char dir) const return Position(tileX * 32 + radius, tileY * 32 + 32 - radius); } - else // Both straight direction are walkable + else // Both straight direction are walkable { // Go down when below the corner if (offsetY >= (offsetX / mMap->getTileHeight() @@ -562,13 +562,13 @@ Position LocalPlayer::getNextWalkPosition(const unsigned char dir) const { dx = 0; } - else // Go left otherwise + else // Go left otherwise { dy = 0; } } } - else // The diagonal is walkable + else // The diagonal is walkable { return mMap->checkNodeOffsets(radius, walkMask, Position(posX - 32, posY + 32)); @@ -594,7 +594,7 @@ Position LocalPlayer::getNextWalkPosition(const unsigned char dir) const return Position(tileX * 32 + 32 - radius, tileY * 32 + 32 - radius); } - else // Both straight direction are walkable + else // Both straight direction are walkable { // Go down when below the corner if (offsetY >= (offsetX / mMap->getTileWidth() @@ -602,13 +602,13 @@ Position LocalPlayer::getNextWalkPosition(const unsigned char dir) const { dx = 0; } - else // Go right otherwise + else // Go right otherwise { dy = 0; } } } - else // The diagonal is walkable + else // The diagonal is walkable { return mMap->checkNodeOffsets(radius, walkMask, Position(posX + 32, posY + 32)); @@ -1477,7 +1477,6 @@ bool LocalPlayer::withinAttackRange(const Being *const target, const Vector &pos = getPosition(); dx = static_cast(abs(static_cast(targetPos.x - pos.x))); dy = static_cast(abs(static_cast(targetPos.y - pos.y))); - } else #endif @@ -2273,36 +2272,35 @@ void LocalPlayer::changeEquipmentBeforeAttack(const Being *const target) const if (!item) item = inv->findItem(758, 0); - //no swords + // no swords if (!item) return; - //if sword not equiped + // if sword not equiped if (!item->isEquipped()) Net::getInventoryHandler()->equipItem(item); - //if need equip shield too + // if need equip shield too if (mAttackWeaponType == 3) { - //finding shield + // finding shield item = inv->findItem(601, 0); if (!item) item = inv->findItem(602, 0); if (item && !item->isEquipped()) Net::getInventoryHandler()->equipItem(item); } - } - //big distance. allowed only bow + // big distance. allowed only bow else { - //finding bow + // finding bow item = inv->findItem(545, 0); if (!item) item = inv->findItem(530, 0); - //no bow + // no bow if (!item) return; @@ -3153,7 +3151,6 @@ void LocalPlayer::specialMove(const unsigned char direction) { setWalkingDir(direction); } - } void LocalPlayer::debugMsg(const std::string &str) const @@ -3234,7 +3231,6 @@ void LocalPlayer::loadHomes() ss >> pos.y; mHomes[buf] = pos; } - } void LocalPlayer::setMap(Map *const map) @@ -3747,7 +3743,6 @@ void LocalPlayer::attack2(Being *const target, const bool keep, pickUpItems(3); } } - } else if (!mPickUpTarget) { diff --git a/src/main.cpp b/src/main.cpp index 8e9105b64..5651a98b6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -145,8 +145,8 @@ static void parseOptions(const int argc, char *const argv[], case 'D': options.chooseDefault = true; break; - case '?': // Unknown option - case ':': // Missing argument + case '?': // Unknown option + case ':': // Missing argument case 'h': options.printHelp = true; break; diff --git a/src/map.cpp b/src/map.cpp index ceb863359..94b797d43 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -257,7 +257,7 @@ void Map::initializeAmbientLayers() } else { - break; // the FOR loop + break; // the FOR loop } Image *const img = resman->getImage(getProperty(name + "image")); @@ -510,8 +510,8 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY) graphics->setColor(userPalette->getColorWithAlpha(\ UserPalette::color));\ graphics->fillRectangle(gcn::Rectangle(\ - x0 * mTileWidth - scrollX,\ - y * mTileHeight - scrollY,\ + x0 * mTileWidth - scrollX, \ + y * mTileHeight - scrollY, \ width, 32));\ }\ }\ @@ -566,7 +566,7 @@ void Map::drawCollision(Graphics *const graphics, void Map::updateAmbientLayers(const float scrollX, const float scrollY) { BLOCK_START("Map::updateAmbientLayers") - static int lastTick = tick_time; // static = only initialized at first call + static int lastTick = tick_time; // static = only initialized at first call if (mLastAScrollX == 0.0f && mLastAScrollY == 0.0f) { @@ -1230,7 +1230,7 @@ void Map::saveExtraLayer() const std::string Map::getUserMapDirectory() const { - return Client::getServerConfigDirectory() + + return Client::getServerConfigDirectory() + dirSeparator + getProperty("_realfilename"); } diff --git a/src/mobileopenglgraphics.cpp b/src/mobileopenglgraphics.cpp index 4ffe426ab..3498010c4 100644 --- a/src/mobileopenglgraphics.cpp +++ b/src/mobileopenglgraphics.cpp @@ -46,8 +46,6 @@ unsigned int MobileOpenGLGraphics::mDrawCalls = 0; unsigned int MobileOpenGLGraphics::mLastDrawCalls = 0; #endif -//unsigned int vertexBufSize = 500; - MobileOpenGLGraphics::MobileOpenGLGraphics(): mFloatTexArray(nullptr), mIntTexArray(nullptr), diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp index d28ef733c..2911d8df5 100644 --- a/src/mumblemanager.cpp +++ b/src/mumblemanager.cpp @@ -145,7 +145,8 @@ void MumbleManager::init() // // 1 unit = 1 meter - // Unit vector pointing out of the avatars eyes (here Front looks into scene). + // Unit vector pointing out of the avatars eyes + // (here Front looks into scene). /* no way to look "up", 2d */ mLinkedMemCache.fAvatarFront[1] = 0.0f; diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index a7820a832..dc249c137 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -60,6 +60,6 @@ class AdminHandler const int x, const int y) const = 0; }; -} // namespace Net +} // namespace Net -#endif // ADMINHANDLER_H +#endif // ADMINHANDLER_H diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index fcbf0bb5a..332d2e81c 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -41,6 +41,6 @@ class BeingHandler virtual void undress(Being *const being) const = 0; }; -} // namespace Net +} // namespace Net -#endif // BEINGHANDLER_H +#endif // BEINGHANDLER_H diff --git a/src/net/buysellhandler.h b/src/net/buysellhandler.h index 1f5578ed7..1b9984647 100644 --- a/src/net/buysellhandler.h +++ b/src/net/buysellhandler.h @@ -51,6 +51,6 @@ class BuySellHandler const int amount) const = 0; }; -} // namespace Net +} // namespace Net -#endif // BUYSELLHANDLER_H +#endif // BUYSELLHANDLER_H diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp index dc8b306f9..0e8add107 100644 --- a/src/net/charserverhandler.cpp +++ b/src/net/charserverhandler.cpp @@ -40,4 +40,4 @@ void CharServerHandler::unlockCharSelectDialog() mCharSelectDialog->unlock(); } -} +} // namespace Net diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index c12a969aa..9bbba0ab4 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -116,6 +116,6 @@ class CharServerHandler CharCreateDialog *mCharCreateDialog; }; -} // namespace Net +} // namespace Net -#endif // CHARSERVERHANDLER_H +#endif // CHARSERVERHANDLER_H diff --git a/src/net/chathandler.h b/src/net/chathandler.h index e4fe2deb7..fe113b6d5 100644 --- a/src/net/chathandler.h +++ b/src/net/chathandler.h @@ -53,6 +53,7 @@ class ChatHandler virtual void unIgnoreAll() const = 0; }; + } -#endif // CHATHANDLER_H +#endif // CHATHANDLER_H diff --git a/src/net/download.cpp b/src/net/download.cpp index 05cbd110a..afec61d0f 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -219,7 +219,7 @@ int Download::downloadThread(void *ptr) if (d->mOptions.cancel) { - //need terminate thread? + // need terminate thread? d->mThread = nullptr; return 0; } @@ -233,7 +233,6 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(d->mCurl, CURLOPT_HTTPHEADER, d->mHeaders); -// curl_easy_setopt(d->mCurl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); if (d->mOptions.memoryWrite) { @@ -320,7 +319,7 @@ int Download::downloadThread(void *ptr) d->mFileName.c_str(), adler, d->mAdler); attempts++; - continue; // Bail out here to avoid the renaming + continue; // Bail out here to avoid the renaming } } if (file) @@ -362,7 +361,7 @@ int Download::downloadThread(void *ptr) if (d->mOptions.cancel) { - //need ternibate thread? + // need ternibate thread? d->mThread = nullptr; return 0; } @@ -399,33 +398,33 @@ void Download::addProxy(CURL *const curl) } switch (mode) { - case 1: // direct connection + case 1: // direct connection default: curl_easy_setopt(curl, CURLOPT_PROXY, ""); break; - case 2: // HTTP + case 2: // HTTP break; - case 3: // HTTP 1.0 + case 3: // HTTP 1.0 #if CURLVERSION_ATLEAST(7, 19, 4) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP_1_0); #endif break; - case 4: // SOCKS4 + case 4: // SOCKS4 curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); break; - case 5: // SOCKS4A + case 5: // SOCKS4A #if CURLVERSION_ATLEAST(7, 18, 0) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A); #else curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); #endif break; - case 6: // SOCKS5 + case 6: // SOCKS5 #if CURLVERSION_ATLEAST(7, 18, 0) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); #endif break; - case 7: // SOCKS5 hostname + case 7: // SOCKS5 hostname #if CURLVERSION_ATLEAST(7, 18, 0) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME); @@ -450,4 +449,4 @@ void Download::secureCurl(CURL *const curl) #endif } -} // namespace Net +} // namespace Net diff --git a/src/net/download.h b/src/net/download.h index 53ecf4171..d351a8355 100644 --- a/src/net/download.h +++ b/src/net/download.h @@ -124,6 +124,6 @@ class Download final bool mIgnoreError; }; -} // namespace Net +} // namespace Net -#endif // NET_DOWNLOAD_H +#endif // NET_DOWNLOAD_H diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp index 79eff8e68..0d2245330 100644 --- a/src/net/ea/adminhandler.cpp +++ b/src/net/ea/adminhandler.cpp @@ -70,4 +70,4 @@ void AdminHandler::warp(const std::string &map, const int x, const int y) const "@warp %s %d %d", map.c_str(), x, y), GENERAL_CHANNEL); } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 2f982a425..6f9cef522 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -201,13 +201,13 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, const uint16_t headBottom = msg.readInt16(); if (!visible) - msg.readInt32(); // server tick + msg.readInt32(); // server tick const uint16_t shield = msg.readInt16(); const uint16_t headTop = msg.readInt16(); const uint16_t headMid = msg.readInt16(); const int hairColor = msg.readInt16(); - const uint16_t shoes = msg.readInt16(); //clothes color - "abused" as shoes + const uint16_t shoes = msg.readInt16(); // clothes color uint16_t gloves; if (dstBeing->getType() == ActorSprite::MONSTER) @@ -444,29 +444,20 @@ void BeingHandler::processSkillDamage(Net::MessageIn &msg) const if (!actorSpriteManager) return; - const int id = msg.readInt16(); // Skill Id + const int id = msg.readInt16(); // Skill Id Being *const srcBeing = actorSpriteManager->findBeing(msg.readInt32()); Being *const dstBeing = actorSpriteManager->findBeing(msg.readInt32()); - msg.readInt32(); // Server tick - msg.readInt32(); // src speed - msg.readInt32(); // dst speed - const int param1 = msg.readInt32(); // Damage - const int level = msg.readInt16(); // Skill level - msg.readInt16(); // Div - msg.readInt8(); // Skill hit/type (?) + msg.readInt32(); // Server tick + msg.readInt32(); // src speed + msg.readInt32(); // dst speed + const int param1 = msg.readInt32(); // Damage + const int level = msg.readInt16(); // Skill level + msg.readInt16(); // Div + msg.readInt8(); // Skill hit/type (?) if (dstBeing) - { -// if (dstSpeed) -// dstBeing->setAttackDelay(dstSpeed); dstBeing->takeDamage(srcBeing, param1, Being::SKILL, id); - } if (srcBeing) - { -// if (srcSpeed) -// srcBeing->setAttackDelay(srcSpeed); -// srcBeing->handleAttack(dstBeing, param1, Being::HIT); srcBeing->handleSkill(dstBeing, param1, id, level); - } } void BeingHandler::processBeingAction(Net::MessageIn &msg) const @@ -487,15 +478,13 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) const switch (type) { - case Being::HIT: // Damage - case Being::CRITICAL: // Critical Damage - case Being::MULTI: // Critical Damage - case Being::REFLECT: // Reflected Damage - case Being::FLEE: // Lucky Dodge + case Being::HIT: // Damage + case Being::CRITICAL: // Critical Damage + case Being::MULTI: // Critical Damage + case Being::REFLECT: // Reflected Damage + case Being::FLEE: // Lucky Dodge if (dstBeing) { -// if (dstSpeed) -// dstBeing->setAttackDelay(dstSpeed); dstBeing->takeDamage(srcBeing, param1, static_cast(type)); } @@ -510,13 +499,13 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) const } break; - case 0x01: // dead + case 0x01: // dead break; // tmw server can send here garbage? // if (srcBeing) // srcBeing->setAction(Being::DEAD); - case 0x02: // Sit + case 0x02: // Sit if (srcBeing) { srcBeing->setAction(Being::SIT); @@ -529,7 +518,7 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) const } break; - case 0x03: // Stand up + case 0x03: // Stand up if (srcBeing) { srcBeing->setAction(Being::STAND); @@ -570,7 +559,7 @@ void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg) const //+++ need dehard code effectType == 3 if (effectType == 3 && being->getType() == Being::PLAYER && socialWindow) - { //reset received damage + { // reset received damage socialWindow->resetDamage(being->getName()); } } @@ -667,7 +656,7 @@ void BeingHandler::processPlayerGuilPartyInfo(Net::MessageIn &msg) const msg.skip(48); } dstBeing->addToCache(); - msg.readString(24); // Discard this + msg.readString(24); // Discard this } } @@ -681,7 +670,7 @@ void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg) const if (!dstBeing) return; - msg.readInt16(); // unused + msg.readInt16(); // unused const unsigned char dir = msg.readInt8() & 0x0f; dstBeing->setDirection(dir); @@ -741,7 +730,6 @@ void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg) const return; // Change in players' flags - const int id = msg.readInt32(); Being *const dstBeing = actorSpriteManager->findBeing(id); if (!dstBeing) @@ -750,7 +738,7 @@ void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg) const const uint16_t stunMode = msg.readInt16(); uint32_t statusEffects = msg.readInt16(); statusEffects |= (static_cast(msg.readInt16())) << 16; - msg.readInt8(); // Unused? + msg.readInt8(); // Unused? dstBeing->setStunMode(stunMode); dstBeing->setStatusEffectBlock(0, static_cast( @@ -767,7 +755,7 @@ void BeingHandler::processBeingStatusChange(Net::MessageIn &msg) const // Status change const uint16_t status = msg.readInt16(); const int id = msg.readInt32(); - const int flag = msg.readInt8(); // 0: stop, 1: start + const int flag = msg.readInt8(); // 0: stop, 1: start Being *const dstBeing = actorSpriteManager->findBeing(id); if (dstBeing) diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index a0d7d03dd..6a68355dd 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -179,4 +179,4 @@ void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) const } } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 3d665af22..354326e08 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -253,4 +253,4 @@ void CharServerHandler::processChangeMapServer(Net::MessageIn &msg, } } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 20c108229..872878511 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -131,7 +131,7 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) const if (player_relations.hasPermission(nick, PlayerRelation::TRADE)) { if (shopWindow) - { //commands to shop from player + { // commands to shop from player if (chatMsg.find("!selllist ") == 0) { if (tradeBot) @@ -336,7 +336,7 @@ void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat, void ChatHandler::processMVP(Net::MessageIn &msg) const { // Display MVP player - const int id = msg.readInt32(); // id + const int id = msg.readInt32(); // id if (localChatTab && actorSpriteManager && config.getBoolValue("showMVP")) { const Being *const being = actorSpriteManager->findBeing(id); @@ -390,4 +390,4 @@ void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) const } } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 4a011c6a8..0e159bd76 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -92,4 +92,4 @@ void GameHandler::initEngines() const Game::instance()->changeMap(mMap); } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp index 26f984a9a..0a1fb7314 100644 --- a/src/net/ea/gui/guildtab.cpp +++ b/src/net/ea/gui/guildtab.cpp @@ -165,4 +165,4 @@ void GuildTab::optionChanged(const std::string &value) mShowOnline = config.getBoolValue("showGuildOnline"); } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index fc59136e1..b8dd6aece 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -249,4 +249,4 @@ void PartyTab::playNewMessageSound() { soundManager.playGuiSound(SOUND_GUILD); } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 2d3861956..19f892ed5 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -100,8 +100,8 @@ void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const const int guildId = msg.readInt32(); const int emblem = msg.readInt32(); const int posMode = msg.readInt32(); - msg.readInt32(); // Unused - msg.readInt8(); // Unused + msg.readInt32(); // Unused + msg.readInt8(); // Unused std::string guildName = msg.readString(24); Guild *const g = Guild::getGuild(static_cast(guildId)); @@ -134,9 +134,9 @@ void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const void GuildHandler::processGuildMemberLogin(Net::MessageIn &msg) const { - const int accountId = msg.readInt32(); // Account ID - const int charId = msg.readInt32(); // Char ID - const int online = msg.readInt32(); // Flag + const int accountId = msg.readInt32(); // Account ID + const int charId = msg.readInt32(); // Char ID + const int online = msg.readInt32(); // Flag if (taGuild) { GuildMember *const m = taGuild->getMember(accountId, charId); @@ -151,20 +151,20 @@ void GuildHandler::processGuildMemberLogin(Net::MessageIn &msg) const void GuildHandler::processGuildMasterOrMember(Net::MessageIn &msg) const { - msg.readInt32(); // Type (0x57 for member, 0xd7 for master) + msg.readInt32(); // Type (0x57 for member, 0xd7 for master) } void GuildHandler::processGuildBasicInfo(Net::MessageIn &msg) { - const int guildId = msg.readInt32(); // Guild ID - const int level = msg.readInt32(); // Guild level - const int members = msg.readInt32(); // 'Connect member' - const int maxMembers = msg.readInt32(); // 'Max member' - const int avgLevel = msg.readInt32(); // Average level - const int exp = msg.readInt32(); // Exp - const int nextExp = msg.readInt32(); // Next exp - msg.skip(16); // 0 unused - std::string name = msg.readString(24); // Name + const int guildId = msg.readInt32(); // Guild ID + const int level = msg.readInt32(); // Guild level + const int members = msg.readInt32(); // 'Connect member' + const int maxMembers = msg.readInt32(); // 'Max member' + const int avgLevel = msg.readInt32(); // Average level + const int exp = msg.readInt32(); // Exp + const int nextExp = msg.readInt32(); // Next exp + msg.skip(16); // 0 unused + std::string name = msg.readString(24); // Name std::string master = msg.readString(24); // Master's name std::string castle = msg.readString(20); // Castles // (ie: "Six Castles" or "None Taken") @@ -205,9 +205,9 @@ void GuildHandler::processGuildAlianceInfo(Net::MessageIn &msg) const for (int i = 0; i < count; i++) { - msg.readInt32(); // 'Opposition' - msg.readInt32(); // Other guild ID - msg.readString(24); // Other guild name + msg.readInt32(); // 'Opposition' + msg.readInt32(); // Other guild ID + msg.readString(24); // Other guild name } } @@ -227,18 +227,18 @@ void GuildHandler::processGuildMemberList(Net::MessageIn &msg) const for (int i = 0; i < count; i++) { - const int id = msg.readInt32(); // Account ID - const int charId = msg.readInt32(); // Char ID - msg.readInt16(); // Hair - msg.readInt16(); // Hair color - const int gender = msg.readInt16(); // Gender - const int race = msg.readInt16(); // Class - const int level = msg.readInt16(); // Level - const int exp = msg.readInt32(); // Exp - const int online = msg.readInt32(); // Online - const int pos = msg.readInt32(); // Position - msg.skip(50); // 0 unused - std::string name = msg.readString(24); // Name + const int id = msg.readInt32(); // Account ID + const int charId = msg.readInt32(); // Char ID + msg.readInt16(); // Hair + msg.readInt16(); // Hair color + const int gender = msg.readInt16(); // Gender + const int race = msg.readInt16(); // Class + const int level = msg.readInt16(); // Level + const int exp = msg.readInt32(); // Exp + const int online = msg.readInt32(); // Online + const int pos = msg.readInt32(); // Position + msg.skip(50); // 0 unused + std::string name = msg.readString(24); // Name GuildMember *const m = taGuild->addMember(id, charId, name); if (m) @@ -290,8 +290,8 @@ void GuildHandler::processGuildPosNameList(Net::MessageIn &msg) const for (int i = 0; i < count; i++) { - const int id = msg.readInt32(); // ID - const std::string name = msg.readString(24); // Position name + const int id = msg.readInt32(); // ID + const std::string name = msg.readString(24); // Position name taGuild->addPos(id, name); } } @@ -305,29 +305,29 @@ void GuildHandler::processGuildPosInfoList(Net::MessageIn &msg) const for (int i = 0; i < count; i++) { - msg.readInt32(); // ID - msg.readInt32(); // Mode - msg.readInt32(); // Same ID - msg.readInt32(); // Exp mode + msg.readInt32(); // ID + msg.readInt32(); // Mode + msg.readInt32(); // Same ID + msg.readInt32(); // Exp mode } } void GuildHandler::processGuildPositionChanged(Net::MessageIn &msg) const { - msg.readInt16(); // Always 44 - msg.readInt32(); // ID - msg.readInt32(); // Mode - msg.readInt32(); // Same ID - msg.readInt32(); // Exp mode - msg.readString(24); // Name + msg.readInt16(); // Always 44 + msg.readInt32(); // ID + msg.readInt32(); // Mode + msg.readInt32(); // Same ID + msg.readInt32(); // Exp mode + msg.readString(24); // Name } void GuildHandler::processGuildMemberPosChange(Net::MessageIn &msg) const { - msg.readInt16(); // Always 16 - const int accountId = msg.readInt32(); // Account ID - const int charId = msg.readInt32(); // Char ID - const int pos = msg.readInt32(); // Position + msg.readInt16(); // Always 16 + const int accountId = msg.readInt32(); // Account ID + const int charId = msg.readInt32(); // Char ID + const int pos = msg.readInt32(); // Position if (taGuild) { GuildMember *const m = taGuild->getMember(accountId, charId); @@ -340,11 +340,11 @@ void GuildHandler::processGuildEmblem(Net::MessageIn &msg) const { const int length = msg.readInt16(); - msg.readInt32(); // Guild ID - msg.readInt32(); // Emblem ID + msg.readInt32(); // Guild ID + msg.readInt32(); // Emblem ID if (length < 12) return; - msg.skip(length - 12); // Emblem data (unknown format) + msg.skip(length - 12); // Emblem data (unknown format) } void GuildHandler::processGuildSkillInfo(Net::MessageIn &msg) const @@ -352,27 +352,27 @@ void GuildHandler::processGuildSkillInfo(Net::MessageIn &msg) const const int length = msg.readInt16(); const int count = (length - 6) / 37; - msg.readInt16(); // 'Skill point' + msg.readInt16(); // 'Skill point' if (length < 6) return; for (int i = 0; i < count; i++) { - msg.readInt16(); // ID - msg.readInt16(); // 'Info' (unknown atm) - msg.readInt16(); // 0 unused - msg.readInt16(); // Level - msg.readInt16(); // SP - msg.readInt16(); // 'Range' - msg.skip(24); // 0 unused - msg.readInt8(); // Can be increased + msg.readInt16(); // ID + msg.readInt16(); // 'Info' (unknown atm) + msg.readInt16(); // 0 unused + msg.readInt16(); // Level + msg.readInt16(); // SP + msg.readInt16(); // 'Range' + msg.skip(24); // 0 unused + msg.readInt8(); // Can be increased } } void GuildHandler::processGuildNotice(Net::MessageIn &msg) const { - const std::string msg1 = msg.readString(60); // Mes1 - const std::string msg2 = msg.readString(120); // Mes2 + const std::string msg1 = msg.readString(60); // Mes1 + const std::string msg2 = msg.readString(120); // Mes2 if (guildTab) { guildTab->chatLog(msg1, BY_SERVER); @@ -421,8 +421,8 @@ void GuildHandler::processGuildInviteAck(Net::MessageIn &msg) const void GuildHandler::processGuildLeave(Net::MessageIn &msg) const { - const std::string nick = msg.readString(24); // Name - msg.readString(40); // Message + const std::string nick = msg.readString(24); // Name + msg.readString(40); // Message if (taGuild) taGuild->removeMember(nick); @@ -465,9 +465,9 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg) const void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) const { msg.skip(2); // size (can be many explusions in list) - const std::string nick = msg.readString(24); // Name (of expulsed?) - msg.skip(24); // acc - msg.readString(44); // Message + const std::string nick = msg.readString(24); // Name (of expulsed?) + msg.skip(24); // acc + msg.readString(44); // Message if (taGuild) taGuild->removeMember(nick); @@ -516,9 +516,9 @@ void GuildHandler::processGuildExpulsionList(Net::MessageIn &msg) const for (int i = 0; i < count; i++) { - msg.readString(24); // Name (of expulsed?) - msg.readString(24); // 'Acc' (name of expulser?) - msg.readString(24); // Message + msg.readString(24); // Name (of expulsed?) + msg.readString(24); // 'Acc' (name of expulser?) + msg.readString(24); // Message } } @@ -548,38 +548,38 @@ void GuildHandler::processGuildMessage(Net::MessageIn &msg) const void GuildHandler::processGuildSkillUp(Net::MessageIn &msg) const { - msg.readInt16(); // Skill ID - msg.readInt16(); // Level - msg.readInt16(); // SP - msg.readInt16(); // 'Range' - msg.readInt8(); // unused? (always 1) + msg.readInt16(); // Skill ID + msg.readInt16(); // Level + msg.readInt16(); // SP + msg.readInt16(); // 'Range' + msg.readInt8(); // unused? (always 1) } void GuildHandler::processGuildReqAlliance(Net::MessageIn &msg) const { - msg.readInt32(); // Account ID - msg.readString(24); // Name + msg.readInt32(); // Account ID + msg.readString(24); // Name } void GuildHandler::processGuildReqAllianceAck(Net::MessageIn &msg) const { - msg.readInt32(); // Flag + msg.readInt32(); // Flag } void GuildHandler::processGuildDelAlliance(Net::MessageIn &msg) const { - msg.readInt32(); // Guild ID - msg.readInt32(); // Flag + msg.readInt32(); // Guild ID + msg.readInt32(); // Flag } void GuildHandler::processGuildOppositionAck(Net::MessageIn &msg) const { - msg.readInt8(); // Flag + msg.readInt8(); // Flag } void GuildHandler::processGuildBroken(Net::MessageIn &msg) const { - msg.readInt32(); // Flag + msg.readInt32(); // Flag } void GuildHandler::clear() const @@ -592,4 +592,4 @@ ChatTab *GuildHandler::getTab() const return guildTab; } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 6f5da6106..21087d355 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -121,11 +121,11 @@ size_t InventoryHandler::getSize(const int type) const case Inventory::INVENTORY: return 100; case Inventory::STORAGE: - return 0; // Comes from server after items + return 0; // Comes from server after items case Inventory::TRADE: return 12; case GUILD_STORAGE: - return 0; // Comes from server after items + return 0; // Comes from server after items default: return 0; } @@ -279,9 +279,9 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) msg.readInt8(); // attribute const int refine = msg.readInt8(); for (int i = 0; i < 4; i++) - msg.readInt16(); // cards[i] + msg.readInt16(); // cards[i] const int equipType = msg.readInt16(); - msg.readInt8(); // itemType + msg.readInt8(); // itemType const ItemInfo &itemInfo = ItemDB::get(itemId); const unsigned char err = msg.readInt8(); @@ -351,7 +351,7 @@ void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg) const ? PlayerInfo::getInventory() : nullptr; const int index = msg.readInt16() - INVENTORY_OFFSET; - msg.readInt16(); // item id + msg.readInt16(); // item id msg.readInt32(); // id const int amount = msg.readInt16(); msg.readInt8(); // type @@ -402,8 +402,8 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg) * server. It always comes after the two SMSG_PLAYER_STORAGE_... * packets that update storage contents. */ - msg.readInt16(); // Used count - const int size = msg.readInt16(); // Max size + msg.readInt16(); // Used count + const int size = msg.readInt16(); // Max size if (!mStorage) mStorage = new Inventory(Inventory::STORAGE, size); @@ -429,7 +429,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) msg.readInt8(); // attribute const int refine = msg.readInt8(); for (int i = 0; i < 4; i++) - msg.readInt16(); // card i + msg.readInt16(); // card i if (Item *const item = mStorage->getItem(index)) { @@ -483,7 +483,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) Inventory *const inventory = player_node ? PlayerInfo::getInventory() : nullptr; - msg.readInt16(); // length + msg.readInt16(); // length Equipment *const equipment = PlayerInfo::getEquipment(); if (equipment && !equipment->getBackend()) { // look like SMSG_PLAYER_INVENTORY was not received @@ -499,11 +499,11 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) const int itemType = msg.readInt8(); // type unsigned char identified = msg.readInt8(); // identify flag - msg.readInt16(); // equip type + msg.readInt16(); // equip type const int equipType = msg.readInt16(); msg.readInt8(); // attribute const int refine = msg.readInt8(); - msg.skip(8); // card + msg.skip(8); // card if (mDebugInventory) { @@ -522,7 +522,6 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) if (equipType) mEquips.setEquipment(getSlot(equipType), index); - } } @@ -540,7 +539,7 @@ void InventoryHandler::processPlayerEquip(Net::MessageIn &msg) void InventoryHandler::processPlayerUnEquip(Net::MessageIn &msg) { - msg.readInt16(); // inder val - INVENTORY_OFFSET; + msg.readInt16(); // inder val - INVENTORY_OFFSET; const int equipType = msg.readInt16(); const int flag = msg.readInt8(); @@ -573,4 +572,4 @@ void InventoryHandler::processPlayerArrowEquip(Net::MessageIn &msg) miniStatusWindow->updateArrows(); } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp index 3e7cfc747..6c7124e30 100644 --- a/src/net/ea/itemhandler.cpp +++ b/src/net/ea/itemhandler.cpp @@ -81,4 +81,4 @@ void ItemHandler::processItemRemove(Net::MessageIn &msg) } } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 33c9ec45f..f94771eec 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -63,7 +63,6 @@ void LoginHandler::getRegistrationDetails() const void LoginHandler::loginAccount(LoginData *const loginData) const { - if (loginData) { // Since we're attempting to use the tAthena protocol, @@ -277,19 +276,16 @@ void LoginHandler::processLoginError(Net::MessageIn &msg) const void LoginHandler::logout() const { - // TODO } void LoginHandler::changeEmail(const std::string &email A_UNUSED) const { - // TODO } void LoginHandler::unregisterAccount(const std::string &username A_UNUSED, const std::string &password A_UNUSED) const { - // TODO } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index c7441d579..112e16891 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -318,7 +318,7 @@ void Network::setError(const std::string &error) uint16_t Network::readWord(const int pos) const { #if SDL_BYTEORDER == SDL_BIG_ENDIAN - return SDL_Swap16((*(uint16_t*)(mInBuffer + (pos)))); + return SDL_Swap16(*reinterpret_cast(mInBuffer + (pos))); #else return (*reinterpret_cast(mInBuffer + (pos))); #endif @@ -335,4 +335,4 @@ void Network::fixSendBuffer() } } -} // namespace EAthena +} // namespace Ea diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp index 9f8e5b87f..cacb65548 100644 --- a/src/net/ea/npchandler.cpp +++ b/src/net/ea/npchandler.cpp @@ -112,4 +112,4 @@ void NpcHandler::processNpcStrInput(Net::MessageIn &msg A_UNUSED) mDialog->textRequest(""); } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 642688ddb..0c00588ce 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -276,19 +276,19 @@ void PartyHandler::processPartyMove(Net::MessageIn &msg) const m->setX(msg.readInt16()); // x m->setY(msg.readInt16()); // y m->setOnline(msg.readInt8()); // online (if 0) - msg.readString(24); // party - msg.readString(24); // nick + msg.readString(24); // party + msg.readString(24); // nick m->setMap(msg.readString(16)); // map } else { - msg.skip(4); // 0 - msg.readInt16(); // x - msg.readInt16(); // y - msg.readInt8(); // online (if 0) - msg.readString(24); // party - msg.readString(24); // nick - msg.readString(16); // map + msg.skip(4); // 0 + msg.readInt16(); // x + msg.readInt16(); // y + msg.readInt8(); // online (if 0) + msg.readString(24); // party + msg.readString(24); // nick + msg.readString(16); // map } } @@ -353,11 +353,11 @@ void PartyHandler::processPartyUpdateHp(Net::MessageIn &msg) const if (Being *const b = actorSpriteManager->findBeing(id)) b->setParty(Ea::taParty); } -} +} void PartyHandler::processPartyUpdateCoords(Net::MessageIn &msg) const { - const int id = msg.readInt32(); // id + const int id = msg.readInt32(); // id PartyMember *m = nullptr; if (Ea::taParty) m = Ea::taParty->getMember(id); @@ -402,4 +402,4 @@ ChatTab *PartyHandler::getTab() return partyTab; } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 72de30304..1073d5075 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -86,7 +86,7 @@ namespace } } deathListener; -} // anonymous namespace +} // anonymous namespace static const char *randomDeathMessage() { @@ -177,7 +177,7 @@ void PlayerHandler::processWalkResponse(Net::MessageIn &msg) const * otherwise. */ uint16_t srcX, srcY, dstX, dstY; - msg.readInt32(); //tick + msg.readInt32(); // tick msg.readCoordinatePair(srcX, srcY, dstX, dstY); if (player_node) player_node->setRealPos(dstX, dstY); @@ -271,7 +271,8 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) const PlayerInfo::setStatBase(PlayerInfo::WALK_SPEED, value); PlayerInfo::setStatMod(PlayerInfo::WALK_SPEED, 0); break; - case 0x0004: break; // manner + case 0x0004: + break; // manner case 0x0005: PlayerInfo::setAttribute(PlayerInfo::HP, value); if (player_node->isInParty() && Party::getParty(1)) @@ -644,4 +645,4 @@ int PlayerHandler::getAttackLocation() const return EA_ATK; } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index 1e517a729..0a3054527 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -83,9 +83,9 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) const msg.readInt16(); // target type msg.skip(2); // skill pool flags const int level = msg.readInt16(); - msg.readInt16(); // sp + msg.readInt16(); // sp const int range = msg.readInt16(); - msg.skip(24); // 0 unused + msg.skip(24); // 0 unused const int up = msg.readInt8(); const int oldLevel = PlayerInfo::getSkillLevel(skillId); if (oldLevel && oldLevel != level) @@ -105,7 +105,7 @@ void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) const { const int skillId = msg.readInt16(); const int level = msg.readInt16(); - msg.readInt16(); // sp + msg.readInt16(); // sp const int range = msg.readInt16(); const int up = msg.readInt8(); @@ -125,7 +125,7 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg) const // right level) const int skillId = msg.readInt16(); const short bskill = msg.readInt16(); - msg.readInt16(); // btype + msg.readInt16(); // btype const signed char success = msg.readInt8(); const signed char reason = msg.readInt8(); if (success != static_cast(SKILL_FAILED) @@ -234,4 +234,4 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg) const NotifyManager::notify(NotifyManager::SKILL_FAIL_MESSAGE, txt); } -} // namespace Ea +} // namespace Ea diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index b4aca1041..1da4271b1 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -57,7 +57,7 @@ namespace Net::getTradeHandler()->respond(eventId == "yes"); } } listener; -} +} // anonimous namespace Ea { @@ -130,18 +130,18 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg) switch (msg.readInt8()) { - case 0: // Too far away + case 0: // Too far away NotifyManager::notify(NotifyManager::TRADE_FAIL_FAR_AWAY, tradePartnerName); break; - case 1: // Character doesn't exist + case 1: // Character doesn't exist NotifyManager::notify(NotifyManager::TRADE_FAIL_CHAR_NOT_EXISTS, tradePartnerName); break; - case 2: // Invite request check failed... + case 2: // Invite request check failed... NotifyManager::notify(NotifyManager::TRADE_CANCELLED_ERROR); break; - case 3: // Trade accepted + case 3: // Trade accepted if (tradeWindow) { tradeWindow->reset(); @@ -151,7 +151,7 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg) tradeWindow->setVisible(true); } break; - case 4: // Trade cancelled + case 4: // Trade cancelled if (player_relations.hasPermission(tradePartnerName, PlayerRelation::SPEECH_LOG)) { @@ -167,7 +167,7 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg) } PlayerInfo::setTrading(false); break; - default: // Shouldn't happen as well, but to be sure + default: // Shouldn't happen as well, but to be sure NotifyManager::notify(NotifyManager::TRADE_ERROR_UNKNOWN, tradePartnerName); if (tradeWindow) @@ -284,4 +284,4 @@ void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED) PlayerInfo::setTrading(false); } -} // namespace Ea +} // namespace Ea diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 615cffa28..4661cd5b8 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -85,7 +85,7 @@ void AdminHandler::localAnnounce(const std::string &text) const void AdminHandler::hide(const bool h A_UNUSED) const { MessageOut outMsg(CMSG_ADMIN_HIDE); - outMsg.writeInt32(0); //unused + outMsg.writeInt32(0); // unused } void AdminHandler::kick(const int playerId) const @@ -94,4 +94,4 @@ void AdminHandler::kick(const int playerId) const outMsg.writeInt32(playerId); } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 6fb7ee087..6de4bf1b7 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -102,14 +102,14 @@ BeingHandler::BeingHandler(bool enableSync): void BeingHandler::requestNameById(const int id) const { MessageOut outMsg(0x0094); - outMsg.writeInt32(id); //readLong(2)); + outMsg.writeInt32(id); // readLong(2)); } void BeingHandler::handleMessage(Net::MessageIn &msg) { switch (msg.getId()) { - case SMSG_BEING_VISIBLE: // changed + case SMSG_BEING_VISIBLE: // changed case SMSG_BEING_MOVE: processBeingVisibleOrMove(msg, msg.getId() == SMSG_BEING_VISIBLE); break; @@ -118,7 +118,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) processBeingMove2(msg); break; - case SMSG_BEING_SPAWN: // changed + case SMSG_BEING_SPAWN: // changed processBeingSpawn(msg); break; @@ -433,10 +433,10 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, // An update about a player, potentially including movement. const int id = msg.readInt32(); const short speed = msg.readInt16(); - const uint16_t stunMode = msg.readInt16(); // opt1 - uint32_t statusEffects = msg.readInt16(); // opt2 + const uint16_t stunMode = msg.readInt16(); // opt1 + uint32_t statusEffects = msg.readInt16(); // opt2 statusEffects |= (static_cast(msg.readInt16())) - << 16; // status.options; Aethyra uses this as misc2 + << 16; // status.options; Aethyra uses this as misc2 const short job = msg.readInt16(); Being *dstBeing = actorSpriteManager->findBeing(id); @@ -474,7 +474,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, const uint16_t headBottom = msg.readInt16(); if (msgType == 3) - msg.readInt32(); // server tick + msg.readInt32(); // server tick const uint16_t headTop = msg.readInt16(); const uint16_t headMid = msg.readInt16(); @@ -483,9 +483,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, msg.readInt8(); msg.readInt8(); msg.readInt8(); - msg.readInt8(); //unused -// shoes = msg.readInt16(); -// gloves = msg.readInt16(); //sd->head_dir + msg.readInt8(); // unused const int guild = msg.readInt32(); // guild @@ -508,14 +506,9 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, dstBeing->setSprite(SPRITE_WEAPON, weapon, "", 1, true); if (!mHideShield) dstBeing->setSprite(SPRITE_SHIELD, shield); - //dstBeing->setSprite(SPRITE_SHOE, shoes); dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid); dstBeing->setSprite(SPRITE_HAT, headTop); - //dstBeing->setSprite(SPRITE_GLOVES, gloves); - //dstBeing->setSprite(SPRITE_CAPE, cape); - //dstBeing->setSprite(SPRITE_MISC1, misc1); - //dstBeing->setSprite(SPRITE_MISC2, misc2); dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); @@ -552,7 +545,6 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, } else { -// uint8_t dir; uint16_t x, y; msg.readCoordinates(x, y, dir); dstBeing->setTileCoords(x, y); @@ -590,7 +582,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, break; default: - //need set stay state? + // need set stay state? logger->log("QQQ2 SMSG_PLAYER_UPDATE_1:" + toString(id) + " " + toString(type)); logger->log("dstBeing id:" + toString(dstBeing->getId())); @@ -601,21 +593,20 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, } else if (msgType == 3) { - msg.readInt8(); // unknown + msg.readInt8(); // unknown } - const int level = msg.readInt8(); // Lv + const int level = msg.readInt8(); // Lv if (level) dstBeing->setLevel(level); - msg.readInt8(); // unknown + msg.readInt8(); // unknown if (dstBeing->getType() != Being::PLAYER || msgType != 3) { dstBeing->setActionTime(tick_time); -// dstBeing->reset(); } dstBeing->setStunMode(stunMode); @@ -634,7 +625,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, return; if (visible) - msg.readInt8(); // padding? + msg.readInt8(); // padding? // Information about a being in range const int id = msg.readInt32(); @@ -646,7 +637,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, mSpawnId = 0; short speed = msg.readInt16(); const uint16_t stunMode = msg.readInt16(); // opt1 - uint32_t statusEffects = msg.readInt16(); // opt2 + uint32_t statusEffects = msg.readInt16(); // opt2 statusEffects |= (static_cast(msg.readInt16())) << 16; // option const short job = msg.readInt16(); // class @@ -712,14 +703,11 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, const uint16_t weapon = msg.readInt16(); const uint16_t headBottom = msg.readInt16(); -// if (!visible) -// msg.readInt32(); // server tick - const uint16_t shield = msg.readInt16(); const uint16_t headTop = msg.readInt16(); const uint16_t headMid = msg.readInt16(); const int hairColor = msg.readInt16(); - const uint16_t shoes = msg.readInt16(); //clothes color - "abused" as shoes + const uint16_t shoes = msg.readInt16(); // clothes color uint16_t gloves; if (dstBeing->getType() == ActorSprite::MONSTER) @@ -731,24 +719,15 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, else { gloves = msg.readInt16(); // head dir - "abused" as gloves - msg.readInt32(); // guild - msg.readInt16(); // guild emblem + msg.readInt32(); // guild + msg.readInt16(); // guild emblem } -// logger->log("being guild: " + toString(guild)); -/* - if (guild == 0) - dstBeing->clearGuilds(); - else - dstBeing->setGuild(Guild::getGuild(static_cast(guild))); -*/ msg.readInt16(); // manner dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3 msg.readInt8(); // karma short gender = msg.readInt8(); - // reserving bits for future usage - if (dstBeing->getType() == ActorSprite::PLAYER) { gender &= 3; @@ -818,13 +797,12 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, msg.readInt8(); // unknown msg.readInt8(); // state / sit - msg.readInt16(); // level + msg.readInt16(); // level dstBeing->setStunMode(stunMode); dstBeing->setStatusEffectBlock(0, static_cast( (statusEffects >> 16) & 0xffff)); dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff); - } } // namespace EAthena diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp index b96d2c382..0b1c4ad06 100644 --- a/src/net/eathena/buysellhandler.cpp +++ b/src/net/eathena/buysellhandler.cpp @@ -95,7 +95,6 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg) default: break; } - } void BuySellHandler::processNpcBuy(Net::MessageIn &msg) @@ -110,7 +109,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg) { const int value = msg.readInt32(); msg.readInt32(); // DCvalue - msg.readInt8(); // type + msg.readInt8(); // type const int itemId = msg.readInt16(); const unsigned char color = 1; mBuyDialog->addItem(itemId, color, 0, value); @@ -137,4 +136,4 @@ void BuySellHandler::processNpcSellResponse(Net::MessageIn &msg) const } } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index ca4275ebe..ffb83ea73 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -154,8 +154,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, data.mAttributes[PlayerInfo::MP] = msg.readInt16(); data.mAttributes[PlayerInfo::MAX_MP] = msg.readInt16(); - msg.readInt16(); // speed - tempPlayer->setSubtype(msg.readInt16()); // class (used for race) + msg.readInt16(); // speed + tempPlayer->setSubtype(msg.readInt16()); // class (used for race) const int hairStyle = msg.readInt16(); const uint16_t weapon = msg.readInt16(); @@ -163,11 +163,11 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, data.mAttributes[PlayerInfo::LEVEL] = msg.readInt16(); - msg.readInt16(); // skill point + msg.readInt16(); // skill point const int bottomClothes = msg.readInt16(); const int shield = msg.readInt16(); - const int hat = msg.readInt16(); // head option top + const int hat = msg.readInt16(); // head option top const int topClothes = msg.readInt16(); tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1, @@ -186,16 +186,16 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, tempPlayer->setSprite(SPRITE_CAPE, cape); tempPlayer->setSprite(SPRITE_MISC1, misc1); tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes); - //to avoid show error (error.xml) need remove this sprite + // to avoid show error (error.xml) need remove this sprite if (!config.getBoolValue("hideShield")) tempPlayer->setSprite(SPRITE_SHIELD, shield); - tempPlayer->setSprite(SPRITE_HAT, hat); // head option top + tempPlayer->setSprite(SPRITE_HAT, hat); // head option top tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes); tempPlayer->setSprite(SPRITE_MISC2, misc2); - character->slot = msg.readInt8(); // character slot + character->slot = msg.readInt8(); // character slot - msg.readInt8(); // unknown + msg.readInt8(); // unknown } void CharServerHandler::chooseCharacter(Net::Character *const character) @@ -273,7 +273,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg) if (slots > 0 && slots < 30) loginData.characterSlots = static_cast(slots); - msg.skip(18); // 0 Unused + msg.skip(18); // 0 Unused delete_all(mCharacters); mCharacters.clear(); @@ -296,4 +296,4 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg) Client::setState(STATE_CHAR_SELECT); } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index ae13a47b7..940227b3c 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -55,7 +55,7 @@ ChatHandler::ChatHandler() : SMSG_WHISPER, SMSG_WHISPER_RESPONSE, SMSG_GM_CHAT, - SMSG_MVP, // MVP + SMSG_MVP, // MVP SMSG_IGNORE_ALL_RESPONSE, 0 }; @@ -261,4 +261,4 @@ void ChatHandler::unIgnoreAll() const outMsg.writeInt8(1); } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index 00cfcc827..74f2a89ea 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -171,7 +171,7 @@ void GameHandler::disconnect2() const void GameHandler::processMapCharId(Net::MessageIn &msg) { - msg.readInt32(); // char id + msg.readInt32(); // char id } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index 637bd7369..b75044bb3 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -285,4 +285,4 @@ void GeneralHandler::gameEnded() const Ea::partyTab = nullptr; } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/gui/guildtab.cpp b/src/net/eathena/gui/guildtab.cpp index e3cf1b662..f946e1f8e 100644 --- a/src/net/eathena/gui/guildtab.cpp +++ b/src/net/eathena/gui/guildtab.cpp @@ -47,4 +47,4 @@ GuildTab::~GuildTab() { } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/gui/partytab.cpp b/src/net/eathena/gui/partytab.cpp index bf40c3e01..157869a96 100644 --- a/src/net/eathena/gui/partytab.cpp +++ b/src/net/eathena/gui/partytab.cpp @@ -50,4 +50,4 @@ PartyTab::~PartyTab() { } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index 481a74236..e9d4109dc 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -194,7 +194,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) void GuildHandler::create(const std::string &name) const { MessageOut msg(CMSG_GUILD_CREATE); - msg.writeInt32(0); // Unused + msg.writeInt32(0); // unused msg.writeString(name, 24); } @@ -210,8 +210,8 @@ void GuildHandler::invite(const int guildId A_UNUSED, { MessageOut msg(CMSG_GUILD_INVITE); msg.writeInt32(being->getId()); - msg.writeInt32(0); // Unused - msg.writeInt32(0); // Unused + msg.writeInt32(0); // unused + msg.writeInt32(0); // unused } } @@ -223,8 +223,8 @@ void GuildHandler::invite(const int guildId A_UNUSED, MessageOut msg(CMSG_GUILD_INVITE); msg.writeInt32(being->getId()); - msg.writeInt32(0); // Unused - msg.writeInt32(0); // Unused + msg.writeInt32(0); // unused + msg.writeInt32(0); // unused } void GuildHandler::inviteResponse(const int guildId, @@ -233,8 +233,8 @@ void GuildHandler::inviteResponse(const int guildId, MessageOut msg(CMSG_GUILD_INVITE_REPLY); msg.writeInt32(guildId); msg.writeInt8(response); - msg.writeInt8(0); // Unused - msg.writeInt16(0); // Unused + msg.writeInt8(0); // unused + msg.writeInt16(0); // unused } void GuildHandler::leave(const int guildId) const @@ -244,9 +244,9 @@ void GuildHandler::leave(const int guildId) const MessageOut msg(CMSG_GUILD_LEAVE); msg.writeInt32(guildId); - msg.writeInt32(player_node->getId()); // Account ID + msg.writeInt32(player_node->getId()); // Account ID msg.writeInt32(PlayerInfo::getCharId()); // Char ID - msg.writeString("", 40); // Message + msg.writeString("", 40); // Message } void GuildHandler::kick(const GuildMember *const member, @@ -257,9 +257,9 @@ void GuildHandler::kick(const GuildMember *const member, MessageOut msg(CMSG_GUILD_EXPULSION); msg.writeInt32(member->getGuild()->getId()); - msg.writeInt32(member->getID()); // Account ID - msg.writeInt32(member->getCharId()); // Char ID - msg.writeString(reason, 40); // Message + msg.writeInt32(member->getID()); // Account ID + msg.writeInt32(member->getCharId()); // Char ID + msg.writeString(reason, 40); // Message } void GuildHandler::chat(const int guildId A_UNUSED, @@ -285,7 +285,7 @@ void GuildHandler::memberList(const int guildId A_UNUSED) const // 4 = expulsion list MessageOut msg(CMSG_GUILD_REQUEST_INFO); - msg.writeInt32(1); // Request member list + msg.writeInt32(1); // Request member list } void GuildHandler::info(const int guildId A_UNUSED) @@ -299,7 +299,7 @@ void GuildHandler::info(const int guildId A_UNUSED) showBasicInfo = true; MessageOut msg(CMSG_GUILD_REQUEST_INFO); - msg.writeInt32(0); // Request basic info + msg.writeInt32(0); // Request basic info } void GuildHandler::changeMemberPostion(const GuildMember *const member, @@ -309,10 +309,10 @@ void GuildHandler::changeMemberPostion(const GuildMember *const member, return; MessageOut msg(CMSG_GUILD_CHANGE_MEMBER_POS); - msg.writeInt16(16); // size less then 16 <= 4 + 12 - msg.writeInt32(member->getID()); // Account ID - msg.writeInt32(member->getCharId()); // Char ID - msg.writeInt32(level); // pos + msg.writeInt16(16); // size less then 16 <= 4 + 12 + msg.writeInt32(member->getID()); // Account ID + msg.writeInt32(member->getCharId()); // Char ID + msg.writeInt32(level); // pos } void GuildHandler::changeNotice(const int guildId, const std::string &msg1, @@ -320,8 +320,8 @@ void GuildHandler::changeNotice(const int guildId, const std::string &msg1, { MessageOut msg(CMSG_GUILD_CHANGE_NOTICE); msg.writeInt32(guildId); - msg.writeString(msg1, 60); // msg1 - msg.writeString(msg2, 120); // msg2 + msg.writeString(msg1, 60); // msg1 + msg.writeString(msg2, 120); // msg2 } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index 79219cb42..b19419407 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -164,7 +164,7 @@ void InventoryHandler::useItem(const Item *const item) const MessageOut outMsg(CMSG_PLAYER_INVENTORY_USE); outMsg.writeInt16(static_cast( item->getInvIndex() + INVENTORY_OFFSET)); - outMsg.writeInt32(item->getId()); // unused + outMsg.writeInt32(item->getId()); // unused } void InventoryHandler::dropItem(const Item *const item, const int amount) const @@ -202,4 +202,4 @@ void InventoryHandler::moveItem2(const int source, const int slot, } } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/itemhandler.cpp b/src/net/eathena/itemhandler.cpp index 0e2a1e003..c1f157160 100644 --- a/src/net/eathena/itemhandler.cpp +++ b/src/net/eathena/itemhandler.cpp @@ -64,4 +64,4 @@ void ItemHandler::handleMessage(Net::MessageIn &msg) } } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index cda6c0c1a..91900b623 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -133,7 +133,7 @@ void LoginHandler::sendLoginRegister(const std::string &username, const std::string &email A_UNUSED) const { MessageOut outMsg(0x0064); - outMsg.writeInt32(0); // client version + outMsg.writeInt32(0); // client version outMsg.writeString(username, 24); outMsg.writeStringNoLog(password, 24); @@ -197,4 +197,4 @@ void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const Client::setState(STATE_LOGIN); } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/messagehandler.cpp b/src/net/eathena/messagehandler.cpp index 1a031c4b2..791660283 100644 --- a/src/net/eathena/messagehandler.cpp +++ b/src/net/eathena/messagehandler.cpp @@ -48,4 +48,4 @@ void MessageHandler::setNetwork(Network *network) mNetwork = network; } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/messagein.cpp b/src/net/eathena/messagein.cpp index cb5f2ecfd..1acbd4665 100644 --- a/src/net/eathena/messagein.cpp +++ b/src/net/eathena/messagein.cpp @@ -33,7 +33,7 @@ #include "debug.h" -namespace EAthena +namespace EAthena { MessageIn::MessageIn(const char *const data, const unsigned int length) : @@ -81,4 +81,4 @@ int32_t MessageIn::readInt32() return value; } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp index 734ce4057..210717503 100644 --- a/src/net/eathena/messageout.cpp +++ b/src/net/eathena/messageout.cpp @@ -143,4 +143,4 @@ void MessageOut::writeCoordinates(const unsigned short x, PacketCounters::incOutBytes(3); } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index e03554ee2..42d16396d 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -241,4 +241,4 @@ Network *Network::instance() return mInstance; } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index e2d5a003a..4730067fd 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -116,7 +116,7 @@ void NpcHandler::talk(const int npcId) const { MessageOut outMsg(CMSG_NPC_TALK); outMsg.writeInt32(npcId); - outMsg.writeInt8(0); // Unused + outMsg.writeInt8(0); // unused } void NpcHandler::nextDialog(const int npcId) const @@ -162,21 +162,21 @@ void NpcHandler::stringInput(const int npcId, const std::string &value) const outMsg.writeInt16(static_cast(value.length() + 9)); outMsg.writeInt32(npcId); outMsg.writeString(value, static_cast(value.length())); - outMsg.writeInt8(0); // Prevent problems with string reading + outMsg.writeInt8(0); // Prevent problems with string reading } void NpcHandler::buy(const int beingId) const { MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST); outMsg.writeInt32(beingId); - outMsg.writeInt8(0); // Buy + outMsg.writeInt8(0); // Buy } void NpcHandler::sell(const int beingId) const { MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST); outMsg.writeInt32(beingId); - outMsg.writeInt8(1); // Sell + outMsg.writeInt8(1); // Sell } void NpcHandler::buyItem(const int beingId A_UNUSED, const int itemId, @@ -184,7 +184,7 @@ void NpcHandler::buyItem(const int beingId A_UNUSED, const int itemId, const int amount) const { MessageOut outMsg(CMSG_NPC_BUY_REQUEST); - outMsg.writeInt16(8); // One item (length of packet) + outMsg.writeInt16(8); // One item (length of packet) outMsg.writeInt16(static_cast(amount)); outMsg.writeInt16(static_cast(itemId)); } @@ -193,7 +193,7 @@ void NpcHandler::sellItem(const int beingId A_UNUSED, const int itemId, const int amount) const { MessageOut outMsg(CMSG_NPC_SELL_REQUEST); - outMsg.writeInt16(8); // One item (length of packet) + outMsg.writeInt16(8); // One item (length of packet) outMsg.writeInt16(static_cast(itemId + INVENTORY_OFFSET)); outMsg.writeInt16(static_cast(amount)); } @@ -247,18 +247,18 @@ int NpcHandler::getNpc(Net::MessageIn &msg, const bool haveLength) void NpcHandler::processNpcCutin(Net::MessageIn &msg A_UNUSED, int npcId A_UNUSED) const { - msg.readString(64); // image name - msg.readInt8(); // type + msg.readString(64); // image name + msg.readInt8(); // type } void NpcHandler::processNpcViewPoint(Net::MessageIn &msg A_UNUSED, int npcId A_UNUSED) const { - msg.readInt32(); // type - msg.readInt32(); // x - msg.readInt32(); // y - msg.readInt8(); // byte - msg.readInt32(); // color + msg.readInt32(); // type + msg.readInt32(); // x + msg.readInt32(); // y + msg.readInt8(); // byte + msg.readInt32(); // color } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp index b128d3879..26e5ed981 100644 --- a/src/net/eathena/partyhandler.cpp +++ b/src/net/eathena/partyhandler.cpp @@ -153,7 +153,7 @@ void PartyHandler::kick(Being *const being) const { MessageOut outMsg(CMSG_PARTY_KICK); outMsg.writeInt32(being->getId()); - outMsg.writeString("", 24); //Unused + outMsg.writeString("", 24); // unused } } @@ -171,7 +171,7 @@ void PartyHandler::kick(const std::string &name) const MessageOut outMsg(CMSG_PARTY_KICK); outMsg.writeInt32(m->getID()); - outMsg.writeString(name, 24); //Unused + outMsg.writeString(name, 24); // unused } void PartyHandler::chat(const std::string &text) const @@ -201,4 +201,4 @@ void PartyHandler::setShareItems(const PartyShare share) const outMsg.writeInt16(share); } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 3d80c2e1e..c5f3c3a0f 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -81,11 +81,11 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) processPlayerStatUpdate2(msg); break; - case SMSG_PLAYER_STAT_UPDATE_3: // Update a base attribute + case SMSG_PLAYER_STAT_UPDATE_3: // Update a base attribute processPlayerStatUpdate3(msg); break; - case SMSG_PLAYER_STAT_UPDATE_4: // Attribute increase ack + case SMSG_PLAYER_STAT_UPDATE_4: // Attribute increase ack processPlayerStatUpdate4(msg); break; @@ -230,15 +230,15 @@ void PlayerHandler::processPlayerShortcuts(Net::MessageIn &msg) const { for (int f = 0; f < 27; f ++) { - msg.readInt8(); // type 0: item, 1: skill - msg.readInt32(); // item or skill id - msg.readInt16(); // lvl + msg.readInt8(); // type 0: item, 1: skill + msg.readInt32(); // item or skill id + msg.readInt16(); // lvl } } void PlayerHandler::processPlayerShowEquip(Net::MessageIn &msg) const { - msg.readInt8(); // show equip + msg.readInt8(); // show equip } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index 75aae7608..e14d89e4e 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -95,4 +95,4 @@ void SkillHandler::useMap(const int id, const std::string &map) const outMsg.writeString(map, 16); } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp index aa11b1233..df0364af5 100644 --- a/src/net/eathena/tradehandler.cpp +++ b/src/net/eathena/tradehandler.cpp @@ -144,4 +144,4 @@ void TradeHandler::cancel() const MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST); } -} // namespace EAthena +} // namespace EAthena diff --git a/src/net/gamehandler.h b/src/net/gamehandler.h index 89111d241..cd32b5420 100644 --- a/src/net/gamehandler.h +++ b/src/net/gamehandler.h @@ -63,6 +63,6 @@ class GameHandler virtual void clear() = 0; }; -} // namespace Net +} // namespace Net -#endif // MAPHANDLER_H +#endif // MAPHANDLER_H diff --git a/src/net/generalhandler.h b/src/net/generalhandler.h index a243d2c9b..3860267aa 100644 --- a/src/net/generalhandler.h +++ b/src/net/generalhandler.h @@ -49,6 +49,6 @@ class GeneralHandler virtual void gameEnded() const = 0; }; -} // namespace Net +} // namespace Net -#endif // GENERALHANDLER_H +#endif // GENERALHANDLER_H diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h index 23b4048cc..113b0d869 100644 --- a/src/net/guildhandler.h +++ b/src/net/guildhandler.h @@ -84,6 +84,6 @@ class GuildHandler virtual ChatTab *getTab() const = 0; }; -} +} // namespace Net -#endif // GUILDHANDLER_H +#endif // GUILDHANDLER_H diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h index 3b8a24aa5..48e6e7afe 100644 --- a/src/net/inventoryhandler.h +++ b/src/net/inventoryhandler.h @@ -69,6 +69,6 @@ class InventoryHandler virtual int convertFromServerSlot(const int eAthenaSlot) const = 0; }; -} // namespace Net +} // namespace Net -#endif // INVENTORYHANDLER_H +#endif // INVENTORYHANDLER_H diff --git a/src/net/logindata.h b/src/net/logindata.h index 76d4e3711..a88879310 100644 --- a/src/net/logindata.h +++ b/src/net/logindata.h @@ -107,4 +107,4 @@ class LoginData final } }; -#endif // LOGINDATA_H +#endif // LOGINDATA_H diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index fbac1ee79..e72c9f761 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.h @@ -110,6 +110,6 @@ class LoginHandler ServerInfo mServer; }; -} // namespace Net +} // namespace Net -#endif // LOGINHANDLER_H +#endif // LOGINHANDLER_H diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h index c2f4307b4..fdf552403 100644 --- a/src/net/messagehandler.h +++ b/src/net/messagehandler.h @@ -46,6 +46,6 @@ class MessageHandler { } }; -} +} // namespace Net -#endif // NET_MESSAGEHANDLER_H +#endif // NET_MESSAGEHANDLER_H diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index a833c6cde..4ea6c7415 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -247,7 +247,7 @@ unsigned char *MessageIn::readBytes(int length) unsigned char *const buf = new unsigned char[length + 2]; - memcpy (buf, mData + mPos, length); + memcpy(buf, mData + mPos, length); buf[length] = 0; buf[length + 1] = 0; mPos += length; @@ -271,4 +271,4 @@ unsigned char *MessageIn::readBytes(int length) return buf; } -} +} // namespace Net diff --git a/src/net/messagein.h b/src/net/messagein.h index 2f152924d..ecd6e2dea 100644 --- a/src/net/messagein.h +++ b/src/net/messagein.h @@ -126,6 +126,6 @@ class MessageIn unsigned int mPos; }; -} +} // namespace Net -#endif // NET_MESSAGEIN_H +#endif // NET_MESSAGEIN_H diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index 3c20bce00..76e2085ee 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -120,4 +120,4 @@ unsigned int MessageOut::getDataSize() const return mDataSize; } -} +} // namespace Net diff --git a/src/net/messageout.h b/src/net/messageout.h index 4fd647218..b69a91b75 100644 --- a/src/net/messageout.h +++ b/src/net/messageout.h @@ -95,6 +95,6 @@ class MessageOut unsigned int mPos; /**< Position in the data. */ }; -} +} // namespace Net -#endif // NET_MESSAGEOUT_H +#endif // NET_MESSAGEOUT_H diff --git a/src/net/net.cpp b/src/net/net.cpp index 8e997b35b..bb3160cda 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -214,4 +214,4 @@ ServerInfo::Type getNetworkType() return networkType; } -} // namespace Net +} // namespace Net diff --git a/src/net/net.h b/src/net/net.h index c2d19ac72..2d3c9995a 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -77,6 +77,6 @@ void connectToServer(const ServerInfo &server); void unload(); -} // namespace Net +} // namespace Net -#endif // NET_H +#endif // NET_H diff --git a/src/net/npchandler.h b/src/net/npchandler.h index 685e04c57..b1e954a26 100644 --- a/src/net/npchandler.h +++ b/src/net/npchandler.h @@ -69,6 +69,6 @@ class NpcHandler virtual void clearDialogs() = 0; }; -} // namespace Net +} // namespace Net -#endif // NPCHANDLER_H +#endif // NPCHANDLER_H diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h index 4929fc6da..54b30c106 100644 --- a/src/net/partyhandler.h +++ b/src/net/partyhandler.h @@ -80,6 +80,6 @@ class PartyHandler virtual ChatTab *getTab() = 0; }; -} // namespace Net +} // namespace Net -#endif // PARTYHANDLER_H +#endif // PARTYHANDLER_H diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index a536bbf18..ad3d50f4a 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.h @@ -79,6 +79,6 @@ class PlayerHandler virtual void updateStatus(const uint8_t status) const = 0; }; -} // namespace Net +} // namespace Net -#endif // PLAYERHANDLER_H +#endif // PLAYERHANDLER_H diff --git a/src/net/sdltcpnet.h b/src/net/sdltcpnet.h index eaa5801a5..c13b84063 100644 --- a/src/net/sdltcpnet.h +++ b/src/net/sdltcpnet.h @@ -57,6 +57,6 @@ namespace TcpNet int delSocket(TcpNet::SocketSet set, TcpNet::Socket sock); void freeSocketSet(TcpNet::SocketSet set); -} +} // namespace TcpNet #endif diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index de82b1ec4..af36c27e6 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -129,4 +129,4 @@ public: typedef std::vector ServerInfos; -#endif // SERVERINFO_H +#endif // SERVERINFO_H diff --git a/src/net/skillhandler.h b/src/net/skillhandler.h index 6e8b786a9..97f7415b7 100644 --- a/src/net/skillhandler.h +++ b/src/net/skillhandler.h @@ -41,6 +41,7 @@ class SkillHandler virtual void useMap(const int id, const std::string &map) const = 0; }; -} -#endif // SKILLHANDLER_H +} // namespace Net + +#endif // SKILLHANDLER_H diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 667972539..c156b9f51 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -87,7 +87,7 @@ void AdminHandler::localAnnounce(const std::string &text) const void AdminHandler::hide(const bool h A_UNUSED) const { MessageOut outMsg(CMSG_ADMIN_HIDE); - outMsg.writeInt32(0); //unused + outMsg.writeInt32(0); // unused } void AdminHandler::kick(const int playerId) const @@ -96,4 +96,4 @@ void AdminHandler::kick(const int playerId) const outMsg.writeInt32(playerId); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 2d8cc8b7a..8e367b0c3 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -102,7 +102,7 @@ BeingHandler::BeingHandler(bool enableSync) : void BeingHandler::requestNameById(const int id) const { MessageOut outMsg(0x0094); - outMsg.writeInt32(id); //readLong(2)); + outMsg.writeInt32(id); // readLong(2)); } void BeingHandler::handleMessage(Net::MessageIn &msg) @@ -434,10 +434,10 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, // An update about a player, potentially including movement. const int id = msg.readInt32(); const short speed = msg.readInt16(); - const uint16_t stunMode = msg.readInt16(); // opt1; - uint32_t statusEffects = msg.readInt16(); // opt2; + const uint16_t stunMode = msg.readInt16(); // opt1; + uint32_t statusEffects = msg.readInt16(); // opt2; statusEffects |= (static_cast(msg.readInt16())) - << 16; // status.options; Aethyra uses this as misc2 + << 16; // status.options; Aethyra uses this as misc2 const short job = msg.readInt16(); Being *dstBeing = actorSpriteManager->findBeing(id); @@ -475,7 +475,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, const uint16_t headBottom = msg.readInt16(); if (msgType == 3) - msg.readInt32(); // server tick + msg.readInt32(); // server tick const uint16_t headTop = msg.readInt16(); const uint16_t headMid = msg.readInt16(); @@ -486,9 +486,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, colors[1] = msg.readInt8(); colors[2] = msg.readInt8(); - msg.readInt8(); //unused -// shoes = msg.readInt16(); -// gloves = msg.readInt16(); //sd->head_dir + msg.readInt8(); //unused const int guild = msg.readInt32(); // guild @@ -512,7 +510,6 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, dstBeing->setSprite(SPRITE_WEAPON, weapon, "", 1, true); if (!mHideShield) dstBeing->setSprite(SPRITE_SHIELD, shield); - //dstBeing->setSprite(SPRITE_SHOE, shoes); if (serverVersion > 0) { dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom, @@ -526,10 +523,6 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid); dstBeing->setSprite(SPRITE_HAT, headTop); } - //dstBeing->setSprite(SPRITE_GLOVES, gloves); - //dstBeing->setSprite(SPRITE_CAPE, cape); - //dstBeing->setSprite(SPRITE_MISC1, misc1); - //dstBeing->setSprite(SPRITE_MISC2, misc2); dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); dstBeing->setHairColor(hairColor); @@ -617,20 +610,19 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, } else if (msgType == 3) { - msg.readInt8(); // unknown + msg.readInt8(); // unknown } const int level = msg.readInt8(); // Lv if (level) dstBeing->setLevel(level); - msg.readInt8(); // unknown + msg.readInt8(); // unknown if (dstBeing->getType() != Being::PLAYER || msgType != 3) { dstBeing->setActionTime(tick_time); -// dstBeing->reset(); } dstBeing->setStunMode(stunMode); @@ -643,4 +635,4 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, dstBeing->setMoveTime(); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 5d173ae17..8bb426bef 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -143,4 +143,4 @@ void BuySellHandler::processNpcSellResponse(Net::MessageIn &msg) const } } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index d2f727af9..3a72ffa03 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -157,19 +157,19 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, data.mAttributes[PlayerInfo::MP] = msg.readInt16(); data.mAttributes[PlayerInfo::MAX_MP] = msg.readInt16(); - msg.readInt16(); // speed - tempPlayer->setSubtype(msg.readInt16()); // class (used for race) + msg.readInt16(); // speed + tempPlayer->setSubtype(msg.readInt16()); // class (used for race) const int hairStyle = msg.readInt16(); - const uint16_t weapon = msg.readInt16(); // unused on server. need use? + const uint16_t weapon = msg.readInt16(); // unused on server. need use? tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true); data.mAttributes[PlayerInfo::LEVEL] = msg.readInt16(); - msg.readInt16(); // skill point + msg.readInt16(); // skill point const int bottomClothes = msg.readInt16(); const int shield = msg.readInt16(); - const int hat = msg.readInt16(); // head option top + const int hat = msg.readInt16(); // head option top const int topClothes = msg.readInt16(); int hairColor = msg.readInt16(); @@ -195,19 +195,19 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, tempPlayer->setSprite(SPRITE_MISC1, misc1, "", msg.readInt8()); tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes, "", msg.readInt8()); - //to avoid show error (error.xml) need remove this sprite + // to avoid show error (error.xml) need remove this sprite if (!config.getBoolValue("hideShield")) tempPlayer->setSprite(SPRITE_SHIELD, shield, "", msg.readInt8()); else msg.readInt8(); tempPlayer->setSprite(SPRITE_HAT, hat, "", - msg.readInt8()); // head option top + msg.readInt8()); // head option top tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes, "", msg.readInt8()); tempPlayer->setSprite(SPRITE_MISC2, misc2, "", msg.readInt8()); msg.skip(5); - character->slot = msg.readInt8(); // character slot + character->slot = msg.readInt8(); // character slot } else { @@ -216,17 +216,16 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, tempPlayer->setSprite(SPRITE_CAPE, cape); tempPlayer->setSprite(SPRITE_MISC1, misc1); tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes); - //to avoid show error (error.xml) need remove this sprite + // to avoid show error (error.xml) need remove this sprite if (!config.getBoolValue("hideShield")) tempPlayer->setSprite(SPRITE_SHIELD, shield); - tempPlayer->setSprite(SPRITE_HAT, hat); // head option top + tempPlayer->setSprite(SPRITE_HAT, hat); // head option top tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes); tempPlayer->setSprite(SPRITE_MISC2, misc2); - character->slot = msg.readInt8(); // character slot + character->slot = msg.readInt8(); // character slot } - - msg.readInt8(); // unknown + msg.readInt8(); // unknown } void CharServerHandler::chooseCharacter(Net::Character *const character) @@ -313,7 +312,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg) loginData.characterSlots = static_cast(slots); const bool version = msg.readInt8() == 1 && serverVersion > 0; - msg.skip(17); // 0 Unused + msg.skip(17); // 0 Unused delete_all(mCharacters); mCharacters.clear(); @@ -340,4 +339,4 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg) Client::setState(STATE_CHAR_SELECT); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 09b3bd518..6610dec26 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -58,7 +58,7 @@ ChatHandler::ChatHandler() : SMSG_WHISPER, SMSG_WHISPER_RESPONSE, SMSG_GM_CHAT, - SMSG_MVP, // MVP + SMSG_MVP, // MVP SMSG_IGNORE_ALL_RESPONSE, 0 }; @@ -287,4 +287,4 @@ void ChatHandler::unIgnoreAll() const outMsg.writeInt8(1); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index ce6fa0e14..c92a83654 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -164,4 +164,4 @@ void GameHandler::disconnect2() const MessageOut outMsg(CMSG_CLIENT_DISCONNECT); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 1d4d5274f..01a012ee0 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -163,7 +163,6 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg) default: break; - } BLOCK_END("GeneralHandler::handleMessage") } @@ -296,4 +295,4 @@ void GeneralHandler::gameEnded() const Ea::partyTab = nullptr; } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/gui/guildtab.cpp b/src/net/tmwa/gui/guildtab.cpp index c7e155341..08a42eadc 100644 --- a/src/net/tmwa/gui/guildtab.cpp +++ b/src/net/tmwa/gui/guildtab.cpp @@ -47,4 +47,4 @@ GuildTab::~GuildTab() { } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/gui/partytab.cpp b/src/net/tmwa/gui/partytab.cpp index 725cae1d2..348e5cbfb 100644 --- a/src/net/tmwa/gui/partytab.cpp +++ b/src/net/tmwa/gui/partytab.cpp @@ -50,4 +50,4 @@ PartyTab::~PartyTab() { } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index a21ef726f..69d5f0e41 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -196,7 +196,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) void GuildHandler::create(const std::string &name) const { MessageOut msg(CMSG_GUILD_CREATE); - msg.writeInt32(0); // Unused + msg.writeInt32(0); // unused msg.writeString(name, 24); } @@ -212,8 +212,8 @@ void GuildHandler::invite(const int guildId A_UNUSED, { MessageOut msg(CMSG_GUILD_INVITE); msg.writeInt32(being->getId()); - msg.writeInt32(0); // Unused - msg.writeInt32(0); // Unused + msg.writeInt32(0); // unused + msg.writeInt32(0); // unused } } @@ -225,8 +225,8 @@ void GuildHandler::invite(const int guildId A_UNUSED, MessageOut msg(CMSG_GUILD_INVITE); msg.writeInt32(being->getId()); - msg.writeInt32(0); // Unused - msg.writeInt32(0); // Unused + msg.writeInt32(0); // unused + msg.writeInt32(0); // unused } void GuildHandler::inviteResponse(const int guildId, const bool response) const @@ -234,8 +234,8 @@ void GuildHandler::inviteResponse(const int guildId, const bool response) const MessageOut msg(CMSG_GUILD_INVITE_REPLY); msg.writeInt32(guildId); msg.writeInt8(response); - msg.writeInt8(0); // Unused - msg.writeInt16(0); // Unused + msg.writeInt8(0); // unused + msg.writeInt16(0); // unused } void GuildHandler::leave(const int guildId) const @@ -245,9 +245,9 @@ void GuildHandler::leave(const int guildId) const MessageOut msg(CMSG_GUILD_LEAVE); msg.writeInt32(guildId); - msg.writeInt32(player_node->getId()); // Account ID - msg.writeInt32(PlayerInfo::getCharId()); // Char ID - msg.writeString("", 40); // Message + msg.writeInt32(player_node->getId()); // Account ID + msg.writeInt32(PlayerInfo::getCharId()); // Char ID + msg.writeString("", 40); // Message } void GuildHandler::kick(const GuildMember *const member, @@ -258,9 +258,9 @@ void GuildHandler::kick(const GuildMember *const member, MessageOut msg(CMSG_GUILD_EXPULSION); msg.writeInt32(member->getGuild()->getId()); - msg.writeInt32(member->getID()); // Account ID - msg.writeInt32(member->getCharId()); // Char ID - msg.writeString(reason, 40); // Message + msg.writeInt32(member->getID()); // Account ID + msg.writeInt32(member->getCharId()); // Char ID + msg.writeString(reason, 40); // Message } void GuildHandler::chat(const int guildId A_UNUSED, @@ -286,7 +286,7 @@ void GuildHandler::memberList(const int guildId A_UNUSED) const // 4 = expulsion list MessageOut msg(CMSG_GUILD_REQUEST_INFO); - msg.writeInt32(1); // Request member list + msg.writeInt32(1); // Request member list } void GuildHandler::info(const int guildId A_UNUSED) @@ -300,7 +300,7 @@ void GuildHandler::info(const int guildId A_UNUSED) showBasicInfo = true; MessageOut msg(CMSG_GUILD_REQUEST_INFO); - msg.writeInt32(0); // Request basic info + msg.writeInt32(0); // Request basic info } void GuildHandler::changeMemberPostion(const GuildMember *const member, @@ -310,10 +310,10 @@ void GuildHandler::changeMemberPostion(const GuildMember *const member, return; MessageOut msg(CMSG_GUILD_CHANGE_MEMBER_POS); - msg.writeInt16(16); // size less then 16 <= 4 + 12 - msg.writeInt32(member->getID()); // Account ID - msg.writeInt32(member->getCharId()); // Char ID - msg.writeInt32(level); // pos + msg.writeInt16(16); // size less then 16 <= 4 + 12 + msg.writeInt32(member->getID()); // Account ID + msg.writeInt32(member->getCharId()); // Char ID + msg.writeInt32(level); // pos } void GuildHandler::changeNotice(const int guildId, const std::string &msg1, @@ -321,8 +321,8 @@ void GuildHandler::changeNotice(const int guildId, const std::string &msg1, { MessageOut msg(CMSG_GUILD_CHANGE_NOTICE); msg.writeInt32(guildId); - msg.writeString(msg1, 60); // msg1 - msg.writeString(msg2, 120); // msg2 + msg.writeString(msg1, 60); // msg1 + msg.writeString(msg2, 120); // msg2 } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 59aa6f69a..561f3ec90 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -166,7 +166,7 @@ void InventoryHandler::useItem(const Item *const item) const MessageOut outMsg(CMSG_PLAYER_INVENTORY_USE); outMsg.writeInt16(static_cast( item->getInvIndex() + INVENTORY_OFFSET)); - outMsg.writeInt32(item->getId()); // unused + outMsg.writeInt32(item->getId()); // unused } void InventoryHandler::dropItem(const Item *const item, const int amount) const @@ -204,4 +204,4 @@ void InventoryHandler::moveItem2(const int source, const int slot, } } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp index bb537a0c7..5a888d28f 100644 --- a/src/net/tmwa/itemhandler.cpp +++ b/src/net/tmwa/itemhandler.cpp @@ -66,4 +66,4 @@ void ItemHandler::handleMessage(Net::MessageIn &msg) BLOCK_END("ItemHandler::handleMessage") } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index fca7e904c..00e0563e8 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -137,7 +137,7 @@ void LoginHandler::sendLoginRegister(const std::string &username, if (email.empty()) { MessageOut outMsg(CMSG_LOGIN_REGISTER); - outMsg.writeInt32(0); // client version + outMsg.writeInt32(0); // client version outMsg.writeString(username, 24); outMsg.writeStringNoLog(password, 24); @@ -152,7 +152,7 @@ void LoginHandler::sendLoginRegister(const std::string &username, else { MessageOut outMsg(CMSG_LOGIN_REGISTER2); - outMsg.writeInt32(0); // client version + outMsg.writeInt32(0); // client version outMsg.writeString(username, 24); outMsg.writeStringNoLog(password, 24); @@ -181,15 +181,15 @@ void LoginHandler::requestUpdateHosts() const void LoginHandler::processServerVersion(Net::MessageIn &msg) { - const uint8_t b1 = msg.readInt8(); // -1 - const uint8_t b2 = msg.readInt8(); // E - const uint8_t b3 = msg.readInt8(); // V - const uint8_t b4 = msg.readInt8(); // L + const uint8_t b1 = msg.readInt8(); // -1 + const uint8_t b2 = msg.readInt8(); // E + const uint8_t b3 = msg.readInt8(); // V + const uint8_t b4 = msg.readInt8(); // L if (b1 == 255 && b2 == 'E' && b3 == 'V' && b4 == 'L') { const unsigned int options = msg.readInt8(); mRegistrationEnabled = options; - msg.skip(2); // 0 unused + msg.skip(2); // 0 unused serverVersion = msg.readInt8(); if (serverVersion >= 5) requestUpdateHosts(); @@ -240,4 +240,4 @@ int LoginHandler::supportedOptionalActions() const : SetGenderOnRegister; } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp index abe57a396..827efdcbd 100644 --- a/src/net/tmwa/messagehandler.cpp +++ b/src/net/tmwa/messagehandler.cpp @@ -48,4 +48,4 @@ void MessageHandler::setNetwork(Network *network) mNetwork = network; } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp index 3414b0091..67cacf504 100644 --- a/src/net/tmwa/messagein.cpp +++ b/src/net/tmwa/messagein.cpp @@ -33,7 +33,7 @@ #include "debug.h" -namespace TmwAthena +namespace TmwAthena { MessageIn::MessageIn(const char *const data, const unsigned int length) : @@ -81,4 +81,4 @@ int32_t MessageIn::readInt32() return value; } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index d520b407e..b0fff0292 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -145,4 +145,4 @@ void MessageOut::writeCoordinates(const unsigned short x, PacketCounters::incOutBytes(3); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index be91b5bc9..120cbb158 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -221,4 +221,4 @@ Network *Network::instance() return mInstance; } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 0c55d8d7e..fa9647b9d 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -115,7 +115,7 @@ void NpcHandler::talk(const int npcId) const { MessageOut outMsg(CMSG_NPC_TALK); outMsg.writeInt32(npcId); - outMsg.writeInt8(0); // Unused + outMsg.writeInt8(0); // unused } void NpcHandler::nextDialog(const int npcId) const @@ -161,21 +161,21 @@ void NpcHandler::stringInput(const int npcId, const std::string &value) const outMsg.writeInt16(static_cast(value.length() + 9)); outMsg.writeInt32(npcId); outMsg.writeString(value, static_cast(value.length())); - outMsg.writeInt8(0); // Prevent problems with string reading + outMsg.writeInt8(0); // Prevent problems with string reading } void NpcHandler::buy(const int beingId) const { MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST); outMsg.writeInt32(beingId); - outMsg.writeInt8(0); // Buy + outMsg.writeInt8(0); // Buy } void NpcHandler::sell(const int beingId) const { MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST); outMsg.writeInt32(beingId); - outMsg.writeInt8(1); // Sell + outMsg.writeInt8(1); // Sell } void NpcHandler::buyItem(const int beingId A_UNUSED, const int itemId, @@ -184,7 +184,7 @@ void NpcHandler::buyItem(const int beingId A_UNUSED, const int itemId, MessageOut outMsg(CMSG_NPC_BUY_REQUEST); if (serverVersion > 0) { - outMsg.writeInt16(10); // One item (length of packet) + outMsg.writeInt16(10); // One item (length of packet) outMsg.writeInt16(static_cast(amount)); outMsg.writeInt16(static_cast(itemId)); outMsg.writeInt8(color); @@ -192,7 +192,7 @@ void NpcHandler::buyItem(const int beingId A_UNUSED, const int itemId, } else { - outMsg.writeInt16(8); // One item (length of packet) + outMsg.writeInt16(8); // One item (length of packet) outMsg.writeInt16(static_cast(amount)); outMsg.writeInt16(static_cast(itemId)); } @@ -202,7 +202,7 @@ void NpcHandler::sellItem(const int beingId A_UNUSED, const int itemId, const int amount) const { MessageOut outMsg(CMSG_NPC_SELL_REQUEST); - outMsg.writeInt16(8); // One item (length of packet) + outMsg.writeInt16(8); // One item (length of packet) outMsg.writeInt16(static_cast(itemId + INVENTORY_OFFSET)); outMsg.writeInt16(static_cast(amount)); } @@ -288,35 +288,35 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg, const int npcId) case 4: if (viewport) { - msg.readInt32(); // id + msg.readInt32(); // id const int x = msg.readInt16(); const int y = msg.readInt16(); viewport->moveCameraRelative(x, y); } break; - case 5: // close dialog + case 5: // close dialog closeDialog(npcId); break; - case 6: // show avatar + case 6: // show avatar if (mDialog) { mDialog->showAvatar(static_cast( - msg.readInt32())); // avatar id + msg.readInt32())); // avatar id } break; - case 7: // set avatar direction + case 7: // set avatar direction if (mDialog) { mDialog->setAvatarDirection( Net::MessageIn::fromServerDirection( - static_cast(msg.readInt32()))); // direction + static_cast(msg.readInt32()))); // direction } break; - case 8: // set avatar action + case 8: // set avatar action if (mDialog) - mDialog->setAvatarAction(msg.readInt32()); // direction + mDialog->setAvatarAction(msg.readInt32()); // direction break; - case 9: // clear npc dialog + case 9: // clear npc dialog if (mDialog) mDialog->clearRows(); break; @@ -334,4 +334,4 @@ void NpcHandler::processLangReuqest(Net::MessageIn &msg A_UNUSED, stringInput(npcId, getLangSimple()); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index f86e030d1..39a580ebf 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -155,7 +155,7 @@ void PartyHandler::kick(Being *const being) const { MessageOut outMsg(CMSG_PARTY_KICK); outMsg.writeInt32(being->getId()); - outMsg.writeString("", 24); //Unused + outMsg.writeString("", 24); // unused } } @@ -173,7 +173,7 @@ void PartyHandler::kick(const std::string &name) const MessageOut outMsg(CMSG_PARTY_KICK); outMsg.writeInt32(m->getID()); - outMsg.writeString(name, 24); //Unused + outMsg.writeString(name, 24); // unused } void PartyHandler::chat(const std::string &text) const @@ -203,4 +203,4 @@ void PartyHandler::setShareItems(const PartyShare share) const outMsg.writeInt16(static_cast(share)); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 17ba07af1..dd05e1b03 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -81,11 +81,11 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) processPlayerStatUpdate2(msg); break; - case SMSG_PLAYER_STAT_UPDATE_3: // Update a base attribute + case SMSG_PLAYER_STAT_UPDATE_3: // Update a base attribute processPlayerStatUpdate3(msg); break; - case SMSG_PLAYER_STAT_UPDATE_4: // Attribute increase ack + case SMSG_PLAYER_STAT_UPDATE_4: // Attribute increase ack processPlayerStatUpdate4(msg); break; @@ -287,4 +287,4 @@ void PlayerHandler::updateStatus(const uint8_t status) const outMsg.writeInt8(0); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/questhandler.cpp b/src/net/tmwa/questhandler.cpp index 9789c2eb4..bb36ad820 100644 --- a/src/net/tmwa/questhandler.cpp +++ b/src/net/tmwa/questhandler.cpp @@ -33,8 +33,6 @@ #include "debug.h" -//extern Net::QuestHandler *questHandler; - namespace TmwAthena { @@ -48,7 +46,6 @@ QuestHandler::QuestHandler() : 0 }; handledMessages = _messages; -// questHandler = this; } void QuestHandler::handleMessage(Net::MessageIn &msg) @@ -102,4 +99,4 @@ void QuestHandler::processPlayerQuests(Net::MessageIn &msg A_UNUSED) const questsWindow->rebuild(false); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp index 9dd6af1fe..75edaf63b 100644 --- a/src/net/tmwa/skillhandler.cpp +++ b/src/net/tmwa/skillhandler.cpp @@ -71,7 +71,8 @@ void SkillHandler::handleMessage(Net::MessageIn &msg) BLOCK_END("SkillHandler::handleMessage") } -void SkillHandler::useBeing(const int id, const int level, const int beingId) const +void SkillHandler::useBeing(const int id, const int level, + const int beingId) const { MessageOut outMsg(CMSG_SKILL_USE_BEING); outMsg.writeInt16(static_cast(id)); @@ -96,4 +97,4 @@ void SkillHandler::useMap(const int id, const std::string &map) const outMsg.writeString(map, 16); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 4f413fdaf..33c08382e 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -146,4 +146,4 @@ void TradeHandler::cancel() const MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST); } -} // namespace TmwAthena +} // namespace TmwAthena diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h index 3adc3265f..90708de45 100644 --- a/src/net/tradehandler.h +++ b/src/net/tradehandler.h @@ -63,6 +63,7 @@ class TradeHandler virtual void cancel() const { } }; -} -#endif // TRADEHANDLER_H +} // namespace Net + +#endif // TRADEHANDLER_H diff --git a/src/net/worldinfo.h b/src/net/worldinfo.h index 8388a4406..65f8ae978 100644 --- a/src/net/worldinfo.h +++ b/src/net/worldinfo.h @@ -37,4 +37,4 @@ struct WorldInfo final typedef std::vector Worlds; -#endif // WORLD_INFO_H +#endif // WORLD_INFO_H diff --git a/src/normalopenglgraphics.cpp b/src/normalopenglgraphics.cpp index b26c029a7..5fffebbc0 100644 --- a/src/normalopenglgraphics.cpp +++ b/src/normalopenglgraphics.cpp @@ -45,8 +45,6 @@ unsigned int NormalOpenGLGraphics::mDrawCalls = 0; unsigned int NormalOpenGLGraphics::mLastDrawCalls = 0; #endif -//unsigned int vertexBufSize = 500; - NormalOpenGLGraphics::NormalOpenGLGraphics(): mFloatTexArray(nullptr), mIntTexArray(nullptr), @@ -326,7 +324,7 @@ bool NormalOpenGLGraphics::drawRescaledImage(const Image *const image, drawRescaledQuad(image, srcX, srcY, dstX, dstY, width, height, desiredWidth, desiredHeight); - if (smooth) // A basic smooth effect... + if (smooth) // A basic smooth effect... { setColorAlpha(0.2f); drawRescaledQuad(image, srcX, srcY, dstX - 1, dstY - 1, width, height, @@ -1031,7 +1029,7 @@ void NormalOpenGLGraphics::updateScreen() #endif SDL_GL_SwapBuffers(); // may be need clear? -// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); +// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); BLOCK_END("Graphics::updateScreen") } @@ -1502,4 +1500,4 @@ void NormalOpenGLGraphics::debugBindTexture(const Image *const image A_UNUSED) } #endif -#endif // USE_OPENGL +#endif // USE_OPENGL diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp index 4e5452e0b..483ec921a 100644 --- a/src/notifymanager.cpp +++ b/src/notifymanager.cpp @@ -158,4 +158,4 @@ namespace NotifyManager } return 0; } -} +} // namespace NotifyManager diff --git a/src/notifymanager.h b/src/notifymanager.h index d7c5607e6..fd6fe5eb7 100644 --- a/src/notifymanager.h +++ b/src/notifymanager.h @@ -31,5 +31,5 @@ namespace NotifyManager void notify(const unsigned int message, const int num); void notify(const unsigned int message, const std::string &str); int getIndexBySound(const std::string &sound); -} +} // namespace NotifyManager #endif diff --git a/src/particle.cpp b/src/particle.cpp index a0a01a09a..50b41018e 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -85,7 +85,6 @@ Particle::~Particle() { // Delete child emitters and child particles clear(); - //update particle count Particle::particleCount--; } @@ -118,7 +117,7 @@ bool Particle::update() if (mAlive == ALIVE) { - //calculate particle movement + // calculate particle movement if (mMomentum != 1.0f) mVelocity *= mMomentum; @@ -238,11 +237,11 @@ bool Particle::update() p2 = mChildParticles.end(); p != p2; ) { Particle *const particle = *p; - //move particle with its parent if desired + // move particle with its parent if desired if (particle->doesFollow()) particle->moveBy(change); - //update particle + // update particle if (particle->update()) { ++p; @@ -347,7 +346,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, effectChildNode, "position-y", 0)); const float offsetZ = static_cast(XML::getFloatProperty( effectChildNode, "position-z", 0)); - const Vector position (mPos.x + static_cast(pixelX) + offsetX, + const Vector position(mPos.x + static_cast(pixelX) + offsetX, mPos.y + static_cast(pixelY) + offsetY, mPos.z + offsetZ); newParticle->moveTo(position); @@ -420,9 +419,9 @@ Particle *Particle::addTextSplashEffect(const std::string &text, mMap, text, color, font, outline); newParticle->moveTo(static_cast(x), static_cast(y)); newParticle->setVelocity( - static_cast((rand() % 100) - 50) / 200.0f, // X - static_cast((rand() % 100) - 50) / 200.0f, // Y - (static_cast((rand() % 100)) / 200.0f) + 4.0f); // Z + static_cast((rand() % 100) - 50) / 200.0f, // X + static_cast((rand() % 100) - 50) / 200.0f, // Y + (static_cast((rand() % 100)) / 200.0f) + 4.0f); // Z newParticle->setGravity(0.1f); newParticle->setBounce(0.5f); diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index 7666fb063..1ae439e97 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -85,7 +85,6 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode, } else if (name == "position-y") { - mParticlePosY = readParticleEmitterProp(propertyNode, 0.0f); mParticlePosY.minVal *= SIN45; mParticlePosY.maxVal *= SIN45; @@ -141,7 +140,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode, { mParticleGravity = readParticleEmitterProp(propertyNode, 0.0f); } - else if (name == "randomnes" || name == "randomness") // legacy bug + else if (name == "randomnes" || name == "randomness") // legacy bug { mParticleRandomness = readParticleEmitterProp(propertyNode, 0); } @@ -213,8 +212,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode, ImageSet *const imageset = ResourceManager::getInstance() ->getImageSet(XML::getProperty(propertyNode, "imageset", ""), XML::getProperty(propertyNode, "width", 0), - XML::getProperty(propertyNode, "height", 0) - ); + XML::getProperty(propertyNode, "height", 0)); if (!imageset) { @@ -285,15 +283,14 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode, { mParticleRotation.addTerminator(rand); } - } // for frameNode + } // for frameNode } else if (xmlNameEqual(propertyNode, "animation")) { ImageSet *const imageset = ResourceManager::getInstance() ->getImageSet(XML::getProperty(propertyNode, "imageset", ""), XML::getProperty(propertyNode, "width", 0), - XML::getProperty(propertyNode, "height", 0) - ); + XML::getProperty(propertyNode, "height", 0)); if (!imageset) { @@ -364,7 +361,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode, { mParticleAnimation.addTerminator(rand); } - } // for frameNode + } // for frameNode } else if (xmlNameEqual(propertyNode, "deatheffect")) { @@ -590,7 +587,7 @@ std::list ParticleEmitter::createParticles(const int tick) void ParticleEmitter::adjustSize(const int w, const int h) { if (w == 0 || h == 0) - return; // new dimensions are illegal + return; // new dimensions are illegal // calculate the old rectangle const int oldArea = static_cast( @@ -598,8 +595,8 @@ void ParticleEmitter::adjustSize(const int w, const int h) mParticlePosX.maxVal - mParticlePosY.minVal); if (oldArea == 0) { - //when the effect has no dimension it is - //not designed to be resizeable + // when the effect has no dimension it is + // not designed to be resizeable return; } diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 101574600..7439aee60 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -344,4 +344,4 @@ void stateChange(const int state) } } -} // namespace PlayerInfo +} // namespace PlayerInfo diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index 184ef8adf..6cd46d2bb 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -109,11 +109,11 @@ public: } }; -static PlayerConfSerialiser player_conf_serialiser; // stateless singleton +static PlayerConfSerialiser player_conf_serialiser; // stateless singleton const unsigned int PlayerRelation::RELATION_PERMISSIONS[RELATIONS_NR] = { - /* NEUTRAL */ 0, // we always fall back to the defaults anyway + /* NEUTRAL */ 0, // we always fall back to the defaults anyway /* FRIEND */ EMOTE | SPEECH_FLOAT | SPEECH_LOG | WHISPER | TRADE, /* DISREGARDED*/ EMOTE | SPEECH_FLOAT, /* IGNORED */ 0, @@ -209,8 +209,8 @@ void PlayerRelationsManager::init() if (!mPersistIgnores) { - clear(); // Yes, we still keep them around in the config file - // until the next update. + clear(); // Yes, we still keep them around in the config file + // until the next update. } FOR_EACH (PlayerRelationListenersCIter, it, mListeners) @@ -272,7 +272,7 @@ unsigned int PlayerRelationsManager::checkPermissionSilently( break; case PlayerRelation::FRIEND: - permissions |= mDefaultPermissions; // widen + permissions |= mDefaultPermissions; // widen break; case PlayerRelation::DISREGARDED: @@ -281,7 +281,7 @@ unsigned int PlayerRelationsManager::checkPermissionSilently( case PlayerRelation::BLACKLISTED: case PlayerRelation::ENEMY2: default: - permissions &= mDefaultPermissions; // narrow + permissions &= mDefaultPermissions; // narrow } return permissions & flags; diff --git a/src/shopitem.cpp b/src/shopitem.cpp index 831b8cd43..f1fb42b79 100644 --- a/src/shopitem.cpp +++ b/src/shopitem.cpp @@ -53,8 +53,8 @@ ShopItem::ShopItem(const int inventoryIndex, const int id, addDuplicate(inventoryIndex, quantity); } -ShopItem::ShopItem (const int id, const unsigned char color, const int price) : - Item (id, 0, 0, color), +ShopItem::ShopItem(const int id, const unsigned char color, const int price) : + Item(id, 0, 0, color), mPrice(price), mShowQuantity(false) { diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 14996f577..af5ead79e 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -160,8 +160,7 @@ void SimpleAnimation::initializeAnimation(const XmlNodePtr animationNode, ImageSet *const imageset = ResourceManager::getInstance()->getImageSet( XML::getProperty(animationNode, "imageset", ""), XML::getProperty(animationNode, "width", 0), - XML::getProperty(animationNode, "height", 0) - ); + XML::getProperty(animationNode, "height", 0)); if (!imageset) return; diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index 0059f6d5d..03c73a59d 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -65,7 +65,7 @@ TextCommand* SpellManager::getSpellByItem(const int itemId) const void SpellManager::fillSpells() { -//id, std::string name, std::string symbol, ST type, int basicLvl, +// id, std::string name, std::string symbol, ST type, int basicLvl, // MagicSchool school, int schoolLvl, int mana) addSpell(new TextCommand(0, "lum", "#lum", "heal with lifestones", @@ -115,7 +115,6 @@ bool SpellManager::addSpell(TextCommand *const spell) std::vector SpellManager::getAll() const { - //logger->log(("mSpellsVector = " + toString(mSpellsVector.size())).c_str()); return mSpellsVector; } diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index f567d9ff5..bd6e103fb 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -147,7 +147,6 @@ void StatusEffect::load() if (index >= 0 && block_index >= 0) blockEffectIndexMap[block_index] = index; - } else if (xmlNameEqual(node, "stun-effect")) { diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index b4db8da78..0eadbdba0 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -43,8 +43,6 @@ #define sleep(seconds) Sleep((seconds) * 1000) #endif -//#include - #include "debug.h" TestLauncher::TestLauncher(std::string test) : diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp index c150a8b99..6193036d9 100644 --- a/src/test/testmain.cpp +++ b/src/test/testmain.cpp @@ -105,11 +105,11 @@ int TestMain::exec(const bool testAudio) if (!softwareTest) { int softFpsTest = invokeSoftwareRenderTest("8"); - info.append(strprintf ("%d", softFpsTest)); + info.append(strprintf("%d", softFpsTest)); if (!softFpsTest) { softFps = readValue2(8); - info.append(strprintf (",%d", softFps)); + info.append(strprintf(",%d", softFps)); if (!softFps) { softwareTest = -1; @@ -118,7 +118,7 @@ int TestMain::exec(const bool testAudio) else { rescaleTest[0] = invokeSoftwareRenderTest("5"); - info.append(strprintf (",%d", rescaleTest[0])); + info.append(strprintf(",%d", rescaleTest[0])); } } else @@ -143,7 +143,7 @@ int TestMain::exec(const bool testAudio) else { rescaleTest[1] = invokeFastOpenGLRenderTest("6"); - info.append(strprintf (",%d", rescaleTest[1])); + info.append(strprintf(",%d", rescaleTest[1])); } } else diff --git a/src/textmanager.cpp b/src/textmanager.cpp index 04e60d587..19bd29d5d 100644 --- a/src/textmanager.cpp +++ b/src/textmanager.cpp @@ -76,13 +76,13 @@ void TextManager::place(const Text *const textObj, const Text *const omit, { const int xLeft = textObj->mX; const int xRight1 = xLeft + textObj->mWidth; - const int TEST = 50; // Number of lines to test for text + const int TEST = 50; // Number of lines to test for text const int nBeings = 30; - bool occupied[TEST]; // is some other text obscuring this line? - std::memset(&occupied, 0, sizeof(occupied)); // set all to false - const int wantedTop = (TEST - h) / 2; // Entry in occupied at top of text - const int occupiedTop = y - wantedTop; // Line in map representing - // to of occupied + bool occupied[TEST]; // is some other text obscuring this line? + std::memset(&occupied, 0, sizeof(occupied)); // set all to false + const int wantedTop = (TEST - h) / 2; // Entry in occupied at top of text + const int occupiedTop = y - wantedTop; // Line in map representing + // to of occupied int cnt = 0; for (TextList::const_iterator ptr = mTextList.begin(), @@ -95,7 +95,7 @@ void TextManager::place(const Text *const textObj, const Text *const omit, { int from = text->mY - occupiedTop; int to = from + text->mHeight - 1; - if (to < 0 || from >= TEST) // out of range considered + if (to < 0 || from >= TEST) // out of range considered continue; if (from < 0) from = 0; @@ -121,7 +121,7 @@ void TextManager::place(const Text *const textObj, const Text *const omit, // Have to move it up or down, so find nearest spaces either side int consec = 0; - int upSlot = -1; // means not found + int upSlot = -1; // means not found const int sz2 = wantedTop + h - 2; for (int seek = sz2; seek >= 0; --seek) { @@ -155,21 +155,21 @@ void TextManager::place(const Text *const textObj, const Text *const omit, } } } - if (upSlot == -1 && downSlot == -1) // no good solution, so leave as is + if (upSlot == -1 && downSlot == -1) // no good solution, so leave as is { return; } - if (upSlot == -1) // must go down + if (upSlot == -1) // must go down { y += downSlot - wantedTop; return; } - if (downSlot == -1) // must go up + if (downSlot == -1) // must go up { y -= wantedTop - upSlot; return; } - if (wantedTop - upSlot > downSlot - wantedTop) // down is better + if (wantedTop - upSlot > downSlot - wantedTop) // down is better { y += downSlot - wantedTop; } diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index da3d40afb..22867e29c 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -146,10 +146,6 @@ bool getDataFromPasteboard(PasteboardRef inPasteboard, ItemCount itemCount; syncFlags = PasteboardSynchronize(inPasteboard); - - //require_action( syncFlags & kPasteboardModified, PasteboardOutOfSync, - // err = badPasteboardSyncErr ); - OSStatus err = PasteboardGetItemCount(inPasteboard, &itemCount); require_noerr(err, CantGetPasteboardItemCount); @@ -204,7 +200,7 @@ bool getDataFromPasteboard(PasteboardRef inPasteboard, flavorText[flavorDataSize] = '\0'; flavorText[flavorDataSize + 1] = '\n'; - CFRelease (flavorData); + CFRelease(flavorData); return true; } @@ -213,7 +209,7 @@ CantCopyFlavorData: fprintf(stderr, "Cannot copy clipboard, CantCopyFlavorData!\n"); } - CFRelease (flavorTypeArray); + CFRelease(flavorTypeArray); continue; CantCopyPasteboardItemFlavors: @@ -237,7 +233,7 @@ CantGetPasteboardItemCount: // return false; } -bool getClipBoard(char* text /* out */, const int bufSize) +bool getClipBoard(char* text /* out */, const int bufSize) { PasteboardRef theClipboard; OSStatus err = PasteboardCreate(kPasteboardClipboard, &theClipboard); @@ -294,12 +290,9 @@ static char* getSelection2(Display *dpy, Window us, Atom selection, Window owner = XGetSelectionOwner(dpy, selection); int ret; - //printf("XConvertSelection on %s\n", XGetAtomName(dpy, selection)); if (owner == None) - { - //printf("No owner\n"); return nullptr; - } + XConvertSelection(dpy, selection, request_target, XA_PRIMARY, us, CurrentTime); XFlush(dpy); @@ -311,14 +304,8 @@ static char* getSelection2(Display *dpy, Window us, Atom selection, XNextEvent(dpy, &e); if (e.type == SelectionNotify) { -// printf("Received %s, %s, %s\n", XGetAtomName(dpy, selection), -// XGetAtomName(dpy, e.xselection.selection), -// XGetAtomName(dpy, request_target)); if (e.xselection.property == None) - { - //printf("Couldn't convert\n"); return nullptr; - } long unsigned len, left, dummy; int format; @@ -339,13 +326,8 @@ static char* getSelection2(Display *dpy, Window us, Atom selection, &dummy, &data); if (ret != Success) - { - //printf("Failed to get property: %p on %lu\n", data, len); return nullptr; - } - //printf(">>> Got %s: len=%lu left=%lu (event %i)\n", data, - // len, left, 50-max_events); return reinterpret_cast(data); } } @@ -368,7 +350,6 @@ bool retrieveBuffer(std::string& text, size_t& pos) { SDL_SysWMinfo info; - //printf("Retrieving buffer...\n"); SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info)) { @@ -376,7 +357,7 @@ bool retrieveBuffer(std::string& text, size_t& pos) Window us = info.info.x11.window; char *data = nullptr; - requestAtom = XInternAtom (dpy, "UTF8_STRING", true); + requestAtom = XInternAtom(dpy, "UTF8_STRING", true); if (!data) data = getSelection(dpy, us, XA_PRIMARY); diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp index f9c5cc5a8..4c0637bd5 100644 --- a/src/utils/paths.cpp +++ b/src/utils/paths.cpp @@ -48,7 +48,7 @@ std::string getRealPath(const std::string &str) { std::string path; #if defined(__OpenBSD__) || defined(__ANDROID__) - char *realPath = (char*)calloc(PATH_MAX, sizeof(char)); + char *realPath = reinterpret_cast(calloc(PATH_MAX, sizeof(char))); realpath(str.c_str(), realPath); #else char *realPath = realpath(str.c_str(), nullptr); diff --git a/src/utils/perfomance.cpp b/src/utils/perfomance.cpp index c73b271c0..6f4d128cc 100644 --- a/src/utils/perfomance.cpp +++ b/src/utils/perfomance.cpp @@ -36,7 +36,6 @@ #include "debug.h" -//static const clockid_t clockType = CLOCK_PROCESS_CPUTIME_ID; static const clockid_t clockType = CLOCK_MONOTONIC; #define timeData ((static_cast(time.tv_sec) * 1000000000LL \ @@ -81,6 +80,6 @@ namespace Perfomance clock_gettime(clockType, &time); file << (timeData - startTime) << " end: " << name << std::endl; } -} +} // namespace Perfomance #endif diff --git a/src/utils/physfstools.cpp b/src/utils/physfstools.cpp index 1fcb8fb1b..93f677ca0 100644 --- a/src/utils/physfstools.cpp +++ b/src/utils/physfstools.cpp @@ -105,4 +105,4 @@ namespace PhysFs { return PHYSFS_mkdir(dirname); } -} +} // namespace PhysFs diff --git a/src/utils/process.cpp b/src/utils/process.cpp index 538d7274e..ec9eea548 100644 --- a/src/utils/process.cpp +++ b/src/utils/process.cpp @@ -49,15 +49,15 @@ int execFileWait(std::string pathName, std::string name A_UNUSED, PROCESS_INFORMATION piProcessInfo; memset(&siStartupInfo, 0, sizeof(siStartupInfo)); memset(&piProcessInfo, 0, sizeof(piProcessInfo)); - siStartupInfo.cb = sizeof(siStartupInfo); + siStartupInfo.cb = sizeof(siStartupInfo); DWORD ret = -1; std::string args(std::string(pathName).append(" ").append(arg1)); if (!arg2.empty()) args.append(" ").append(arg2); - if (CreateProcess(pathName.c_str(), (char*)args.c_str(), nullptr, nullptr, - false, CREATE_DEFAULT_ERROR_MODE, nullptr, nullptr, &siStartupInfo, - &piProcessInfo) != false) + if (CreateProcess(pathName.c_str(), static_cast(args.c_str()), + nullptr, nullptr, false, CREATE_DEFAULT_ERROR_MODE, nullptr, nullptr, + &siStartupInfo, &piProcessInfo) != false) { if (!WaitForSingleObject(piProcessInfo.hProcess, timeOut * 1000)) { @@ -83,7 +83,7 @@ bool execFile(std::string pathName, std::string name A_UNUSED, PROCESS_INFORMATION piProcessInfo; memset(&siStartupInfo, 0, sizeof(siStartupInfo)); memset(&piProcessInfo, 0, sizeof(piProcessInfo)); - siStartupInfo.cb = sizeof(siStartupInfo); + siStartupInfo.cb = sizeof(siStartupInfo); std::string args(std::string(pathName).append(" ").append(arg1)); if (!arg2.empty()) args.append(" ").append(arg2); @@ -149,8 +149,7 @@ int execFileWait(std::string pathName, std::string name, } else if (!sleep_pid) { // sleep pid - sleep (waitTime); -// printf ("time out\n"); + sleep(waitTime); execl("/bin/true", "/bin/true", static_cast(nullptr)); _exit(-1); } @@ -232,8 +231,9 @@ bool execFile(std::string pathName, std::string name, #ifdef WIN32 bool openBrowser(std::string url) { - return (int)ShellExecute(nullptr, "open", replaceAll(url, " ", "").c_str(), - nullptr, nullptr, SW_SHOWNORMAL) > 32; + return static_cast(ShellExecute(nullptr, "open", + replaceAll(url, " ", "").c_str(), + nullptr, nullptr, SW_SHOWNORMAL)) > 32; } #elif defined ANDROID #include diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index bd95ec2d7..dc85d8157 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -644,7 +644,7 @@ std::string getDateString() time_t rawtime; struct tm *timeinfo; - time (&rawtime); + time(&rawtime); timeinfo = localtime(&rawtime); strftime(buffer, 79, "%Y-%m-%d", timeinfo); diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 1d26f0388..b090df6d9 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -61,7 +61,7 @@ namespace XML if (file.is_open()) { // Get length of file - file.seekg (0, std::ios::end); + file.seekg(0, std::ios::end); size = static_cast(file.tellg()); file.seekg(0, std::ios::beg); @@ -218,4 +218,4 @@ namespace XML xmlCleanupParser(); } -} // namespace XML +} // namespace XML -- cgit v1.2.3-70-g09d2