diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-02-20 00:25:42 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-02-20 00:25:42 +0200 |
commit | 3f00faa305201fabcc74e17dc24da4cefa9dbfa5 (patch) | |
tree | 460a7a06c97912e5ed9a525f01624748dd7a16a6 | |
parent | da9ec0b7b8e061b3d3bf1d145284de9d778456c1 (diff) | |
download | manaplus-3f00faa305201fabcc74e17dc24da4cefa9dbfa5.tar.gz manaplus-3f00faa305201fabcc74e17dc24da4cefa9dbfa5.tar.bz2 manaplus-3f00faa305201fabcc74e17dc24da4cefa9dbfa5.tar.xz manaplus-3f00faa305201fabcc74e17dc24da4cefa9dbfa5.zip |
Fix some code style and some errors.
-rw-r--r-- | src/being.cpp | 2 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 2 | ||||
-rw-r--r-- | src/gui/ministatus.cpp | 3 | ||||
-rw-r--r-- | src/gui/setup_other.cpp | 42 | ||||
-rw-r--r-- | src/gui/textpopup.h | 6 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/mouseevent.h | 6 | ||||
-rw-r--r-- | src/localplayer.h | 2 | ||||
-rw-r--r-- | src/resources/itemdb.cpp | 4 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 2 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 2 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 3 |
12 files changed, 34 insertions, 42 deletions
diff --git a/src/being.cpp b/src/being.cpp index 6e487a5b4..7265aa337 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -1888,7 +1888,7 @@ void Being::recalcSpritesOrder() // logger->log("preparation start"); std::vector<int>::iterator it; - int *oldHide = new int[20]; + int oldHide[20]; for (unsigned slot = 0; slot < sz; slot ++) { diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 94ce4f806..3eaf760a7 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -121,7 +121,7 @@ void Minimap::setMap(Map *map) for (int y = 0; y < surface->h; y ++) { for (int x = 0; x < surface->w; x ++) - *(data ++) = -map->getWalk(x,y); + *(data ++) = -map->getWalk(x, y); } SDL_UnlockSurface(surface); diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index e097c4246..303b36ae3 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -154,7 +154,7 @@ ProgressBar *MiniStatusWindow::createBar(float progress, int width, int height, void MiniStatusWindow::updateBars() { - int x = 0, h = 0; + int x = 0; std::list <ProgressBar*>::iterator it, it_end; ProgressBar* lastBar = 0; for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) @@ -169,7 +169,6 @@ void MiniStatusWindow::updateBars() bar->setPosition(x, 3); add(bar); x += bar->getWidth() + 3; - h = bar->getHeight(); lastBar = bar; } } diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp index be5f31665..7a43b5480 100644 --- a/src/gui/setup_other.cpp +++ b/src/gui/setup_other.cpp @@ -146,60 +146,46 @@ Setup_Other::Setup_Other(): mAfkButton = new Button(_("Edit"), ACTION_EDIT_AFK, this); mTradeBotCheckBox = new CheckBox(_("Enable shop mode"), - mTradeBot, - this, ACTION_TRADEBOT); + mTradeBot, this, ACTION_TRADEBOT); mBuggyServersCheckBox = new CheckBox(_("Enable buggy servers protection"), - mBuggyServers, - this, ACTION_BUGGY_SERVERS); + mBuggyServers, this, ACTION_BUGGY_SERVERS); mDebugLogCheckBox = new CheckBox(_("Enable debug log"), - mDebugLog, - this, ACTION_DEBUG_LOG); + mDebugLog, this, ACTION_DEBUG_LOG); mServerAttackCheckBox = new CheckBox(_("Enable server side attack"), - mServerAttack, - this, ACTION_SERVER_ATTACK); + mServerAttack, this, ACTION_SERVER_ATTACK); mAutofixPosCheckBox = new CheckBox(_("Auto fix position"), - mAutofixPos, - this, ACTION_FIX_POS); + mAutofixPos, this, ACTION_FIX_POS); mAttackMovingCheckBox = new CheckBox(_("Attack while moving"), - mAttackMoving, - this, ACTION_ATTACK_MOVING); + mAttackMoving, this, ACTION_ATTACK_MOVING); mQuickStatsCheckBox = new CheckBox(_("Enable quick stats"), - mQuickStats, - this, ACTION_QUICK_STATS); + mQuickStats, this, ACTION_QUICK_STATS); mWarpParticleCheckBox = new CheckBox(_("Show warps particles"), - mWarpParticle, - this, ACTION_WARP_PARTICLE); + mWarpParticle, this, ACTION_WARP_PARTICLE); mAutoShopCheckBox = new CheckBox(_("Accept sell/buy requests"), - mAutoShop, - this, ACTION_AUTO_SHOP); + mAutoShop, this, ACTION_AUTO_SHOP); mShowMobHPCheckBox = new CheckBox(_("Show monster hp bar"), - mShowMobHP, - this, ACTION_SHOW_MOB_HP); + mShowMobHP, this, ACTION_SHOW_MOB_HP); mShowOwnHPCheckBox = new CheckBox(_("Show own hp bar"), - mShowOwnHP, - this, ACTION_SHOW_OWN_HP); + mShowOwnHP, this, ACTION_SHOW_OWN_HP); mShowJobExpCheckBox = new CheckBox(_("Show job exp messages"), - mShowJobExp, - this, ACTION_SHOW_JOB_EXP); + mShowJobExp, this, ACTION_SHOW_JOB_EXP); mShowBeingPopupCheckBox = new CheckBox(_("Show players popups"), - mShowBeingPopup, - this, ACTION_SHOW_BEING_POPUP); + mShowBeingPopup, this, ACTION_SHOW_BEING_POPUP); mShowExtMinimapsCheckBox = new CheckBox(_("Show extended minimaps"), - mShowExtMinimaps, - this, ACTION_SHOW_EXTENDED_MINIMAPS); + mShowExtMinimaps, this, ACTION_SHOW_EXTENDED_MINIMAPS); // Do the layout LayoutHelper h(this); diff --git a/src/gui/textpopup.h b/src/gui/textpopup.h index 07662a0f7..898b53555 100644 --- a/src/gui/textpopup.h +++ b/src/gui/textpopup.h @@ -51,8 +51,10 @@ class TextPopup : public Popup * Sets the text to be displayed. */ void show(int x, int y, const std::string &str1) - { show(x, y, str1, static_cast<const char*>(""), - static_cast<const char*>("")); }; + { + show(x, y, str1, static_cast<const char*>(""), + static_cast<const char*>("")); + }; /** * Sets the text to be displayed. diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index d2d908b95..eaeed4d06 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -244,7 +244,7 @@ struct MouseOverLink MouseOverLink(int x, int y) : mX(x), mY(y) { } - bool operator() (BROWSER_LINK &link) + bool operator() (BROWSER_LINK &link) const { return (mX >= link.x1 && mX < link.x2 && mY >= link.y1 && mY < link.y2); diff --git a/src/gui/widgets/mouseevent.h b/src/gui/widgets/mouseevent.h index 774132d79..5e9a46cfd 100644 --- a/src/gui/widgets/mouseevent.h +++ b/src/gui/widgets/mouseevent.h @@ -29,9 +29,9 @@ class MouseEvent : public gcn::MouseEvent { public: MouseEvent(gcn::Widget* source, bool isShiftPressed, - bool isControlPressed, bool isAltPressed, bool isMetaPressed, - unsigned int type, unsigned int button, int x, int y, - int clickCount) : + bool isControlPressed, bool isAltPressed, + bool isMetaPressed, unsigned int type, unsigned int button, + int x, int y, int clickCount) : gcn::MouseEvent(source, isShiftPressed, isControlPressed, isAltPressed, isMetaPressed, type, button, x, y, clickCount) diff --git a/src/localplayer.h b/src/localplayer.h index 1f219ac1c..22643161c 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -55,7 +55,7 @@ class AwayListener : public gcn::ActionListener */ enum { - PICKUP_OKAY, + PICKUP_OKAY = 0, PICKUP_BAD_ITEM, PICKUP_TOO_HEAVY, PICKUP_TOO_FAR, diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index d6be7eae0..418bfb848 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -560,7 +560,9 @@ void loadFloorSprite(SpriteDisplay *display, xmlNodePtr floorNode) void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) { std::string removeSprite = XML::getProperty(replaceNode, "sprite", ""); - std::map<int,int> &mapList = itemInfo->addReplaceSprite(parseSpriteName(removeSprite)); + std::map<int, int> &mapList = itemInfo->addReplaceSprite( + parseSpriteName(removeSprite)); + itemInfo->setRemoveSprites(); for_each_xml_child_node(itemNode, replaceNode) diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 02c3c4d45..255a9a7b3 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -69,7 +69,7 @@ const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const return i == mSounds.end() ? empty : i->second[rand() % i->second.size()]; } -std::map<int,int> &ItemInfo::addReplaceSprite(int sprite) +std::map<int, int> &ItemInfo::addReplaceSprite(int sprite) { std::map<int, std::map<int, int> >::iterator it = mSpriteToItemReplaceMap.find(sprite); diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 05adb9215..5ea537fae 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -226,7 +226,7 @@ class ItemInfo int getReplaceToSpriteId(int id) const; - std::map<int,int> &addReplaceSprite(int sprite); + std::map<int, int> &addReplaceSprite(int sprite); std::map<int, std::map<int, int> > getSpriteToItemReplaceMap() const { return mSpriteToItemReplaceMap; } diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 808615ae9..5a635a8c2 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -457,7 +457,10 @@ void MapReader::readLayer(xmlNodePtr node, Map *map) unsigned char *charData = new unsigned char[len + 1]; const char *charStart = (const char*) xmlNodeGetContent(dataChild); if (!charStart) + { + delete charData; return; + } unsigned char *charIndex = charData; |