From 47aa9bcf5eb537456abc393699c8fec07a4d5153 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 4 Mar 2011 16:27:43 +0200 Subject: Fix code style. --- src/actorspritemanager.cpp | 3 ++- src/flooritem.cpp | 3 ++- src/gui/outfitwindow.cpp | 7 ++++++- src/gui/popupmenu.cpp | 3 ++- src/gui/shopwindow.cpp | 6 ++++-- src/gui/trade.cpp | 2 +- src/gui/trade.h | 2 +- src/gui/widgets/shopitems.cpp | 3 ++- src/gui/widgets/spellshortcutcontainer.cpp | 3 ++- src/item.cpp | 3 ++- src/net/manaserv/beinghandler.cpp | 3 ++- src/net/tmwa/beinghandler.cpp | 6 ++++-- src/net/tmwa/charserverhandler.cpp | 9 ++++++--- src/net/tmwa/inventoryhandler.cpp | 5 ++++- src/net/tmwa/tradehandler.cpp | 4 ++-- src/resources/colordb.h | 6 +++++- src/spellmanager.cpp | 3 ++- src/utils/copynpaste.cpp | 11 +++++++---- 18 files changed, 56 insertions(+), 26 deletions(-) diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 03ed09835..b50c92ff5 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -193,7 +193,8 @@ Being *ActorSpriteManager::createBeing(int id, ActorSprite::Type type, FloorItem *ActorSpriteManager::createItem(int id, int itemId, int x, int y, int amount, unsigned char color) { - FloorItem *floorItem = new FloorItem(id, itemId, x, y, mMap, amount, color); + FloorItem *floorItem = new FloorItem(id, itemId, x, y, + mMap, amount, color); mActors.insert(floorItem); return floorItem; diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 740daf387..9d59fe25b 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -72,7 +72,8 @@ FloorItem::FloorItem(int id, } ItemInfo info = ItemDB::get(itemId); - setupSpriteDisplay(info.getDisplay(), true, 1, info.getDyeColorsString(mColor)); + setupSpriteDisplay(info.getDisplay(), true, 1, + info.getDyeColorsString(mColor)); } const ItemInfo &FloorItem::getInfo() const diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index ea2b7980c..3550883ba 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -173,9 +173,14 @@ void OutfitWindow::save() serverConfig.deleteKey("Outfit" + toString(o)); if (mItemsUnequip[o]) + { serverConfig.deleteKey("OutfitUnequip" + toString(o)); + } else - serverConfig.setValue("OutfitUnequip" + toString(o), mItemsUnequip[o]); + { + serverConfig.setValue("OutfitUnequip" + toString(o), + mItemsUnequip[o]); + } outfitStr = ""; } serverConfig.setValue("OutfitAwayIndex", mAwayOutfit); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index ce82fa745..6e241fe11 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -1139,7 +1139,8 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item, { if (tradeWindow && tradeWindow->isVisible()) { - mBrowserBox->addRow(strprintf("@@addtrade|%s@@", _("Add to trade"))); + mBrowserBox->addRow(strprintf("@@addtrade|%s@@", + _("Add to trade"))); if (cnt > 1) { if (cnt > 10) diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 43e05aa70..d458a5156 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -278,7 +278,8 @@ void ShopWindow::addBuyItem(Item *item, int amount, int price) { if (!mBuyShopItems || !item) return; - mBuyShopItems->addItemNoDup(item->getId(), item->getColor(), amount, price); + mBuyShopItems->addItemNoDup(item->getId(), + item->getColor(), amount, price); updateButtonsAndLabels(); } @@ -286,7 +287,8 @@ void ShopWindow::addSellItem(Item *item, int amount, int price) { if (!mBuyShopItems || !item) return; - mSellShopItems->addItemNoDup(item->getId(), item->getColor(), amount, price); + mSellShopItems->addItemNoDup(item->getId(), + item->getColor(), amount, price); updateButtonsAndLabels(); } diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index ede4c7a3d..ab53c38e6 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -161,7 +161,7 @@ void TradeWindow::addItem(int id, bool own, int quantity, } void TradeWindow::addItem2(int id, bool own, int quantity, - int refine, unsigned char color, bool equipment) + int refine, unsigned char color, bool equipment) { if (own) mMyInventory->addItem(id, quantity, refine, color, equipment); diff --git a/src/gui/trade.h b/src/gui/trade.h index be2b2673f..67515c013 100644 --- a/src/gui/trade.h +++ b/src/gui/trade.h @@ -75,7 +75,7 @@ class TradeWindow : public Window, gcn::ActionListener, gcn::SelectionListener * Add an item to the trade window. */ void addItem2(int id, bool own, int quantity, int refine, - unsigned char color, bool equipment); + unsigned char color, bool equipment); /** * Change quantity of an item. diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp index c0b93508e..15f4292a5 100644 --- a/src/gui/widgets/shopitems.cpp +++ b/src/gui/widgets/shopitems.cpp @@ -54,7 +54,8 @@ void ShopItems::addItem(int id, unsigned char color, int amount, int price) mShopItems.push_back(new ShopItem(-1, id, color, amount, price)); } -void ShopItems::addItemNoDup(int id, unsigned char color, int amount, int price) +void ShopItems::addItemNoDup(int id, unsigned char color, + int amount, int price) { ShopItem *item = findItem(id, color); if (!item) diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index d0f6931aa..8f4cee1ac 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -116,7 +116,8 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics) g->drawImage(mBackgroundImg, itemX, itemY); - int itemId = spellShortcut->getItem((mNumber * SPELL_SHORTCUT_ITEMS) + i); + int itemId = spellShortcut->getItem( + (mNumber * SPELL_SHORTCUT_ITEMS) + i); if (selectedId >= 0 && itemId == selectedId) { g->drawRectangle(gcn::Rectangle( diff --git a/src/item.cpp b/src/item.cpp index ed0685a9d..e6fa5cb1a 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -106,7 +106,8 @@ Image *Item::getImage(int id, unsigned char color) SpriteDisplay display = info.getDisplay(); std::string imagePath = "graphics/items/" + display.image; Image *image; - image = resman->getImage(combineDye2(imagePath, info.getDyeColorsString(color))); + image = resman->getImage(combineDye2(imagePath, + info.getDyeColorsString(color))); if (!image) image = Theme::getImageFromTheme("unknown-item.png"); diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp index b726bc52e..578b947f2 100644 --- a/src/net/manaserv/beinghandler.cpp +++ b/src/net/manaserv/beinghandler.cpp @@ -350,7 +350,8 @@ void BeingHandler::handleBeingLooksChangeMessage(Net::MessageIn &msg) { int style = msg.readInt16(); int color = msg.readInt16(); - being->setSprite(SPRITE_HAIR, style * -1, ColorDB::getHairColor(color)); + being->setSprite(SPRITE_HAIR, style * -1, + ColorDB::getHairColor(color)); } } diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 000941c30..9945bdac3 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -671,7 +671,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) player_node->imitateOutfit(dstBeing, SPRITE_TOPCLOTHES); break; case 6: // eAthena LOOK_HAIR_COLOR - dstBeing->setSpriteColor(SPRITE_HAIR, ColorDB::getHairColor(id)); + dstBeing->setSpriteColor(SPRITE_HAIR, + ColorDB::getHairColor(id)); break; case 8: // eAthena LOOK_SHIELD if (!config.getBoolValue("hideShield")) @@ -909,7 +910,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) //dstBeing->setSprite(SPRITE_SHOE, shoes); if (serverVersion > 0) { - dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom, "", colors[0]); + dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom, + "", colors[0]); dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid, "", colors[2]); dstBeing->setSprite(SPRITE_HAT, headTop, "", colors[1]); } diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index daf531f04..2265afb84 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -325,15 +325,18 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, tempPlayer->setSprite(SPRITE_GLOVES, gloves, "", msg.readInt8()); tempPlayer->setSprite(SPRITE_CAPE, cape, "", msg.readInt8()); tempPlayer->setSprite(SPRITE_MISC1, misc1, "", msg.readInt8()); - tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes, "", msg.readInt8()); + tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes, + "", msg.readInt8()); //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 - tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes, "", msg.readInt8()); + tempPlayer->setSprite(SPRITE_HAT, hat, "", + 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 diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 7113cddb3..afec336c7 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -490,7 +490,10 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) identified = 1; if (inventory) - inventory->setItem(index, itemId, 1, refine, identified, true); + { + inventory->setItem(index, itemId, 1, refine, + identified, true); + } if (equipType) mEquips.setEquipment(getSlot(equipType), index); diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index a63c530a6..581031f23 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -237,8 +237,8 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) if (tradeWindow) { - tradeWindow->addItem2(item->getId(), true, quantity, - item->getRefine(), item->getColor(), + tradeWindow->addItem2(item->getId(), true, + quantity, item->getRefine(), item->getColor(), item->isEquipment()); } item->increaseQuantity(-quantity); diff --git a/src/resources/colordb.h b/src/resources/colordb.h index fb0da0036..ce128578e 100644 --- a/src/resources/colordb.h +++ b/src/resources/colordb.h @@ -32,8 +32,12 @@ namespace ColorDB class ItemColor { public: - ItemColor() + ItemColor(): + id(0), + name(""), + color("") { } + ItemColor(int id, std::string name, std::string color) { this->id = id; diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index f845246fd..fb0a338d5 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -325,7 +325,8 @@ void SpellManager::save() serverConfig.setValue("commandShortcutFlags" + toString(i), strprintf("%u %u %u %u %u %u", spell->getCommandType(), spell->getTargetType(), spell->getBaseLvl(), - spell->getSchool(), spell->getSchoolLvl(), spell->getMana())); + spell->getSchool(), spell->getSchoolLvl(), + spell->getMana())); } else { diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 0edcb39bc..73ab1b35c 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -242,7 +242,8 @@ bool retrieveBuffer(std::string& text, std::string::size_type& pos) } #elif USE_X11 -static char* getSelection2(Display *dpy, Window us, Atom selection, Atom request_target) +static char* getSelection2(Display *dpy, Window us, Atom selection, + Atom request_target) { int max_events = 50; Window owner = XGetSelectionOwner(dpy, selection); @@ -254,7 +255,8 @@ static char* getSelection2(Display *dpy, Window us, Atom selection, Atom request //printf("No owner\n"); return NULL; } - XConvertSelection(dpy, selection, request_target, XA_PRIMARY, us, CurrentTime); + XConvertSelection(dpy, selection, request_target, + XA_PRIMARY, us, CurrentTime); XFlush(dpy); while (max_events --) @@ -264,8 +266,9 @@ static char* getSelection2(Display *dpy, Window us, Atom selection, Atom request 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)); +// 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"); -- cgit v1.2.3-70-g09d2