diff options
Diffstat (limited to 'src/gui')
60 files changed, 250 insertions, 989 deletions
diff --git a/src/gui/botcheckerwindow.h b/src/gui/botcheckerwindow.h index 6af9c91d6..86d5ef290 100644 --- a/src/gui/botcheckerwindow.h +++ b/src/gui/botcheckerwindow.h @@ -32,12 +32,6 @@ #include <vector> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - struct BOTCHK { short id; /**< Index into "botchecker_db" array */ diff --git a/src/gui/buydialog.h b/src/gui/buydialog.h index 53d20e1e5..6bc10a103 100644 --- a/src/gui/buydialog.h +++ b/src/gui/buydialog.h @@ -30,12 +30,6 @@ #include <guichan/actionlistener.hpp> #include <guichan/selectionlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class ShopItems; class ShopListBox; class IntTextField; diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 42435f036..d621caa96 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -44,6 +44,7 @@ #include "net/messageout.h" #include "net/net.h" +#include "resources/chardb.h" #include "resources/colordb.h" #include "resources/itemdb.h" @@ -66,10 +67,18 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): mPlayer = new Being(0, ActorSprite::PLAYER, mRace, nullptr); mPlayer->setGender(GENDER_MALE); - int numberOfHairColors = ColorDB::getHairSize(); + maxHairColor = CharDB::getMaxHairColor(); + minHairColor = CharDB::getMinHairColor(); + if (!maxHairColor) + maxHairColor = ColorDB::getHairSize(); - mHairStyle = rand() % mPlayer->getNumOfHairstyles(); - mHairColor = rand() % numberOfHairColors; + maxHairStyle = CharDB::getMaxHairStyle(); + minHairStyle = CharDB::getMinHairStyle(); + if (!maxHairStyle) + maxHairStyle = mPlayer->getNumOfHairstyles(); + + mHairStyle = (rand() % maxHairStyle) + minHairStyle; + mHairColor = (rand() % maxHairColor) + minHairColor; updateHair(); mNameField = new TextField(""); @@ -408,10 +417,14 @@ void CharCreateDialog::updateHair() mHairStyle %= Being::getNumOfHairstyles(); if (mHairStyle < 0) mHairStyle += Being::getNumOfHairstyles(); + if (mHairStyle < (signed)minHairStyle || mHairStyle > (signed)maxHairStyle) + mHairStyle = minHairStyle; mHairColor %= ColorDB::getHairSize(); if (mHairColor < 0) mHairColor += ColorDB::getHairSize(); + if (mHairColor < (signed)minHairColor || mHairColor > (signed)maxHairColor) + mHairColor = minHairColor; mPlayer->setSprite(Net::getCharHandler()->hairSprite(), mHairStyle * -1, ColorDB::getHairColor(mHairColor)); diff --git a/src/gui/charcreatedialog.h b/src/gui/charcreatedialog.h index 2f0f83513..c7010d6b1 100644 --- a/src/gui/charcreatedialog.h +++ b/src/gui/charcreatedialog.h @@ -124,6 +124,11 @@ class CharCreateDialog : public Window, public gcn::ActionListener int mRace; int mSlot; + + unsigned maxHairColor; + unsigned minHairColor; + unsigned maxHairStyle; + unsigned minHairStyle; }; #endif // CHAR_CREATE_DIALOG_H diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 93302e0ff..15d1e6e0e 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -186,6 +186,7 @@ CharSelectDialog::CharSelectDialog(LoginData *data): CharSelectDialog::~CharSelectDialog() { + Net::getCharHandler()->clear(); } void CharSelectDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 1ad468a3b..ad5229ffe 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -38,12 +38,6 @@ #include <vector> #include <set> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class BrowserBox; class ChatTab; class Channel; diff --git a/src/gui/didyouknowwindow.h b/src/gui/didyouknowwindow.h index b135103e8..d9734e8fe 100644 --- a/src/gui/didyouknowwindow.h +++ b/src/gui/didyouknowwindow.h @@ -28,12 +28,6 @@ #include <guichan/actionlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Button; class BrowserBox; class CheckBox; @@ -59,8 +53,7 @@ class DidYouKnowWindow : public Window, public LinkHandler, /** * Handles link action. */ - void handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED); + void handleLink(const std::string &link, gcn::MouseEvent *event); void loadData(int num = 0); diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index d3d230922..cb3ace0c7 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -42,6 +42,7 @@ #include "net/net.h" #include "resources/image.h" +#include "resources/imageset.h" #include "resources/iteminfo.h" #include "resources/resourcemanager.h" @@ -55,13 +56,16 @@ static const int BOX_WIDTH = 36; static const int BOX_HEIGHT = 36; +static const int BOX_X_PAD = (BOX_WIDTH - 32) / 2; +static const int BOX_Y_PAD = (BOX_HEIGHT - 32) / 2; EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being, bool foring): Window(_("Equipment"), false, nullptr, "equipment.xml"), mEquipment(equipment), mSelected(-1), - mForing(foring) + mForing(foring), + mImageSet(0) { mBeing = being; mItemPopup = new ItemPopup; @@ -119,6 +123,11 @@ EquipmentWindow::~EquipmentWindow() } delete_all(mBoxes); mBoxes.clear(); + if (mImageSet) + { + mImageSet->decRef(); + mImageSet = nullptr; + } } void EquipmentWindow::draw(gcn::Graphics *graphics) @@ -133,12 +142,12 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) int i = 0; const int fontHeight = getFont()->getHeight(); - std::vector<std::pair<int, int>*>::const_iterator it; - std::vector<std::pair<int, int>*>::const_iterator it_end = mBoxes.end(); + std::vector<EquipmentBox*>::const_iterator it; + std::vector<EquipmentBox*>::const_iterator it_end = mBoxes.end(); for (it = mBoxes.begin(); it != it_end; ++ it, ++ i) { - std::pair<int, int> *box = *it; + EquipmentBox *box = *it; if (!box) continue; if (i == mSelected) @@ -146,14 +155,14 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) mHighlightColor.a = getGuiAlpha(); // Set color to the highlight color g->setColor(mHighlightColor); - g->fillRectangle(gcn::Rectangle(box->first, - box->second, BOX_WIDTH, BOX_HEIGHT)); + g->fillRectangle(gcn::Rectangle(box->x, box->y, + BOX_WIDTH, BOX_HEIGHT)); } // Set color black g->setColor(mBorderColor); // Draw box border - g->drawRectangle(gcn::Rectangle(box->first, box->second, + g->drawRectangle(gcn::Rectangle(box->x, box->y, BOX_WIDTH, BOX_HEIGHT)); if (!mEquipment) @@ -168,17 +177,21 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) { image->setAlpha(1.0f); // Ensure the image is drawn // with maximum opacity - g->drawImage(image, box->first + 2, box->second + 2); + g->drawImage(image, box->x + 2, box->y + 2); if (i == EQUIP_PROJECTILE_SLOT) { g->setColor(getForegroundColor()); graphics->drawText(toString(item->getQuantity()), - box->first + (BOX_WIDTH / 2), - box->second - fontHeight, + box->x + (BOX_WIDTH / 2), box->y - fontHeight, gcn::Graphics::CENTER); } } } + else if (box->image) + { + g->drawImage(box->image, box->x + BOX_X_PAD, + box->y + BOX_Y_PAD); + } } } @@ -200,16 +213,16 @@ Item *EquipmentWindow::getItem(int x, int y) const if (!mEquipment) return nullptr; - std::vector<std::pair<int, int>*>::const_iterator it; - std::vector<std::pair<int, int>*>::const_iterator it_end = mBoxes.end(); + std::vector<EquipmentBox*>::const_iterator it; + std::vector<EquipmentBox*>::const_iterator it_end = mBoxes.end(); int i = 0; for (it = mBoxes.begin(); it != it_end; ++ it, ++ i) { - std::pair<int, int> *box = *it; + EquipmentBox *box = *it; if (!box) continue; - const gcn::Rectangle tRect(box->first, box->second, + const gcn::Rectangle tRect(box->x, box->y, BOX_WIDTH, BOX_HEIGHT); if (tRect.isPointInRect(x, y)) @@ -233,18 +246,17 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) if (mForing) return; // Checks if any of the presses were in the equip boxes. - std::vector<std::pair<int, int>*>::const_iterator it; - std::vector<std::pair<int, int>*>::const_iterator - it_end = mBoxes.end(); + std::vector<EquipmentBox*>::const_iterator it; + std::vector<EquipmentBox*>::const_iterator it_end = mBoxes.end(); int i = 0; for (it = mBoxes.begin(); it != it_end; ++ it, ++ i) { - std::pair<int, int> *box = *it; + EquipmentBox *box = *it; if (!box) continue; Item *item = mEquipment->getEquipment(i); - const gcn::Rectangle tRect(box->first, box->second, + const gcn::Rectangle tRect(box->x, box->y, BOX_WIDTH, BOX_HEIGHT); if (tRect.isPointInRect(x, y) && item) @@ -351,6 +363,12 @@ void EquipmentWindow::fillBoxes() return; } + if (mImageSet) + mImageSet->decRef(); + + mImageSet = Theme::getImageSetFromTheme(XML::getProperty( + root, "image", "equipmentbox.png"), 32, 32); + for_each_xml_child_node(node, root) { if (xmlStrEqual(node->name, BAD_CAST "window")) @@ -358,7 +376,7 @@ void EquipmentWindow::fillBoxes() else if (xmlStrEqual(node->name, BAD_CAST "playerbox")) loadPlayerBox(node); else if (xmlStrEqual(node->name, BAD_CAST "slot")) - loadSlot(node); + loadSlot(node, mImageSet); } delete doc; } @@ -378,7 +396,7 @@ void EquipmentWindow::loadPlayerBox(xmlNodePtr playerBoxNode) XML::getProperty(playerBoxNode, "height", 168))); } -void EquipmentWindow::loadSlot(xmlNodePtr slotNode) +void EquipmentWindow::loadSlot(xmlNodePtr slotNode, ImageSet *imageset) { int slot = parseSlotName(XML::getProperty(slotNode, "name", "")); if (slot < 0) @@ -386,16 +404,22 @@ void EquipmentWindow::loadSlot(xmlNodePtr slotNode) const int x = XML::getProperty(slotNode, "x", 0) + getPadding(); const int y = XML::getProperty(slotNode, "y", 0) + getTitleBarHeight(); + const int imageIndex = XML::getProperty(slotNode, "image", -1); + Image *image = nullptr; + + if (imageset && imageIndex >= 0 && imageIndex < (signed)imageset->size()) + image = imageset->get(imageIndex); if (mBoxes[slot]) { - std::pair<int, int> *pair = mBoxes[slot]; - pair->first = x; - pair->second = y; + EquipmentBox *box = mBoxes[slot]; + box->x = x; + box->y = y; + box->image = image; } else { - mBoxes[slot] = new std::pair<int, int>(x, y); + mBoxes[slot] = new EquipmentBox(x, y, image); } } @@ -461,23 +485,34 @@ int EquipmentWindow::parseSlotName(std::string name) void EquipmentWindow::fillDefault() { - addBox(0, 90, 40); // torso - addBox(1, 8, 78); // gloves - addBox(2, 70, 0); // hat - addBox(3, 50, 253); // pants - addBox(4, 90, 253); // boots - addBox(5, 8, 213); // FREE - addBox(6, 129, 213); // wings - addBox(7, 50, 40); // scarf - addBox(8, 8, 168); // weapon - addBox(9, 129, 168); // shield - addBox(10, 129, 78); // ammo - addBox(11, 8, 123); // amulet - addBox(12, 129, 123); // ring + if (mImageSet) + mImageSet->decRef(); + + 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 } -void EquipmentWindow::addBox(int idx, int x, int y) +void EquipmentWindow::addBox(int idx, int x, int y, int imageIndex) { - mBoxes[idx] = new std::pair<int, int>( - x + getPadding(), y + getTitleBarHeight()); + Image *image = nullptr; + + if (mImageSet && imageIndex >= 0 && imageIndex < (signed)mImageSet->size()) + image = mImageSet->get(imageIndex); + + mBoxes[idx] = new EquipmentBox(x + getPadding(), y + getTitleBarHeight(), + image); } diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index cadf27620..0a3c2da20 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -25,27 +25,37 @@ #include "equipment.h" #include "guichanfwd.h" +#include "localconsts.h" #include "gui/widgets/window.h" #include "utils/xml.h" +#include "resources/image.h" + #include <guichan/actionlistener.hpp> #include <vector> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Being; class Inventory; +class Image; +class ImageSet; class Item; class ItemPopup; class PlayerBox; +struct EquipmentBox +{ + EquipmentBox(int x0, int y0, Image *img) : + x(x0), y(y0), image(img) + { } + + int x; + int y; + Image *image; +}; + /** * Equipment dialog. * @@ -96,13 +106,13 @@ class EquipmentWindow : public Window, public gcn::ActionListener void fillDefault(); - void addBox(int idx, int x, int y); + void addBox(int idx, int x, int y, int imageIndex); void loadWindow(xmlNodePtr windowNode); void loadPlayerBox(xmlNodePtr playerBoxNode); - void loadSlot(xmlNodePtr slotNode); + void loadSlot(xmlNodePtr slotNode, ImageSet *imageset); int parseSlotName(std::string name); @@ -114,8 +124,9 @@ class EquipmentWindow : public Window, public gcn::ActionListener int mSelected; /**< Index of selected item. */ bool mForing; + ImageSet *mImageSet; Being *mBeing; - std::vector<std::pair<int, int>*> mBoxes; + std::vector<EquipmentBox*> mBoxes; gcn::Color mHighlightColor; gcn::Color mBorderColor; }; diff --git a/src/gui/helpwindow.h b/src/gui/helpwindow.h index d59289db0..178ae1e16 100644 --- a/src/gui/helpwindow.h +++ b/src/gui/helpwindow.h @@ -28,11 +28,7 @@ #include <guichan/actionlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif +#include "localconsts.h" class BrowserBox; class LinkHandler; diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 9dadeb5a8..aa78705b8 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -35,12 +35,6 @@ #include <guichan/keylistener.hpp> #include <guichan/selectionlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class DropDown; class Item; class ItemContainer; @@ -48,7 +42,6 @@ class InventoryFilter; class LayoutCell; class ProgressBar; class SortListModel; -//class TextBox; class TextField; /** diff --git a/src/gui/itemamountwindow.h b/src/gui/itemamountwindow.h index 2dffdc286..bacd4cfd0 100644 --- a/src/gui/itemamountwindow.h +++ b/src/gui/itemamountwindow.h @@ -28,12 +28,6 @@ #include <guichan/keylistener.hpp> #include <guichan/actionlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Icon; class IntTextField; class Item; diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index 5e1b442dc..6fb8f7652 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -31,12 +31,6 @@ #include <vector> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class AnimatedSprite; class Graphics; class ProgressBar; diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index 3a7f27d4b..4bbe2c46c 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -28,11 +28,7 @@ #include <guichan/actionlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif +#include "localconsts.h" class Being; class BrowserBox; diff --git a/src/gui/register.h b/src/gui/register.h index 34bcadd6d..b0137f141 100644 --- a/src/gui/register.h +++ b/src/gui/register.h @@ -30,12 +30,6 @@ #include <string> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class LoginData; class OkDialog; diff --git a/src/gui/selldialog.h b/src/gui/selldialog.h index 46cb077e1..a775cf0e0 100644 --- a/src/gui/selldialog.h +++ b/src/gui/selldialog.h @@ -30,12 +30,6 @@ #include <SDL_types.h> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Item; class ShopItems; class ShopListBox; diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h index 850f23897..b6d5209e2 100644 --- a/src/gui/setup_colors.h +++ b/src/gui/setup_colors.h @@ -31,12 +31,6 @@ #include <string> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class BrowserBox; class TextField; class TextPreview; diff --git a/src/gui/setup_relations.h b/src/gui/setup_relations.h index a6627a06d..2c23d4dba 100644 --- a/src/gui/setup_relations.h +++ b/src/gui/setup_relations.h @@ -30,12 +30,6 @@ #include <guichan/actionlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class EditDialog; class GuiTable; class PlayerTableModel; diff --git a/src/gui/shopwindow.h b/src/gui/shopwindow.h index 8b170f31e..e1fd8a2a0 100644 --- a/src/gui/shopwindow.h +++ b/src/gui/shopwindow.h @@ -30,12 +30,6 @@ #include <guichan/actionlistener.hpp> #include <guichan/selectionlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class CheckBox; class Item; class ListBox; diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h index 21ee56f5e..63f7d1790 100644 --- a/src/gui/skilldialog.h +++ b/src/gui/skilldialog.h @@ -42,12 +42,6 @@ class TabbedArea; struct SkillInfo; -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - /** * The skill dialog. * diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h index 7dc962316..dec8a6c26 100644 --- a/src/gui/socialwindow.h +++ b/src/gui/socialwindow.h @@ -30,12 +30,6 @@ #include <string> #include <map> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class AttackTab; class Button; class ConfirmDialog; diff --git a/src/gui/specialswindow.h b/src/gui/specialswindow.h index 030c1343b..4350a656b 100644 --- a/src/gui/specialswindow.h +++ b/src/gui/specialswindow.h @@ -34,12 +34,6 @@ #include <map> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Label; class ScrollArea; class Tab; diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp index 5f2ec71e3..3e1f68d09 100644 --- a/src/gui/statuspopup.cpp +++ b/src/gui/statuspopup.cpp @@ -37,7 +37,6 @@ #include "units.h" #include "keyboardconfig.h" -#include "utils/gettext.h" #include "utils/stringutils.h" #include <guichan/font.hpp> @@ -187,387 +186,52 @@ void StatusPopup::view(int x, int y) requestMoveToTop(); } -void StatusPopup::setLabelText(gcn::Label *label, char *text, int key) +void StatusPopup::setLabelText(gcn::Label *label, const char *text, int key) { label->setCaption(strprintf("%s %s", text, keyboard.getKeyValueString(key).c_str())); } +void StatusPopup::setLabelText2(gcn::Label *label, std::string text, int key) +{ + label->setCaption(strprintf("%s %s", text.c_str(), + keyboard.getKeyValueString(key).c_str())); + label->adjustSize(); +} + void StatusPopup::updateLabels() { if (!player_node || !viewport) return; - switch (player_node->getInvertDirection()) - { - case 0: - setLabelText(mMoveType, _("(D) default moves"), - keyboard.KEY_INVERT_DIRECTION); - break; - - case 1: - setLabelText(mMoveType, _("(I) invert moves"), - keyboard.KEY_INVERT_DIRECTION); - break; - - case 2: - setLabelText(mMoveType, _("(c) moves with some crazy moves"), - keyboard.KEY_INVERT_DIRECTION); - break; - - case 3: - setLabelText(mMoveType, _("(C) moves with crazy moves"), - keyboard.KEY_INVERT_DIRECTION); - break; - - case 4: - setLabelText(mMoveType, _("(d) double normal + crazy"), - keyboard.KEY_INVERT_DIRECTION); - break; - - default: - setLabelText(mMoveType, _("(?) move"), - keyboard.KEY_INVERT_DIRECTION); - break; - } - mMoveType->adjustSize(); - - if (player_node->getCrazyMoveType() < 10) - { - mCrazyMoveType->setCaption(strprintf("(%d) crazy move number %d %s", - player_node->getCrazyMoveType(), player_node->getCrazyMoveType(), - keyboard.getKeyValueString( - keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE).c_str())); - } - else - { - switch (player_node->getCrazyMoveType()) - { - case 10: - setLabelText(mCrazyMoveType, _("(a) custom crazy move"), - keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE); - break; - default: - setLabelText(mCrazyMoveType, _("(?) crazy move"), - keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE); - break; - } - } - mCrazyMoveType->adjustSize(); - - switch (player_node->getMoveToTargetType()) - { - case 0: - setLabelText(mMoveToTargetType, _("(0) default moves to target"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 1: - setLabelText(mMoveToTargetType, - _("(1) moves to target in distance 1"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 2: - setLabelText(mMoveToTargetType, - _("(2) moves to target in distance 2"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 3: - setLabelText(mMoveToTargetType, - _("(3) moves to target in distance 3"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 4: - setLabelText(mMoveToTargetType, - _("(5) moves to target in distance 5"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 5: - setLabelText(mMoveToTargetType, - _("(7) moves to target in distance 7"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 6: - setLabelText(mMoveToTargetType, - _("(A) moves to target in attack range"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - case 7: - setLabelText(mMoveToTargetType, - _("(a) archer attack range"), - keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - default: - setLabelText(mMoveToTargetType, - _("(?) move to target"), keyboard.KEY_CHANGE_MOVE_TO_TARGET); - break; - } - mMoveToTargetType->adjustSize(); - - switch (player_node->getFollowMode()) - { - case 0: - setLabelText(mFollowMode, _("(D) default follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - case 1: - setLabelText(mFollowMode, _("(R) relative follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - case 2: - setLabelText(mFollowMode, _("(M) mirror follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - case 3: - setLabelText(mFollowMode, _("(P) pet follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - default: - setLabelText(mFollowMode, _("(?) unknown follow"), - keyboard.KEY_CHANGE_FOLLOW_MODE); - break; - } - mFollowMode->adjustSize(); - - switch (player_node->getAttackWeaponType()) - { - case 1: - setLabelText(mAttackWeaponType, _("(D) default attack"), - keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); - break; - case 2: - setLabelText(mAttackWeaponType, - _("(s) switch attack without shield"), - keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); - break; - case 3: - setLabelText(mAttackWeaponType, - _("(S) switch attack with shield"), - keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); - break; - default: - setLabelText(mAttackWeaponType, _("(?) attack"), - keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); - break; - } - mAttackWeaponType->adjustSize(); - - switch (player_node->getAttackType()) - { - case 0: - setLabelText(mAttackType, _("(D) default attack"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - case 1: - setLabelText(mAttackType, _("(G) go and attack"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - case 2: - setLabelText(mAttackType, _("(A) go, attack, pickup"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - case 3: - setLabelText(mAttackType, _("(d) without auto attack"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - default: - setLabelText(mAttackType, _("(?) attack"), - keyboard.KEY_CHANGE_ATTACK_TYPE); - break; - } - mAttackType->adjustSize(); - - mDropCounter->setCaption(strprintf("(%d) drop counter %d %s", - player_node->getQuickDropCounter(), player_node->getQuickDropCounter(), - keyboard.getKeyValueString(keyboard.KEY_SWITCH_QUICK_DROP).c_str())); - mDropCounter->adjustSize(); - - switch (player_node->getPickUpType()) - { - case 0: - setLabelText(mPickUpType, _("(S) small pick up 1x1 cells"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 1: - setLabelText(mPickUpType, _("(D) default pick up 2x1 cells"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 2: - setLabelText(mPickUpType, _("(F) forward pick up 2x3 cells"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 3: - setLabelText(mPickUpType, _("(3) pick up 3x3 cells"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 4: - setLabelText(mPickUpType, _("(g) go and pick up in distance 4"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 5: - setLabelText(mPickUpType, _("(G) go and pick up in distance 8"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - case 6: - setLabelText(mPickUpType, _("(A) go and pick up in max distance"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - default: - setLabelText(mPickUpType, _("(?) pick up"), - keyboard.KEY_CHANGE_PICKUP_TYPE); - break; - } - mPickUpType->adjustSize(); - - switch (viewport->getDebugPath()) - { - case 0: - setLabelText(mMapType, _("(N) normal map view"), - keyboard.KEY_PATHFIND); - break; - case 1: - setLabelText(mMapType, _("(D) debug map view"), - keyboard.KEY_PATHFIND); - break; - case 2: - setLabelText(mMapType, _("(u) ultra map view"), - keyboard.KEY_PATHFIND); - break; - case 3: - setLabelText(mMapType, _("(U) ultra map view 2"), - keyboard.KEY_PATHFIND); - break; - case 4: - setLabelText(mMapType, _("(e) empty map view"), - keyboard.KEY_PATHFIND); - break; - case 5: - setLabelText(mMapType, _("(b) black & white map view"), - keyboard.KEY_PATHFIND); - break; - default: - setLabelText(mMapType, _("(?) map view"), keyboard.KEY_PATHFIND); - break; - } - mMapType->adjustSize(); - - switch (player_node->getMagicAttackType()) - { - case 0: - setLabelText(mMagicAttackType, _("(f) use #flar for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - case 1: - setLabelText(mMagicAttackType, - _("(c) use #chiza for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - case 2: - setLabelText(mMagicAttackType, - _("(I) use #ingrav for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - case 3: - setLabelText(mMagicAttackType, - _("(F) use #frillyar for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - case 4: - setLabelText(mMagicAttackType, - _("(U) use #upmarmu for magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - default: - setLabelText(mMagicAttackType, _("(?) magic attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - } - mMagicAttackType->adjustSize(); - - switch (player_node->getPvpAttackType()) - { - case 0: - setLabelText(mPvpAttackType, _("(a) attack all players"), - keyboard.KEY_SWITCH_PVP_ATTACK); - break; - case 1: - setLabelText(mPvpAttackType, _("(f) attack not friends"), - keyboard.KEY_SWITCH_PVP_ATTACK); - break; - case 2: - setLabelText(mPvpAttackType, _("(b) attack bad relations"), - keyboard.KEY_SWITCH_PVP_ATTACK); - break; - case 3: - setLabelText(mPvpAttackType, _("(d) dont attack players"), - keyboard.KEY_SWITCH_PVP_ATTACK); - break; - default: - setLabelText(mMagicAttackType, _("(?) pvp attack"), - keyboard.KEY_SWITCH_MAGIC_ATTACK); - break; - } - mPvpAttackType->adjustSize(); - - switch (player_node->getImitationMode()) - { - case 0: - setLabelText(mImitationMode, _("(D) default imitation"), - keyboard.KEY_CHANGE_IMITATION_MODE); - break; - case 1: - setLabelText(mImitationMode, _("(O) outfits imitation"), - keyboard.KEY_CHANGE_IMITATION_MODE); - break; - default: - setLabelText(mImitationMode, _("(?) imitation"), - keyboard.KEY_CHANGE_IMITATION_MODE); - break; - } - mImitationMode->adjustSize(); - - switch ((int)player_node->getAway()) - { - case 0: - setLabelText(mAwayMode, _("(O) on keyboard"), keyboard.KEY_AWAY); - break; - case 1: - setLabelText(mAwayMode, _("(A) away"), keyboard.KEY_AWAY); - break; - default: - setLabelText(mAwayMode, _("(?) away"), keyboard.KEY_AWAY); - break; - } - mAwayMode->adjustSize(); - - switch (viewport->getCameraMode()) - { - case 0: - setLabelText(mCameraMode, _("(G) game camera mode"), - keyboard.KEY_CAMERA); - break; - case 1: - setLabelText(mCameraMode, _("(F) free camera mode"), - keyboard.KEY_CAMERA); - break; - case 2: - setLabelText(mCameraMode, _("(D) design camera mode"), - keyboard.KEY_CAMERA); - break; - default: - setLabelText(mCameraMode, _("(?) away"), keyboard.KEY_CAMERA); - break; - } - mCameraMode->adjustSize(); - - if (player_node->getDisableGameModifiers()) - { - setLabelText(mDisableGameModifiers, _("Game modifiers are disabled"), - keyboard.KEY_DISABLE_GAME_MODIFIERS); - } - else - { - setLabelText(mDisableGameModifiers, _("Game modifiers are enabled"), - keyboard.KEY_DISABLE_GAME_MODIFIERS); - } - mDisableGameModifiers->adjustSize(); + setLabelText2(mMoveType, player_node->getInvertDirectionString(), + keyboard.KEY_INVERT_DIRECTION); + setLabelText2(mCrazyMoveType, player_node->getCrazyMoveTypeString(), + keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE); + setLabelText2(mMoveToTargetType, player_node->getMoveToTargetTypeString(), + keyboard.KEY_CHANGE_MOVE_TO_TARGET); + setLabelText2(mFollowMode, player_node->getFollowModeString(), + keyboard.KEY_CHANGE_FOLLOW_MODE); + setLabelText2(mAttackWeaponType, player_node->getAttackWeaponTypeString(), + keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE); + setLabelText2(mAttackType, player_node->getAttackTypeString(), + keyboard.KEY_CHANGE_ATTACK_TYPE); + setLabelText2(mDropCounter, player_node->getQuickDropCounterString(), + keyboard.KEY_SWITCH_QUICK_DROP); + setLabelText2(mPickUpType, player_node->getPickUpTypeString(), + keyboard.KEY_CHANGE_PICKUP_TYPE); + setLabelText2(mMapType, player_node->getDebugPathString(), + keyboard.KEY_PATHFIND); + setLabelText2(mMagicAttackType, player_node->getMagicAttackString(), + keyboard.KEY_SWITCH_MAGIC_ATTACK); + setLabelText2(mPvpAttackType, player_node->getPvpAttackString(), + keyboard.KEY_SWITCH_PVP_ATTACK); + setLabelText2(mImitationMode, player_node->getImitationModeString(), + keyboard.KEY_CHANGE_IMITATION_MODE); + setLabelText2(mAwayMode, player_node->getAwayModeString(), + keyboard.KEY_AWAY); + setLabelText2(mCameraMode, player_node->getCameraModeString(), + keyboard.KEY_CAMERA); + setLabelText2(mDisableGameModifiers, player_node->getGameModifiersString(), + keyboard.KEY_DISABLE_GAME_MODIFIERS); } diff --git a/src/gui/statuspopup.h b/src/gui/statuspopup.h index 2af8064c5..976b5e57b 100644 --- a/src/gui/statuspopup.h +++ b/src/gui/statuspopup.h @@ -60,7 +60,10 @@ class StatusPopup : public Popup private: void updateLabels(); - void setLabelText(gcn::Label *label, char *text, int key); + + void setLabelText(gcn::Label *label, const char *text, int key); + + void setLabelText2(gcn::Label *label, std::string text, int key); gcn::Label *mMoveType; gcn::Label *mCrazyMoveType; diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 37a706baf..5ac14d132 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -624,7 +624,7 @@ void StatusWindow::updateInvSlotsBar(ProgressBar *bar) bar->setText(strprintf("%d", usedSlots)); } -std::string StatusWindow::translateLetter(char* letters) +std::string StatusWindow::translateLetter(const char* letters) { char buf[2]; char *str = gettext(letters); @@ -636,277 +636,34 @@ std::string StatusWindow::translateLetter(char* letters) return std::string(buf); } +std::string StatusWindow::translateLetter2(std::string letters) +{ + if (letters.size() < 5) + return ""; + + return std::string(gettext(letters.substr(1, 1).c_str())); +} + void StatusWindow::updateStatusBar(ProgressBar *bar, bool percent A_UNUSED) { if (!player_node || !viewport) return; - std::string str; - - switch (player_node->getInvertDirection()) - { - case 0: - str = translateLetter(N_("(D)")); - break; - case 1: - str = translateLetter(N_("(I)")); - break; - case 2: - str = translateLetter(N_("(c)")); - break; - case 3: - str = translateLetter(N_("(C)")); - break; - case 4: - str = translateLetter(N_("(d)")); - break; - default: - str = translateLetter(N_("(?)")); - break; - } - - if (player_node->getCrazyMoveType() < 10) - str += toString(player_node->getCrazyMoveType()); - else - { - switch (player_node->getCrazyMoveType()) - { - case 10: - str += translateLetter(N_("(a)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - } - - switch (player_node->getMoveToTargetType()) - { - case 0: - str += translateLetter(N_("(0)")); - break; - case 1: - str += translateLetter(N_("(1)")); - break; - case 2: - str += translateLetter(N_("(2)")); - break; - case 3: - str += translateLetter(N_("(3)")); - break; - case 4: - str += translateLetter(N_("(5)")); - break; - case 5: - str += translateLetter(N_("(7)")); - break; - case 6: - str += translateLetter(N_("(A)")); - break; - case 7: - str += translateLetter(N_("(a)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (player_node->getFollowMode()) - { - case 0: - str += translateLetter(N_("(D)")); - break; - case 1: - str += translateLetter(N_("(R)")); - break; - case 2: - str += translateLetter(N_("(M)")); - break; - case 3: - str += translateLetter(N_("(P)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - str += " "; - switch (player_node->getAttackWeaponType()) - { - case 1: - str += translateLetter(N_("(D)")); - break; - case 2: - str += translateLetter(N_("(s)")); - break; - case 3: - str += translateLetter(N_("(S)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (player_node->getAttackType()) - { - case 0: - str += translateLetter(N_("(D)")); - break; - case 1: - str += translateLetter(N_("(G)")); - break; - case 2: - str += translateLetter(N_("(A)")); - break; - case 3: - str += translateLetter(N_("(d)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (player_node->getMagicAttackType()) - { - case 0: - str += translateLetter(N_("(f)")); - break; - case 1: - str += translateLetter(N_("(c)")); - break; - case 2: - str += translateLetter(N_("(I)")); - break; - case 3: - str += translateLetter(N_("(F)")); - break; - case 4: - str += translateLetter(N_("(U)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (player_node->getPvpAttackType()) - { - case 0: - str += translateLetter(N_("(a)")); - break; - case 1: - str += translateLetter(N_("(f)")); - break; - case 2: - str += translateLetter(N_("(b)")); - break; - case 3: - str += translateLetter(N_("(d)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - str += " " + toString(player_node->getQuickDropCounter()); - - switch (player_node->getPickUpType()) - { - case 0: - str += translateLetter(N_("(S)")); - break; - case 1: - str += translateLetter(N_("(D)")); - break; - case 2: - str += translateLetter(N_("(F)")); - break; - case 3: - str += translateLetter(N_("(3)")); - break; - case 4: - str += translateLetter(N_("(g)")); - break; - case 5: - str += translateLetter(N_("(G)")); - break; - case 6: - str += translateLetter(N_("(A)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - str += " "; - switch (viewport->getDebugPath()) - { - case 0: - str += translateLetter(N_("(N)")); - break; - case 1: - str += translateLetter(N_("(D)")); - break; - case 2: - str += translateLetter(N_("(u)")); - break; - case 3: - str += translateLetter(N_("(U)")); - break; - case 4: - str += translateLetter(N_("(e)")); - break; - case 5: - str += translateLetter(N_("(b)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - str += " "; - switch (player_node->getImitationMode()) - { - case 0: - str += translateLetter(N_("(D)")); - break; - case 1: - str += translateLetter(N_("(O)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch (viewport->getCameraMode()) - { - case 0: - str += translateLetter(N_("(G)")); - break; - case 1: - str += translateLetter(N_("(F)")); - break; - case 2: - str += translateLetter(N_("(D)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } - - switch ((int)player_node->getAway()) - { - case 0: - str += translateLetter(N_("(O)")); - break; - case 1: - str += translateLetter(N_("(A)")); - break; - default: - str += translateLetter(N_("(?)")); - break; - } + bar->setText(translateLetter2(player_node->getInvertDirectionString()) + += translateLetter2(player_node->getCrazyMoveTypeString()) + += translateLetter2(player_node->getMoveToTargetTypeString()) + += translateLetter2(player_node->getFollowModeString()) + += " " + translateLetter2(player_node->getAttackWeaponTypeString()) + += translateLetter2(player_node->getAttackTypeString()) + += translateLetter2(player_node->getMagicAttackString()) + += translateLetter2(player_node->getPvpAttackString()) + += " " + translateLetter2(player_node->getQuickDropCounterString()) + += translateLetter2(player_node->getPickUpTypeString()) + += " " + translateLetter2(player_node->getDebugPathString()) + += " " + translateLetter2(player_node->getImitationModeString()) + += translateLetter2(player_node->getCameraModeString()) + += translateLetter2(player_node->getAwayModeString())); - bar->setText(str); bar->setProgress(50); if (player_node->getDisableGameModifiers()) { diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index fa957d059..d3a619bcb 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -37,12 +37,6 @@ class ProgressBar; class ScrollArea; class VertContainer; -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - /** * The player status dialog. * @@ -82,7 +76,9 @@ class StatusWindow : public Window, void action(const gcn::ActionEvent &event); private: - static std::string translateLetter(char* letters); + static std::string translateLetter(const char* letters); + + static std::string translateLetter2(std::string letters); /** * Status Part diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 0246a5b62..9aa6bb956 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -599,12 +599,17 @@ std::string Theme::resolveThemePath(const std::string &path) else file = path; - // Might be a valid path already - if (PHYSFS_exists(file.c_str())) - return path; + // File with path + if (file.find('/') != std::string::npos) + { + // Might be a valid path already + if (PHYSFS_exists(file.c_str())) + return path; + } // Try the theme file = getThemePath() + "/" + file; + if (PHYSFS_exists(file.c_str())) return getThemePath() + "/" + path; diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 8823928a3..938988198 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -31,12 +31,6 @@ #include <guichan/mouselistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class ActorSprite; class Button; class Being; diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index ead38f42b..e0fa4ebcf 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -198,6 +198,7 @@ void WhoIsOnline::loadList() std::vector<std::string> friends; std::vector<std::string> neutral; std::vector<std::string> disregard; + std::vector<std::string> enemy; // Tokenize and add each line separately char *line = strtok(mMemoryBuffer, "\n"); @@ -270,6 +271,7 @@ void WhoIsOnline::loadList() switch (player_relations.getRelation(nick)) { case PlayerRelation::NEUTRAL: + default: neutral.push_back(prepareNick(nick, level, "0")); break; @@ -282,9 +284,12 @@ void WhoIsOnline::loadList() disregard.push_back(prepareNick(nick, level, "8")); break; + case PlayerRelation::ENEMY2: + enemy.push_back(prepareNick(nick, level, "1")); + break; + case PlayerRelation::IGNORED: case PlayerRelation::ERASED: - default: //Ignore the ignored. break; } @@ -316,6 +321,16 @@ void WhoIsOnline::loadList() mBrowserBox->addRow("---"); addedFromSection = false; } + for (int i = 0; i < static_cast<int>(enemy.size()); i++) + { + mBrowserBox->addRow(enemy.at(i)); + addedFromSection = true; + } + if (addedFromSection == true) + { + mBrowserBox->addRow("---"); + addedFromSection = false; + } for (int i = 0; i < static_cast<int>(neutral.size()); i++) { mBrowserBox->addRow(neutral.at(i)); diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 4e077fafb..962c0b363 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -28,11 +28,7 @@ #include "gui/widgets/browserbox.h" #include "gui/widgets/tab.h" -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif +#include "localconsts.h" class ScrollArea; @@ -58,6 +54,7 @@ class ChatTab : public Tab * Constructor. */ ChatTab(const std::string &name); + ~ChatTab(); /** @@ -106,7 +103,8 @@ class ChatTab : public Tab * Add any extra help text to the output. Allows tabs to define help * for commands defined by the tab itself. */ - virtual void showHelp() {} + virtual void showHelp() + { } /** * Handle special commands. Allows a tab to handle commands it diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index 4e293aad6..af38065f5 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -27,12 +27,6 @@ #include "localconsts.h" -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Image; /** diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index 6364ecfe9..b1f059ffe 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -27,12 +27,6 @@ #include <guichan/widgetlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Image; /** diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 348f48567..1f03fd53b 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -28,12 +28,6 @@ #include "gui/widgets/shortcutcontainer.h" -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Image; class Item; class ItemPopup; diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index 06c009f0b..743ca4e87 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -27,12 +27,6 @@ #include <vector> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class AnimatedSprite; class Image; class TextPopup; diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h index 2ef6035f0..d1f276b3c 100644 --- a/src/gui/widgets/flowcontainer.h +++ b/src/gui/widgets/flowcontainer.h @@ -26,12 +26,6 @@ #include <guichan/widgetlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - /** * A container that arranges its contents like words on a page. * diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index cf3cb8ad8..17f517644 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -33,12 +33,6 @@ #include <vector> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class GuiTableActionListener; /** diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h index 80014c171..2a3f77d2b 100644 --- a/src/gui/widgets/horizontcontainer.h +++ b/src/gui/widgets/horizontcontainer.h @@ -26,12 +26,6 @@ #include <guichan/widgetlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - /** * A widget container. * diff --git a/src/gui/widgets/inventoryfilter.h b/src/gui/widgets/inventoryfilter.h index be69489a8..c3762189e 100644 --- a/src/gui/widgets/inventoryfilter.h +++ b/src/gui/widgets/inventoryfilter.h @@ -27,12 +27,6 @@ #include "gui/widgets/horizontcontainer.h" -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class InventoryFilter : public HorizontContainer, public gcn::ActionListener { public: diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index e4188f54b..2c465fdee 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -31,12 +31,6 @@ #include <list> #include <algorithm> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Image; class Inventory; class Item; diff --git a/src/gui/widgets/itemlinkhandler.h b/src/gui/widgets/itemlinkhandler.h index 8dd2f62f5..bc3bdc51c 100644 --- a/src/gui/widgets/itemlinkhandler.h +++ b/src/gui/widgets/itemlinkhandler.h @@ -25,21 +25,16 @@ #include "gui/widgets/linkhandler.h" -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class ItemPopup; class ItemLinkHandler : public LinkHandler { public: ItemLinkHandler(); + ~ItemLinkHandler(); - void handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED); + + void handleLink(const std::string &link, gcn::MouseEvent *event); private: ItemPopup *mItemPopup; diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index 473cef350..587723279 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -29,12 +29,6 @@ #include <guichan/mouselistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Image; class Item; class ItemPopup; diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp index 7f2f1f621..f0359062e 100644 --- a/src/gui/widgets/layout.cpp +++ b/src/gui/widgets/layout.cpp @@ -222,11 +222,15 @@ LayoutCell &LayoutArray::place(gcn::Widget *widget, int x, int y, int w, int h) return cell; } -void LayoutArray::align(int &pos, int &size, int dim, - LayoutCell const &cell, int *sizes) const +void LayoutArray::align(int &pos, int &size, int dim, LayoutCell const &cell, + int *sizes, int sizeCount) const { int size_max = sizes[0]; - for (int i = 1; i < cell.mExtent[dim]; ++i) + int cnt = cell.mExtent[dim]; + if (sizeCount && cell.mExtent[dim] > sizeCount) + cnt = sizeCount; + + for (int i = 1; i < cnt; ++i) size_max += sizes[i] + mSpacing; size = std::min<int>(cell.mSize[dim], size_max); @@ -274,7 +278,8 @@ std::vector<int> LayoutArray::getSizes(int dim, int upp) const } } - if (upp == Layout::AUTO_DEF) return sizes; + if (upp == Layout::AUTO_DEF) + return sizes; // Compute the FILL sizes. int nb = static_cast<int>(sizes.size()); @@ -343,8 +348,10 @@ void LayoutArray::reflow(int nx, int ny, int nw, int nh) if (cell && cell->mType != LayoutCell::NONE) { int dx = x, dy = y, dw = 0, dh = 0; - align(dx, dw, 0, *cell, &widths[gridX]); - align(dy, dh, 1, *cell, &heights[gridY]); + align(dx, dw, 0, *cell, &widths[gridX], + widths.size() - gridX); + align(dy, dh, 1, *cell, &heights[gridY], + heights.size() - gridY); cell->reflow(dx, dy, dw, dh); } x += widths[gridX] + mSpacing; diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index c4c703644..754d13a0b 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -127,8 +127,8 @@ class LayoutArray /** * Gets the position and size of a widget along a given axis */ - void align(int &pos, int &size, int dim, - LayoutCell const &cell, int *sizes) const; + void align(int &pos, int &size, int dim, LayoutCell const &cell, + int *sizes, int sizeCount) const; /** * Ensures the private vectors are large enough. diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h index c38356c07..a01051595 100644 --- a/src/gui/widgets/layouthelper.h +++ b/src/gui/widgets/layouthelper.h @@ -27,12 +27,6 @@ #include <guichan/widgetlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - /** * A helper class for adding a layout to a Guichan container widget. The layout * will register itself as a widget listener and relayout the widgets in the diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 418b83f58..8ac0bbc3b 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -25,12 +25,6 @@ #include <guichan/widgets/listbox.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class SelectionListener; /** diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 9d4343ba3..64e4b52ac 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -32,12 +32,6 @@ #include <guichan/mouselistener.hpp> #include <guichan/widgetlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class GraphicsVertexes; class Skin; class WindowContainer; diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index 677195bd6..d1c347acb 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -25,12 +25,6 @@ #include <guichan/widgets/radiobutton.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Image; /** diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 56e21c58c..105791080 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -26,12 +26,6 @@ #include <guichan/widgets/scrollarea.hpp> #include <guichan/widgetlistener.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class GraphicsVertexes; class Image; class ImageRect; diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index 15d2d41ea..5b8a9df87 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -33,12 +33,6 @@ #include <list> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class CheckBox; class Configuration; class ContainerPlacer; diff --git a/src/gui/widgets/setuptabscroll.h b/src/gui/widgets/setuptabscroll.h index d2aa7002f..2b0c6f65e 100644 --- a/src/gui/widgets/setuptabscroll.h +++ b/src/gui/widgets/setuptabscroll.h @@ -26,11 +26,7 @@ #include <map> #include <set> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif +#include "localconsts.h" class SetupItem; class ScrollArea; diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 38e238f20..c5acbbefc 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -25,12 +25,6 @@ #include "gui/widgets/listbox.h" -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class ShopItems; class ItemPopup; @@ -82,7 +76,7 @@ class ShopListBox : public ListBox void mouseMoved(gcn::MouseEvent &event); - void mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED); + void mouseExited(gcn::MouseEvent& mouseEvent); private: void init(); diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index df8529bd5..8587950c6 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -29,12 +29,6 @@ #include "gui/widgets/tab.h" -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Image; /** @@ -55,7 +49,8 @@ class ShortcutContainer : public gcn::Widget, /** * Destructor. */ - ~ShortcutContainer() {} + ~ShortcutContainer() + { } /** * Draws the shortcuts diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index 619c0c795..9ac45d0a0 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -25,12 +25,6 @@ #include <guichan/widgets/slider.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Image; /** diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index 88b00338a..4191f9921 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -27,13 +27,6 @@ #include <guichan/mouselistener.hpp> #include "gui/widgets/shortcutcontainer.h" -//#include "textcommand.h" - -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif class Image; class SpellPopup; diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index af241d7c5..d71109dd3 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -32,12 +32,6 @@ #include <string> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class Tab; /** diff --git a/src/gui/widgets/vertcontainer.h b/src/gui/widgets/vertcontainer.h index 3b0ceeca7..08546aa47 100644 --- a/src/gui/widgets/vertcontainer.h +++ b/src/gui/widgets/vertcontainer.h @@ -28,12 +28,6 @@ #include <vector> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - /** * A widget container. * diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index c99c4e0c5..33859d8be 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -165,3 +165,8 @@ void WhisperTab::saveToLogFile(std::string &msg) if (chatLogger) chatLogger->log(getNick(), msg); } + +void WhisperTab::getAutoCompleteList(std::vector<std::string> &names) const +{ + names.push_back(mNick); +} diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index 5bca422a6..8678c932c 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -33,7 +33,8 @@ class Channel; class WhisperTab : public ChatTab { public: - const std::string &getNick() const { return mNick; } + const std::string &getNick() const + { return mNick; } void showHelp(); @@ -45,6 +46,8 @@ class WhisperTab : public ChatTab void saveToLogFile(std::string &msg); + void getAutoCompleteList(std::vector<std::string> &names) const; + protected: friend class ChatWindow; diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 5ace2328e..6249626d3 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -31,12 +31,6 @@ #include <guichan/widgets/window.hpp> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class ContainerPlacer; class GraphicsVertexes; class Layout; diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index 739a302ba..3f02ea851 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -29,15 +29,11 @@ #include <guichan/actionlistener.hpp> #include <guichan/selectionlistener.hpp> +#include "localconsts.h" + #include <map> #include <vector> -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - class EmotePopup; class TextPopup; |