diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-16 20:39:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-16 20:39:33 +0300 |
commit | bc92643d8db723b5049db2dbad1ce052a0ae77a9 (patch) | |
tree | 4471be99711ee310c811e990d7c210e2393aeb6e | |
parent | 82cc576b7896f39bcf71aa85c8c4b3ef786c065b (diff) | |
download | manaverse-bc92643d8db723b5049db2dbad1ce052a0ae77a9.tar.gz manaverse-bc92643d8db723b5049db2dbad1ce052a0ae77a9.tar.bz2 manaverse-bc92643d8db723b5049db2dbad1ce052a0ae77a9.tar.xz manaverse-bc92643d8db723b5049db2dbad1ce052a0ae77a9.zip |
Fix code style and some other minor issues.
28 files changed, 80 insertions, 80 deletions
diff --git a/src/client.cpp b/src/client.cpp index cfc19446b..02e4b54df 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1674,7 +1674,7 @@ void Client::initLocalDataDir() mLocalDataDir = std::string(PHYSFS_getUserDir()); mLocalDataDir += "/Mana"; #elif defined __ANDROID__ - mLocalDataDir = "local"; + mLocalDataDir = "local"; #else mLocalDataDir = std::string(PHYSFS_getUserDir()) + ".local/share/mana"; diff --git a/src/graphics.h b/src/graphics.h index 94b0ef8f3..d6fd015f9 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -139,8 +139,9 @@ class Graphics : public gcn::SDLGraphics /** * Draws a resclaled version of the image */ - bool drawRescaledImage(Image *const image, int srcX, int srcY, - int dstX, int dstY, + bool drawRescaledImage(Image *const image, + const int srcX, const int srcY, + const int dstX, const int dstY, const int width, const int height, const int desiredWidth, const int desiredHeight) { diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 0fe1e7d2b..a163ac1c6 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -140,6 +140,10 @@ MapDebugTab::MapDebugTab() : mMapLabel(new Label(strprintf(_("Map:")))), mMinimapLabel(new Label(strprintf(_("Minimap:")))), mTileMouseLabel(new Label(strprintf("%s (%d, %d)", _("Cursor:"), 0, 0))), + mParticleCountLabel(new Label(strprintf("%s %d", + _("Particle count:"), 88888))), + mMapActorCountLabel(new Label(strprintf("%s %d", + _("Map actors count:"), 88888))), mXYLabel(new Label(strprintf("%s (?,?)", _("Player Position:")))), mTexturesLabel(nullptr), mUpdateTime(0), @@ -149,11 +153,6 @@ MapDebugTab::MapDebugTab() : LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); - mParticleCountLabel = new Label(strprintf("%s %d", - _("Particle count:"), 88888)); - mMapActorCountLabel = new Label(strprintf("%s %d", - _("Map actors count:"), 88888)); - #ifdef USE_OPENGL switch (imageHelper->useOpenGL()) { diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index fb90d0576..6e7891967 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -52,7 +52,11 @@ DidYouKnowWindow::DidYouKnowWindow(): ActionListener(), mBrowserBox(new BrowserBox), mScrollArea(new ScrollArea(mBrowserBox, - true, "didyouknow_background.xml")) + true, "didyouknow_background.xml")), + mButtonPrev(new Button(_("< Previous"), "prev", this)), + mButtonNext(new Button(_("Next >"), "next", this)), + mOpenAgainCheckBox(new CheckBox(_("Auto open this window"), + config.getBoolValue("showDidYouKnow"), this, "openagain")) { setMinWidth(300); setMinHeight(250); @@ -62,15 +66,10 @@ DidYouKnowWindow::DidYouKnowWindow(): setStickyButtonLock(true); setupWindow->registerWindowForReset(this); - setDefaultSize(500, 400, ImageRect::CENTER); mBrowserBox->setOpaque(false); Button *const okButton = new Button(_("Close"), "close", this); - mButtonPrev = new Button(_("< Previous"), "prev", this); - mButtonNext = new Button(_("Next >"), "next", this); - mOpenAgainCheckBox = new CheckBox(_("Auto open this window"), - config.getBoolValue("showDidYouKnow"), this, "openagain"); mBrowserBox->setLinkHandler(this); mBrowserBox->setFont(gui->getHelpFont()); diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp index 8edc8fd80..1458d043d 100644 --- a/src/gui/registerdialog.cpp +++ b/src/gui/registerdialog.cpp @@ -77,7 +77,8 @@ RegisterDialog::RegisterDialog(LoginData *const data): mOtherButton(nullptr), mWrongDataNoticeListener(new WrongDataNoticeListener) { - int optionalActions = Net::getLoginHandler()->supportedOptionalActions(); + const int optionalActions = Net::getLoginHandler()-> + supportedOptionalActions(); Label *const userLabel = new Label(_("Name:")); Label *const passwordLabel = new Label(_("Password:")); diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 4b1d79e8f..e57a74561 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -55,13 +55,13 @@ static const unsigned int RELATION_CHOICE_COLUMN_WIDTH = 80; #include "debug.h" -static const char *table_titles[COLUMNS_NR] = +static const char *const table_titles[COLUMNS_NR] = { N_("Name"), N_("Relation") }; -static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] = +static const char *const RELATION_NAMES[PlayerRelation::RELATIONS_NR] = { N_("Neutral"), N_("Friend"), diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index bb5bba68a..7ca598677 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -101,11 +101,13 @@ protected: friend class SocialWindow; SocialTab(): - mInviteDialog(nullptr), - mConfirmDialog(nullptr), - mScroll(nullptr), - mList(nullptr) - {} + Tab(), + mInviteDialog(nullptr), + mConfirmDialog(nullptr), + mScroll(nullptr), + mList(nullptr) + { + } virtual ~SocialTab() { diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp index cead5ebb6..b1d105aeb 100644 --- a/src/gui/specialswindow.cpp +++ b/src/gui/specialswindow.cpp @@ -105,10 +105,10 @@ void SpecialsWindow::action(const gcn::ActionEvent &event) if (!event.getSource()) return; - SpecialEntry *disp = dynamic_cast<SpecialEntry*>( + const SpecialEntry *const disp = dynamic_cast<SpecialEntry*>( event.getSource()->getParent()); - if (disp) + if (disp && disp->mInfo) { /*Being *target = player_node->getTarget(); @@ -171,12 +171,12 @@ void SpecialsWindow::rebuild(const std::map<int, Special> &specialData) { logger->log("Updating special GUI for %d", i->first); - SpecialInfo* info = SpecialDB::get(i->first); + SpecialInfo *const info = SpecialDB::get(i->first); if (info) { info->rechargeCurrent = i->second.currentMana; info->rechargeNeeded = i->second.neededMana; - SpecialEntry* entry = new SpecialEntry(info); + SpecialEntry *const entry = new SpecialEntry(info); entry->setPosition(0, vPos); vPos += entry->getHeight(); add(entry); @@ -190,7 +190,7 @@ void SpecialsWindow::rebuild(const std::map<int, Special> &specialData) } -SpecialEntry::SpecialEntry(SpecialInfo *info) : +SpecialEntry::SpecialEntry(SpecialInfo *const info) : mInfo(info), mIcon(nullptr), mLevelLabel(nullptr), @@ -251,8 +251,7 @@ void SpecialEntry::update(int current, int needed) { if (mRechargeBar && needed) { - float progress = static_cast<float>(current) - / static_cast<float>(needed); - mRechargeBar->setProgress(progress); + mRechargeBar->setProgress(static_cast<float>(current) + / static_cast<float>(needed)); } } diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index f30ebaecd..273b8d306 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -58,6 +58,13 @@ Viewport::Viewport() : WindowContainer(), MouseListener(), mMap(nullptr), + mScrollRadius(config.getIntValue("ScrollRadius")), + mScrollLaziness(config.getIntValue("ScrollLaziness")), + mShowBeingPopup(config.getBoolValue("showBeingPopup")), + mSelfMouseHeal(config.getBoolValue("selfMouseHeal")), + mEnableLazyScrolling(config.getBoolValue("enableLazyScrolling")), + mScrollCenterOffsetX(config.getIntValue("ScrollCenterOffsetX")), + mScrollCenterOffsetY(config.getIntValue("ScrollCenterOffsetY")), mMouseX(0), mMouseY(0), mPixelViewX(0), @@ -78,14 +85,6 @@ Viewport::Viewport() : setOpaque(false); addMouseListener(this); - mScrollLaziness = config.getIntValue("ScrollLaziness"); - mScrollRadius = config.getIntValue("ScrollRadius"); - mScrollCenterOffsetX = config.getIntValue("ScrollCenterOffsetX"); - mScrollCenterOffsetY = config.getIntValue("ScrollCenterOffsetY"); - mShowBeingPopup = config.getBoolValue("showBeingPopup"); - mSelfMouseHeal = config.getBoolValue("selfMouseHeal"); - mEnableLazyScrolling = config.getBoolValue("enableLazyScrolling"); - config.addListener("ScrollLaziness", this); config.addListener("ScrollRadius", this); config.addListener("showBeingPopup", this); diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index 249254cde..0acf66a65 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -83,7 +83,8 @@ void ExtendedListBox::draw(gcn::Graphics *graphics) const Image *const image = model->getImageAt(i); if (!image) { - graphics->drawText(mListModel->getElementAt(i), mPadding, y + textPos); + graphics->drawText(mListModel->getElementAt(i), + mPadding, y + textPos); } else { diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 8e56cfe9f..7885307e6 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -47,7 +47,8 @@ ListBox::ListBox(gcn::ListModel *const listModel): gcn::ListBox(listModel), mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)), mDistributeMousePressed(true), - mOldSelected(-1) + mOldSelected(-1), + mPadding(0) { mForegroundColor = Theme::getThemeColor(Theme::LISTBOX); @@ -60,8 +61,6 @@ ListBox::ListBox(gcn::ListModel *const listModel): if (mSkin) mPadding = mSkin->getPadding(); - else - mPadding = 0; adjustSize(); } diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 6dc6346b8..5ab6d1280 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -56,8 +56,8 @@ ProgressBar::ProgressBar(float progress, mFillPadding(3) { // The progress value is directly set at load time: - if (progress > 1.0f || progress < 0.0f) - progress = 1.0f; + if (mProgress > 1.0f || mProgress < 0.0f) + mProgress = 1.0f; mColor = Theme::getProgressColor(color >= 0 ? color : 0, mProgress); mColorToGo = mColor; diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index 565d83da7..6ff31fd0e 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -35,7 +35,8 @@ #include "debug.h" ProgressIndicator::ProgressIndicator() : - gcn::Widget() + gcn::Widget(), + mIndicator(nullptr) { ImageSet *const images = Theme::getImageSetFromTheme( "progress-indicator.png", 32, 32); @@ -50,10 +51,6 @@ ProgressIndicator::ProgressIndicator() : images->decRef(); } - else - { - mIndicator = nullptr; - } setSize(32, 32); } diff --git a/src/guichan/basiccontainer.cpp b/src/guichan/basiccontainer.cpp index 4598c4e8d..f3f61b65a 100644 --- a/src/guichan/basiccontainer.cpp +++ b/src/guichan/basiccontainer.cpp @@ -149,7 +149,7 @@ namespace gcn break; } - WidgetListReverseIterator end = it; + const WidgetListReverseIterator end = it; ++ it; diff --git a/src/guichan/gui.cpp b/src/guichan/gui.cpp index 41ff39797..41b9fe30f 100644 --- a/src/guichan/gui.cpp +++ b/src/guichan/gui.cpp @@ -343,7 +343,7 @@ namespace gcn mWidgetWithMouseQueue.push_front(widget); } - Widget *const swap = widget; + const Widget *const swap = widget; widget = parent; parent = swap->getParent(); } @@ -637,7 +637,7 @@ namespace gcn break; } - Widget *const swap = widget; + const Widget *const swap = widget; widget = parent; parent = swap->getParent(); diff --git a/src/guichan/rectangle.cpp b/src/guichan/rectangle.cpp index eb87bff50..165f94aab 100644 --- a/src/guichan/rectangle.cpp +++ b/src/guichan/rectangle.cpp @@ -90,7 +90,7 @@ namespace gcn if (x_ < 0) { width_ += x_; - x_ = 0; +// x_ = 0; } else if (x_ + width_ > rectangle.width) { diff --git a/src/guichan/widgets/label.cpp b/src/guichan/widgets/label.cpp index dc88deb69..8879407f7 100644 --- a/src/guichan/widgets/label.cpp +++ b/src/guichan/widgets/label.cpp @@ -91,7 +91,7 @@ namespace gcn return mAlignment; } - void Label::draw(Graphics* graphics) + void Label::draw(Graphics* graphics A_UNUSED) { } diff --git a/src/guichan/widgets/listbox.cpp b/src/guichan/widgets/listbox.cpp index 10e37841a..42f2d8d8b 100644 --- a/src/guichan/widgets/listbox.cpp +++ b/src/guichan/widgets/listbox.cpp @@ -132,11 +132,11 @@ namespace gcn distributeValueChangedEvent(); } - void ListBox::keyPressed(KeyEvent& keyEvent A_UNUSED) + void ListBox::keyPressed(KeyEvent &keyEvent A_UNUSED) { } - void ListBox::mousePressed(MouseEvent& mouseEvent) + void ListBox::mousePressed(MouseEvent &mouseEvent A_UNUSED) { } diff --git a/src/keyboarddata.h b/src/keyboarddata.h index d2398454f..155743aab 100644 --- a/src/keyboarddata.h +++ b/src/keyboarddata.h @@ -32,7 +32,7 @@ #include <string> // keyData must be in same order as enum keyAction. -static KeyData const keyData[Input::KEY_TOTAL] = { +static const KeyData keyData[Input::KEY_TOTAL] = { {"keyMoveUp", INPUT_KEYBOARD, SDLK_UP, INPUT_UNKNOWN, Input::KEY_NO_VALUE, diff --git a/src/localplayer.cpp b/src/localplayer.cpp index f3a45bdeb..3f08ef643 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1362,7 +1362,7 @@ void LocalPlayer::attack(Being *const target, const bool keep, if (!Client::limitPackets(PACKET_ATTACK)) return; - if (!dontChangeEquipment && target) + if (!dontChangeEquipment) changeEquipmentBeforeAttack(target); Net::getPlayerHandler()->attack(target->getId(), mServerAttack); @@ -4251,7 +4251,7 @@ bool LocalPlayer::checAttackPermissions(const Being *const target) const } -const char *LocalPlayer::getVarItem(const char **const arr, +const char *LocalPlayer::getVarItem(const char *const *const arr, const unsigned index, const unsigned sz) const { diff --git a/src/localplayer.h b/src/localplayer.h index cc81c1615..6134620bb 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -539,7 +539,7 @@ class LocalPlayer final : public Being, void tryMagic(const std::string &spell, const int baseMagic, const int schoolMagic, const int mana) const; - const char *getVarItem(const char **const arr, const unsigned index, + const char *getVarItem(const char *const *const arr, const unsigned index, const unsigned sz) const; void changeMode(unsigned *const var, const unsigned limit, diff --git a/src/maplayer.cpp b/src/maplayer.cpp index fcecb17bd..752ff593f 100644 --- a/src/maplayer.cpp +++ b/src/maplayer.cpp @@ -293,7 +293,6 @@ void MapLayer::updateOGL(Graphics *const graphics, int startX, int startY, imgVert->image = img; row->images.push_back(imgVert); } - lastImage = img; } lastImage = img; // if (imgVert->image->mGLImage != lastImage->mGLImage) diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 0f9d373df..2f08e9f09 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -43,7 +43,8 @@ namespace EAthena { AdminHandler::AdminHandler() : - MessageHandler() + MessageHandler(), + Ea::AdminHandler() { static const uint16_t _messages[] = { diff --git a/src/normalopenglgraphics.cpp b/src/normalopenglgraphics.cpp index 39059d7c1..32175c05f 100644 --- a/src/normalopenglgraphics.cpp +++ b/src/normalopenglgraphics.cpp @@ -870,8 +870,8 @@ void NormalOpenGLGraphics::calcTile(ImageVertexes *const vert, vp += 8; if (vp >= vLimit) { - floatTexArray = ogl.switchFloatTexArray(); - intVertArray = ogl.switchIntVertArray(); + ogl.switchFloatTexArray(); + ogl.switchIntVertArray(); ogl.switchVp(vp); vp = 0; } @@ -908,8 +908,8 @@ void NormalOpenGLGraphics::calcTile(ImageVertexes *const vert, vp += 8; if (vp >= vLimit) { - intTexArray = ogl.switchIntTexArray(); - intVertArray = ogl.switchIntVertArray(); + ogl.switchIntTexArray(); + ogl.switchIntVertArray(); ogl.switchVp(vp); vp = 0; } diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index 8483a7412..7ab532f26 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -34,12 +34,13 @@ #include "debug.h" -static const char *PLAYER_IGNORE_STRATEGY_NOP = "nop"; -static const char *PLAYER_IGNORE_STRATEGY_EMOTE0 = "emote0"; -static const char *DEFAULT_IGNORE_STRATEGY = PLAYER_IGNORE_STRATEGY_EMOTE0; +static const char *const PLAYER_IGNORE_STRATEGY_NOP = "nop"; +static const char *const PLAYER_IGNORE_STRATEGY_EMOTE0 = "emote0"; +static const char *const DEFAULT_IGNORE_STRATEGY + = PLAYER_IGNORE_STRATEGY_EMOTE0; -static const char *NAME = "name"; // constant for xml serialisation -static const char *RELATION = "relation"; // constant for xml serialisation +static const char *const NAME = "name"; +static const char *const RELATION = "relation"; static const unsigned int IGNORE_EMOTE_TIME = 100; diff --git a/src/resources/music.h b/src/resources/music.h index d1e3d1836..039b887d6 100644 --- a/src/resources/music.h +++ b/src/resources/music.h @@ -36,6 +36,7 @@ class Music final : public Resource { public: Music() : + Resource(), mMusic(nullptr) { } diff --git a/src/resources/specialdb.h b/src/resources/specialdb.h index 725542a29..f456f6a45 100644 --- a/src/resources/specialdb.h +++ b/src/resources/specialdb.h @@ -29,6 +29,15 @@ struct SpecialInfo final { + enum TargetMode + { + TARGET_SELF = 0, // no target selection + TARGET_FRIEND, // target friendly being + TARGET_ENEMY, // target hostile being + TARGET_BEING, // target any being + TARGET_POINT // target map location + }; + SpecialInfo() : id(0), isActive(false), @@ -42,14 +51,6 @@ struct SpecialInfo final A_DELETE_COPY(SpecialInfo) - enum TargetMode - { - TARGET_SELF = 0, // no target selection - TARGET_FRIEND, // target friendly being - TARGET_ENEMY, // target hostile being - TARGET_BEING, // target any being - TARGET_POINT // target map location - }; int id; std::string set; // tab on which the special is shown std::string name; // displayed name of special diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 4b86de2fc..82d77a14b 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -33,7 +33,7 @@ #include "debug.h" -static const char *STATUS_EFFECTS_FILE = "status-effects.xml"; +static const char *const STATUS_EFFECTS_FILE = "status-effects.xml"; static void unloadMap(std::map<int, StatusEffect *> &map); |