diff options
author | Blue <bluesansdouze@gmail.com> | 2009-05-12 20:46:56 +0200 |
---|---|---|
committer | Blue <bluesansdouze@gmail.com> | 2009-05-12 20:46:56 +0200 |
commit | 9071a692116745f2cafd8556cbff28095910730e (patch) | |
tree | 6fbc96a1cb00558c4015d1eff25f45b2c6ccdcb8 /src | |
parent | 2e94f4e92821bad6ebb328d00b2bd918c4b1b99e (diff) | |
parent | 0257eaf4d3945eac7cb3e50ccf8dfef18fa29698 (diff) | |
download | mana-9071a692116745f2cafd8556cbff28095910730e.tar.gz mana-9071a692116745f2cafd8556cbff28095910730e.tar.bz2 mana-9071a692116745f2cafd8556cbff28095910730e.tar.xz mana-9071a692116745f2cafd8556cbff28095910730e.zip |
Merge branch 'master' of git@gitorious.org:tmw/mainline
Diffstat (limited to 'src')
49 files changed, 340 insertions, 568 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 861d9d18..08110c43 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,6 +14,10 @@ SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"") SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"") SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"") +IF (WIN32) + SET(EXTRA_LIBRARIES ws2_32 winmm) +ENDIF() + SET(GUICHAN_COMPONENTS "SDL") FIND_PACKAGE(Guichan REQUIRED ${GUICHAN_COMPONENTS}) @@ -548,8 +552,8 @@ SET(SRCS_TMW SET (PROGRAMS tmw tmw-ea) -ADD_EXECUTABLE(tmw ${SRCS} ${SRCS_TMW}) -ADD_EXECUTABLE(tmw-ea ${SRCS} ${SRCS_EA}) +ADD_EXECUTABLE(tmw WIN32 ${SRCS} ${SRCS_TMW}) +ADD_EXECUTABLE(tmw-ea WIN32 ${SRCS} ${SRCS_EA}) FOREACH(program ${PROGRAMS}) TARGET_LINK_LIBRARIES(${program} ${SDL_LIBRARY} @@ -563,7 +567,8 @@ FOREACH(program ${PROGRAMS}) ${CURL_LIBRARIES} ${LIBXML2_LIBRARIES} ${GUICHAN_LIBRARIES} - ${OPENGL_LIBRARIES}) + ${OPENGL_LIBRARIES} + ${EXTRA_LIBRARIES}) INSTALL(TARGETS ${program} RUNTIME DESTINATION ${PKG_BINDIR}) ENDFOREACH(program) diff --git a/src/being.h b/src/being.h index 4d1b0138..6c849350 100644 --- a/src/being.h +++ b/src/being.h @@ -131,8 +131,7 @@ class Being : public Sprite, public ConfigListener NO_SPEECH = 0, TEXT_OVERHEAD, NO_NAME_IN_BUBBLE, - NAME_IN_BUBBLE, - NUM_SPEECH + NAME_IN_BUBBLE }; enum AttackType diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 6265f350..462cb3b9 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -34,6 +34,7 @@ #include "net/chathandler.h" #include "net/maphandler.h" #include "net/net.h" +#include "net/partyhandler.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -369,7 +370,7 @@ void CommandHandler::handleListChannels(const std::string &args, ChatTab *tab) void CommandHandler::handleParty(const std::string &args, ChatTab *tab) { if (args != "") - player_node->inviteToParty(args); + Net::getPartyHandler()->invite(args); else tab->chatLog("Please specify a name.", BY_SERVER); } diff --git a/src/game.cpp b/src/game.cpp index d3ca2e7c..b56cbdde 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -920,19 +920,8 @@ void Game::handleInput() if (keyboard.isKeyActive(keyboard.KEY_ATTACK) || (joystick && joystick->buttonPressed(0))) { - Being *target = NULL; - - bool newTarget = !keyboard.isKeyActive(keyboard.KEY_TARGET); - // A set target has highest priority - if (!player_node->getTarget()) - { - Uint16 targetX = x, targetY = y; - - // Only auto target Monsters - target = beingManager->findNearestLivingBeing(targetX, targetY, - 20, Being::MONSTER); - } - player_node->attack(target, newTarget); + if (player_node->getTarget()) + player_node->attack(player_node->getTarget(), true); } #endif diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 027297a2..eca224fc 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -493,7 +493,8 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo) ChatTab *ret = mWhispers[tempNick] = new WhisperTab(nick); - mChatTabs->setSelectedTab(ret); + if (switchTo) + mChatTabs->setSelectedTab(ret); return ret; } diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index aa81361d..44006971 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -33,6 +33,9 @@ #include "item.h" #include "localplayer.h" +#include "net/inventoryhandler.h" +#include "net/net.h" + #include "resources/image.h" #include "resources/iteminfo.h" #include "resources/resourcemanager.h" @@ -176,7 +179,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event) mInventory->getItem(mEquipment->getEquipment(mSelected)) : mInventory->getItem(mEquipment->getArrows()); #endif - player_node->unequipItem(item); + Net::getInventoryHandler()->unequipItem(item); setSelected(-1); } } diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index efa5bc2e..d6cd3a84 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -92,8 +92,8 @@ InventoryWindow::InventoryWindow(int invSize): mSlotsLabel = new Label(_("Slots:")); mWeightLabel = new Label(_("Weight:")); - mSlotsBar = new ProgressBar(1.0f, 100, 20, gcn::Color(225, 200, 25)); - mWeightBar = new ProgressBar(1.0f, 100, 20, gcn::Color(0, 0, 255)); + mSlotsBar = new ProgressBar(0.0f, 100, 20, gcn::Color(225, 200, 25)); + mWeightBar = new ProgressBar(0.0f, 100, 20, gcn::Color(0, 0, 255)); place(0, 0, mWeightLabel).setPadding(3); place(1, 0, mWeightBar, 3); @@ -166,12 +166,12 @@ void InventoryWindow::action(const gcn::ActionEvent &event) if (item->isEquipment()) { if (item->isEquipped()) - player_node->unequipItem(item); + Net::getInventoryHandler()->unequipItem(item); else - player_node->equipItem(item); + Net::getInventoryHandler()->equipItem(item); } else - player_node->useItem(item); + Net::getInventoryHandler()->useItem(item); } else if (event.getId() == "drop") { diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp index 393cd8bc..252daf19 100644 --- a/src/gui/itemamount.cpp +++ b/src/gui/itemamount.cpp @@ -33,7 +33,9 @@ #include "gui/widgets/icon.h" #include "item.h" -#include "localplayer.h" + +#include "net/inventoryhandler.h" +#include "net/net.h" #include "utils/gettext.h" @@ -45,10 +47,10 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage) tradeWindow->tradeItem(item, amount); break; case ItemDrop: - player_node->dropItem(item, amount); + Net::getInventoryHandler()->dropItem(item, amount); break; case ItemSplit: - player_node->splitItem(item, amount); + Net::getInventoryHandler()->splitItem(item, amount); break; case StoreAdd: storageWindow->addStore(item, amount); diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 4779b004..6cbdabb2 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -27,11 +27,13 @@ #include "gui/sdlinput.h" #include "gui/viewport.h" +#include "net/net.h" +#include "net/inventoryhandler.h" + #include "graphics.h" #include "inventory.h" #include "item.h" #include "itemshortcut.h" -#include "localplayer.h" #include "log.h" #include "resources/image.h" @@ -53,8 +55,8 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity): mInventory(inventory), mGridColumns(1), mGridRows(1), - mSelectedItem(NULL), - mHighlightedItem(NULL), + mSelectedIndex(-1), + mHighlightedIndex(-1), mSelectionStatus(SEL_NONE), mForceQuantity(forceQuantity), mSwapItems(false), @@ -92,8 +94,8 @@ void ItemContainer::draw(gcn::Graphics *graphics) { int itemX = i * BOX_WIDTH; int itemY = j * BOX_HEIGHT; - - Item *item = mInventory->getItem((j * mGridColumns) + i); + int itemIndex = (j * mGridColumns) + i; + Item *item = mInventory->getItem(itemIndex); if (!item || item->getId() == 0) continue; @@ -101,7 +103,7 @@ void ItemContainer::draw(gcn::Graphics *graphics) Image *image = item->getImage(); if (image) { - if (item == mSelectedItem) + if (itemIndex == mSelectedIndex) { if (mSelectionStatus == SEL_DRAGGING) { // Reposition the coords to that of the cursor. @@ -133,11 +135,10 @@ void ItemContainer::draw(gcn::Graphics *graphics) } // Draw an orange box around the selected item - if (isFocused() && mHighlightedItem) + if (isFocused() && mHighlightedIndex != -1) { - const int i = mHighlightedItem->getInvIndex(); - const int itemX = (i % mGridColumns) * BOX_WIDTH; - const int itemY = (i / mGridColumns) * BOX_HEIGHT; + const int itemX = (mHighlightedIndex % mGridColumns) * BOX_WIDTH; + const int itemY = (mHighlightedIndex / mGridColumns) * BOX_HEIGHT; g->setColor(gcn::Color(255, 128, 0)); g->drawRectangle(gcn::Rectangle(itemX, itemY, BOX_WIDTH, BOX_HEIGHT)); } @@ -145,18 +146,24 @@ void ItemContainer::draw(gcn::Graphics *graphics) void ItemContainer::selectNone() { - setSelectedItem(NULL); + setSelectedIndex(-1); + mSelectionStatus = SEL_NONE; } -void ItemContainer::setSelectedItem(Item *item) +void ItemContainer::setSelectedIndex(int newIndex) { - if (mSelectedItem != item) + if (mSelectedIndex != newIndex) { - mSelectedItem = item; + mSelectedIndex = newIndex; distributeValueChangedEvent(); } } +Item *ItemContainer::getSelectedItem() const +{ + return mInventory->getItem(mSelectedIndex); +} + void ItemContainer::distributeValueChangedEvent() { SelectionListenerIterator i, i_end; @@ -229,21 +236,20 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) chatWindow->addItemText(item->getInfo().getName()); } - if (mSelectedItem && mSelectedItem == item) + if (mSelectedIndex == index) { mSelectionStatus = SEL_DESELECTING; } else if (item && item->getId()) { - setSelectedItem(item); + setSelectedIndex(index); mSelectionStatus = SEL_SELECTING; itemShortcut->setItemSelected(item->getId()); } else { - setSelectedItem(NULL); - mSelectionStatus = SEL_NONE; + selectNone(); } } } @@ -266,8 +272,7 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event) mSelectionStatus = SEL_SELECTED; return; case SEL_DESELECTING: - setSelectedItem(NULL); - mSelectionStatus = SEL_NONE; + selectNone(); return; case SEL_DRAGGING: mSelectionStatus = SEL_SELECTED; @@ -279,12 +284,10 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event) int index = getSlotIndex(event.getX(), event.getY()); if (index == Inventory::NO_SLOT_INDEX) return; - Item *item = mInventory->getItem(index); - if (item == mSelectedItem) + if (index == mSelectedIndex || mSelectedIndex == -1) return; - player_node->moveInvItem(mSelectedItem, index); - setSelectedItem(NULL); - mSelectionStatus = SEL_NONE; + Net::getInventoryHandler()->moveItem(mSelectedIndex, index); + selectNone(); } @@ -332,49 +335,47 @@ int ItemContainer::getSlotIndex(int x, int y) const void ItemContainer::keyAction() { // If there is no highlight then return. - if (!mHighlightedItem) + if (mHighlightedIndex == -1) return; // If the highlight is on the selected item, then deselect it. - if (mHighlightedItem == mSelectedItem) + if (mHighlightedIndex == mSelectedIndex) { - setSelectedItem(NULL); - mSelectionStatus = SEL_NONE; + selectNone(); } // Check and swap items if necessary. else if (mSwapItems && - mSelectedItem && - mHighlightedItem->getId()) + mSelectedIndex != -1 && + mHighlightedIndex != -1) { - player_node->moveInvItem( - mSelectedItem, mHighlightedItem->getInvIndex()); - setSelectedItem(mHighlightedItem); + Net::getInventoryHandler()->moveItem( + mSelectedIndex, mHighlightedIndex); + setSelectedIndex(mHighlightedIndex); } // If the highlight is on an item then select it. - else if (mHighlightedItem->getId()) + else if (mHighlightedIndex != -1) { - setSelectedItem(mHighlightedItem); + setSelectedIndex(mHighlightedIndex); mSelectionStatus = SEL_SELECTED; } // If the highlight is on a blank space then move it. - else if (mSelectedItem) + else if (mSelectedIndex != -1) { - player_node->moveInvItem( - mSelectedItem, mHighlightedItem->getInvIndex()); - setSelectedItem(NULL); - mSelectionStatus = SEL_NONE; + Net::getInventoryHandler()->moveItem( + mSelectedIndex, mHighlightedIndex); + selectNone(); } } void ItemContainer::moveHighlight(Direction direction) { - if (!mHighlightedItem) + if (mHighlightedIndex == -1) { - if (mSelectedItem) { - mHighlightedItem = mSelectedItem; + if (mSelectedIndex != -1) { + mHighlightedIndex = mSelectedIndex; } else { - mHighlightedItem = mInventory->getItem(0); + mHighlightedIndex = 0; } return; } @@ -382,34 +383,34 @@ void ItemContainer::moveHighlight(Direction direction) switch (direction) { case Left: - if (mHighlightedItem->getInvIndex() % mGridColumns == 0) + if (mHighlightedIndex % mGridColumns == 0) { - mHighlightedItem += mGridColumns; + mHighlightedIndex += mGridColumns; } - mHighlightedItem--; + mHighlightedIndex--; break; case Right: - if ((mHighlightedItem->getInvIndex() % mGridColumns) == + if ((mHighlightedIndex % mGridColumns) == (mGridColumns - 1)) { - mHighlightedItem -= mGridColumns; + mHighlightedIndex -= mGridColumns; } - mHighlightedItem++; + mHighlightedIndex++; break; case Up: - if (mHighlightedItem->getInvIndex() / mGridColumns == 0) + if (mHighlightedIndex / mGridColumns == 0) { - mHighlightedItem += (mGridColumns * mGridRows); + mHighlightedIndex += (mGridColumns * mGridRows); } - mHighlightedItem -= mGridColumns; + mHighlightedIndex -= mGridColumns; break; case Down: - if ((mHighlightedItem->getInvIndex() / mGridColumns) == + if ((mHighlightedIndex / mGridColumns) == (mGridRows - 1)) { - mHighlightedItem -= (mGridColumns * mGridRows); + mHighlightedIndex -= (mGridColumns * mGridRows); } - mHighlightedItem += mGridColumns; + mHighlightedIndex += mGridColumns; break; } } diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index bc7caf5d..f446a647 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -86,8 +86,7 @@ class ItemContainer : public gcn::Widget, /** * Returns the selected item. */ - Item *getSelectedItem() const - { return mSelectedItem; } + Item *getSelectedItem() const; /** * Sets selected item to NULL. @@ -145,7 +144,7 @@ class ItemContainer : public gcn::Widget, /** * Sets the currently selected item. */ - void setSelectedItem(Item *item); + void setSelectedIndex(int index); /** * Find the current item index by the most recently used item ID @@ -174,7 +173,7 @@ class ItemContainer : public gcn::Widget, Inventory *mInventory; int mGridColumns, mGridRows; Image *mSelImg; - Item *mSelectedItem, *mHighlightedItem; + int mSelectedIndex, mHighlightedIndex; SelectionState mSelectionStatus; bool mForceQuantity; bool mSwapItems; diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 3dab63a3..a5bdc59d 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -31,7 +31,6 @@ #include "player.h" #include "gui/palette.h" -#include "gui/partywindow.h" #include "resources/image.h" #include "resources/resourcemanager.h" @@ -56,13 +55,13 @@ Minimap::Minimap(): setResizable(false); setDefaultVisible(true); - setSaveVisible(false); + setSaveVisible(true); setStickyButton(true); setSticky(false); loadWindowState(); - setVisible(mShow); + setVisible(mShow, isSticky()); } Minimap::~Minimap() @@ -94,9 +93,6 @@ void Minimap::setMap(Map *map) ResourceManager *resman = ResourceManager::getInstance(); mMapImage = resman->getImage(map->getProperty("minimap")); - if (!mShow) - return; - if (mMapImage) { const int offsetX = 2 * getPadding(); @@ -120,17 +116,19 @@ void Minimap::setMap(Map *map) setDefaultSize(getX(), getY(), getWidth(), getHeight()); resetToDefaultSize(); - setVisible(true); + if (mShow) + setVisible(true); } else { - setVisible(false); + if (!isSticky()) + setVisible(false); } } void Minimap::toggle() { - setVisible(!mShow, isSticky()); + setVisible(!isVisible(), isSticky()); mShow = isVisible(); } @@ -183,6 +181,8 @@ void Minimap::draw(gcn::Graphics *graphics) { case Being::PLAYER: { + const Player *player = static_cast<const Player*>(being); + Palette::ColorType type = Palette::PC; if (being == player_node) @@ -190,14 +190,15 @@ void Minimap::draw(gcn::Graphics *graphics) type = Palette::SELF; dotSize = 3; } - else if (partyWindow->findMember(being->getId())) + else if (player->isGM()) + { + type = Palette::GM_NAME; + } + else if (player->isInParty()) { type = Palette::PARTY; } - if (static_cast<const Player*>(being)->isGM()) - type = Palette::GM_NAME; - graphics->setColor(guiPalette->getColor(type)); break; } diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index b4bc29e9..65d2391d 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -36,10 +36,10 @@ MiniStatusWindow::MiniStatusWindow(): Popup("MiniStatus") { - mHpBar = new ProgressBar(1.0f, 100, 20, gcn::Color(0, 171, 34)); + mHpBar = new ProgressBar(0.0f, 100, 20, gcn::Color(0, 171, 34)); #ifdef EATHENA_SUPPORT - mMpBar = new ProgressBar(1.0f, 100, 20, gcn::Color(26, 102, 230)); - mXpBar = new ProgressBar(1.0f, 100, 20, gcn::Color(143, 192, 211)); + mMpBar = new ProgressBar(0.0f, 100, 20, gcn::Color(26, 102, 230)); + mXpBar = new ProgressBar(0.0f, 100, 20, gcn::Color(143, 192, 211)); #endif mHpBar->setPosition(0, 3); diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index dbd8f3ef..317811ee 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -23,6 +23,9 @@ #include "gui/widgets/chattab.h" +#include "beingmanager.h" +#include "player.h" + #include "net/net.h" #include "net/partyhandler.h" @@ -46,15 +49,15 @@ PartyWindow::PartyWindow() : { setWindowName("Party"); setVisible(false); + setSaveVisible(true); setResizable(true); setSaveVisible(true); setCloseButton(true); - setMinWidth(200); + setMinWidth(212); setMinHeight(200); - setDefaultSize(590, 200, 200, 200); + setDefaultSize(590, 200, 212, 200); loadWindowState(); - setVisible(false); // Do not start out visible } PartyWindow::~PartyWindow() @@ -62,6 +65,16 @@ PartyWindow::~PartyWindow() delete_all(mMembers); } +void PartyWindow::setPartyName(const std::string &name) +{ + setCaption(strprintf(_("Party (%s)"), name.c_str())); +} + +void PartyWindow::clearPartyName() +{ + setCaption(_("Party")); +} + PartyMember *PartyWindow::findMember(int id) const { PartyList::const_iterator it = mMembers.find(id); @@ -105,18 +118,15 @@ int PartyWindow::findMember(const std::string &name) const void PartyWindow::updateMember(int id, const std::string &memberName, bool leader, bool online) { - PartyMember *player = findOrCreateMember(id); - player->name = memberName; - player->leader = leader; - player->online = online; - player->avatar->setName(memberName); - player->avatar->setOnline(online); - - // show the window - if (mMembers.size() > 0) - { - setVisible(true); - } + PartyMember *member = findOrCreateMember(id); + member->name = memberName; + member->leader = leader; + member->online = online; + member->avatar->setName(memberName); + member->avatar->setOnline(online); + + if (Player *player = dynamic_cast<Player*>(beingManager->findBeing(id))) + player->setInParty(true); } void PartyWindow::updateMemberHP(int id, int hp, int maxhp) @@ -130,11 +140,8 @@ void PartyWindow::removeMember(int id) { mMembers.erase(id); - // if no-one left, remove the party window - if (mMembers.size() < 1) - { - setVisible(false); - } + if (Player *player = dynamic_cast<Player*>(beingManager->findBeing(id))) + player->setInParty(false); } void PartyWindow::removeMember(const std::string &name) @@ -201,10 +208,19 @@ void PartyWindow::action(const gcn::ActionEvent &event) } } +void clearMembersSub(const std::pair<int, PartyMember*> &p) +{ + Player *player = dynamic_cast<Player*>(beingManager->findBeing(p.first)); + if (player) + player->setInParty(false); +} + void PartyWindow::clearMembers() { clearLayout(); + std::for_each(mMembers.begin(), mMembers.end(), clearMembersSub); + delete_all(mMembers); mMembers.clear(); } diff --git a/src/gui/partywindow.h b/src/gui/partywindow.h index 65e8d772..8cea500f 100644 --- a/src/gui/partywindow.h +++ b/src/gui/partywindow.h @@ -65,6 +65,10 @@ class PartyWindow : public Window, gcn::ActionListener */ ~PartyWindow(); + void setPartyName(const std::string &name); + + void clearPartyName(); + /** * Find a party member based on ID. Returns NULL if not found. */ diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 46a33d6c..2dcf2628 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -40,6 +40,8 @@ #include "net/adminhandler.h" #include "net/inventoryhandler.h" #include "net/net.h" +#include "net/partyhandler.h" +#include "net/tradehandler.h" #include "resources/itemdb.h" #include "resources/iteminfo.h" @@ -182,7 +184,7 @@ void PopupMenu::handleLink(const std::string &link) being && being->getType() == Being::PLAYER) { - player_node->trade(being); + Net::getTradeHandler()->request(being); tradePartnerName = being->getName(); } #ifdef EATHENA_SUPPORT @@ -261,13 +263,13 @@ void PopupMenu::handleLink(const std::string &link) if (mItem->isEquipment()) { if (mItem->isEquipped()) - player_node->unequipItem(mItem); + Net::getInventoryHandler()->unequipItem(mItem); else - player_node->equipItem(mItem); + Net::getInventoryHandler()->equipItem(mItem); } else { - player_node->useItem(mItem); + Net::getInventoryHandler()->useItem(mItem); } } @@ -302,7 +304,7 @@ void PopupMenu::handleLink(const std::string &link) else if (link == "party" && being && being->getType() == Being::PLAYER) { - player_node->inviteToParty(dynamic_cast<Player*>(being)); + Net::getPartyHandler()->invite(dynamic_cast<Player*>(being)); } else if (link == "name" && being) diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index c5dffe3d..f0d88a30 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -221,8 +221,6 @@ Setup_Players::Setup_Players(): mPlayerTable(new GuiTable(mPlayerTableModel)), mPlayerTitleTable(new GuiTable(mPlayerTableTitleModel)), mPlayerScrollArea(new ScrollArea(mPlayerTable)), - mPersistIgnores(new CheckBox(_("Save player list"), - player_relations.getPersistIgnores())), mDefaultTrading(new CheckBox(_("Allow trading"), player_relations.getDefault() & PlayerRelation::TRADE)), mDefaultWhisper(new CheckBox(_("Allow whispers"), @@ -288,9 +286,8 @@ Setup_Players::Setup_Players(): place(0, 6, mWhisperTabCheckBox); place(2, 5, ignore_action_label); place(2, 6, mIgnoreActionChoicesBox, 2).setPadding(2); - place(2, 7, mPersistIgnores); - place(2, 8, mDefaultTrading); - place(2, 9, mDefaultWhisper); + place(2, 7, mDefaultTrading); + place(2, 8, mDefaultWhisper); player_relations.addListener(this); @@ -326,7 +323,6 @@ void Setup_Players::reset() void Setup_Players::apply() { - player_relations.setPersistIgnores(mPersistIgnores->isSelected()); player_relations.store(); unsigned int old_default_relations = player_relations.getDefault() & diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h index d7507d19..3096cab9 100644 --- a/src/gui/setup_players.h +++ b/src/gui/setup_players.h @@ -58,7 +58,6 @@ private: GuiTable *mPlayerTitleTable; gcn::ScrollArea *mPlayerScrollArea; - gcn::CheckBox *mPersistIgnores; gcn::CheckBox *mDefaultTrading; gcn::CheckBox *mDefaultWhisper; diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index bbbeb6d7..9add3251 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -109,10 +109,10 @@ ModeListModel::ModeListModel() const char *SIZE_NAME[4] = { - N_("Tiny"), - N_("Small"), - N_("Medium"), - N_("Large"), + N_("Tiny"), + N_("Small"), + N_("Medium"), + N_("Large"), }; class FontSizeChoiceListModel : public gcn::ListModel @@ -134,6 +134,41 @@ public: } }; +static const char *speechModeToString(Being::Speech mode) +{ + switch (mode) + { + case Being::NO_SPEECH: return _("No text"); + case Being::TEXT_OVERHEAD: return _("Text"); + case Being::NO_NAME_IN_BUBBLE: return _("Bubbles, no names"); + case Being::NAME_IN_BUBBLE: return _("Bubbles with names"); + } + return ""; +} + +static const char *overlayDetailToString(int detail) +{ + switch (detail) + { + case 0: return _("off"); + case 1: return _("low"); + case 2: return _("high"); + } + return ""; +} + +static const char *particleDetailToString(int detail) +{ + switch (detail) + { + case 0: return _("low"); + case 1: return _("medium"); + case 2: return _("high"); + case 3: return _("max"); + } + return ""; +} + Setup_Video::Setup_Video(): mFullScreenEnabled(config.getValue("screen", false)), mOpenGLEnabled(config.getValue("opengl", false)), @@ -145,7 +180,8 @@ Setup_Video::Setup_Video(): mPickupParticleEnabled(config.getValue("showpickupparticle", false)), mOpacity(config.getValue("guialpha", 0.8)), mFps((int) config.getValue("fpslimit", 60)), - mSpeechMode((int) config.getValue("speech", Being::TEXT_OVERHEAD)), + mSpeechMode(static_cast<Being::Speech>( + config.getValue("speech", Being::TEXT_OVERHEAD))), mModeListModel(new ModeListModel), mModeList(new ListBox(mModeListModel)), mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)), @@ -167,12 +203,6 @@ Setup_Video::Setup_Video(): mFpsCheckBox(new CheckBox(_("FPS Limit:"))), mFpsSlider(new Slider(10, 120)), mFpsField(new TextField), - mOriginalScrollLaziness((int) config.getValue("ScrollLaziness", 16)), - mScrollLazinessSlider(new Slider(1, 64)), - mScrollLazinessField(new TextField), - mOriginalScrollRadius((int) config.getValue("ScrollRadius", 0)), - mScrollRadiusSlider(new Slider(0, 128)), - mScrollRadiusField(new TextField), mOverlayDetail((int) config.getValue("OverlayDetail", 2)), mOverlayDetailSlider(new Slider(0, 2)), mOverlayDetailField(new Label("")), @@ -188,8 +218,6 @@ Setup_Video::Setup_Video(): speechLabel = new Label(_("Overhead text")); alphaLabel = new Label(_("Gui opacity")); - scrollRadiusLabel = new Label(_("Scroll radius")); - scrollLazinessLabel = new Label(_("Scroll laziness")); overlayDetailLabel = new Label(_("Ambient FX")); particleDetailLabel = new Label(_("Particle Detail")); fontSizeLabel = new Label(_("Font size")); @@ -223,10 +251,6 @@ Setup_Video::Setup_Video(): mFpsCheckBox->setActionEventId("fpslimitcheckbox"); mSpeechSlider->setActionEventId("speech"); mFpsSlider->setActionEventId("fpslimitslider"); - mScrollRadiusSlider->setActionEventId("scrollradiusslider"); - mScrollRadiusField->setActionEventId("scrollradiusfield"); - mScrollLazinessSlider->setActionEventId("scrolllazinessslider"); - mScrollLazinessField->setActionEventId("scrolllazinessfield"); mOverlayDetailSlider->setActionEventId("overlaydetailslider"); mOverlayDetailField->setActionEventId("overlaydetailfield"); mParticleDetailSlider->setActionEventId("particledetailslider"); @@ -243,98 +267,28 @@ Setup_Video::Setup_Video(): mFpsCheckBox->addActionListener(this); mSpeechSlider->addActionListener(this); mFpsSlider->addActionListener(this); - mFpsField->addKeyListener(this); - mScrollRadiusSlider->addActionListener(this); - mScrollRadiusField->addKeyListener(this); - mScrollLazinessSlider->addActionListener(this); - mScrollLazinessField->addKeyListener(this); mOverlayDetailSlider->addActionListener(this); mOverlayDetailField->addKeyListener(this); mParticleDetailSlider->addActionListener(this); mParticleDetailField->addKeyListener(this); - mScrollRadiusField->setText(toString(mOriginalScrollRadius)); - mScrollRadiusSlider->setValue(mOriginalScrollRadius); - - mScrollLazinessField->setText(toString(mOriginalScrollLaziness)); - mScrollLazinessSlider->setValue(mOriginalScrollLaziness); - - switch (mSpeechMode) - { - case 0: - mSpeechLabel->setCaption(_("No text")); - break; - case 1: - mSpeechLabel->setCaption(_("Text")); - break; - case 2: - mSpeechLabel->setCaption(_("Bubbles, no names")); - break; - case 3: - mSpeechLabel->setCaption(_("Bubbles with names")); - break; - } + mSpeechLabel->setCaption(speechModeToString(mSpeechMode)); mSpeechSlider->setValue(mSpeechMode); - switch (mOverlayDetail) - { - case 0: - mOverlayDetailField->setCaption(_("off")); - break; - case 1: - mOverlayDetailField->setCaption(_("low")); - break; - case 2: - mOverlayDetailField->setCaption(_("high")); - break; - } + mOverlayDetailField->setCaption(overlayDetailToString(mOverlayDetail)); mOverlayDetailSlider->setValue(mOverlayDetail); - switch (mParticleDetail) - { - case 0: - mParticleDetailField->setCaption(_("low")); - break; - case 1: - mParticleDetailField->setCaption(_("medium")); - break; - case 2: - mParticleDetailField->setCaption(_("high")); - break; - case 3: - mParticleDetailField->setCaption(_("max")); - break; - } + mParticleDetailField->setCaption(particleDetailToString(mParticleDetail)); mParticleDetailSlider->setValue(mParticleDetail); - int fontSizeSelected; - switch (mFontSize) - { - case 10: - fontSizeSelected = 0; - break; - case 11: - fontSizeSelected = 1; - break; - case 12: - fontSizeSelected = 2; - break; - case 13: - fontSizeSelected = 3; - break; - default: - fontSizeSelected = 1; - break; - } - - mFontSizeDropDown->setSelected(fontSizeSelected); + mFontSizeDropDown->setSelected(mFontSize - 10); mFontSizeDropDown->adjustHeight(); // Do the layout LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); - place(0, 0, scrollArea, 1, 6).setPadding(2); + place(0, 0, scrollArea, 1, 5).setPadding(2); place(1, 0, mFsCheckBox, 2); place(3, 0, mOpenGLCheckBox, 1); @@ -360,25 +314,17 @@ Setup_Video::Setup_Video(): place(1, 8, mFpsCheckBox).setPadding(3); place(2, 8, mFpsField).setPadding(1); - place(0, 9, mScrollRadiusSlider); - place(1, 9, scrollRadiusLabel); - place(2, 9, mScrollRadiusField).setPadding(1); + place(0, 9, mSpeechSlider); + place(1, 9, speechLabel); + place(2, 9, mSpeechLabel, 3).setPadding(2); - place(0, 10, mScrollLazinessSlider); - place(1, 10, scrollLazinessLabel); - place(2, 10, mScrollLazinessField).setPadding(1); + place(0, 10, mOverlayDetailSlider); + place(1, 10, overlayDetailLabel); + place(2, 10, mOverlayDetailField, 3).setPadding(2); - place(0, 11, mSpeechSlider); - place(1, 11, speechLabel); - place(2, 11, mSpeechLabel, 3).setPadding(2); - - place(0, 12, mOverlayDetailSlider); - place(1, 12, overlayDetailLabel); - place(2, 12, mOverlayDetailField, 3).setPadding(2); - - place(0, 13, mParticleDetailSlider); - place(1, 13, particleDetailLabel); - place(2, 13, mParticleDetailField, 3).setPadding(2); + place(0, 11, mParticleDetailSlider); + place(1, 11, particleDetailLabel); + place(2, 11, mParticleDetailField, 3).setPadding(2); setDimension(gcn::Rectangle(0, 0, 325, 300)); } @@ -446,7 +392,8 @@ void Setup_Video::apply() mVisibleNamesEnabled = config.getValue("visiblenames", true); mParticleEffectsEnabled = config.getValue("particleeffects", true); mNameEnabled = config.getValue("showownname", false); - mSpeechMode = (int) config.getValue("speech", Being::TEXT_OVERHEAD); + mSpeechMode = static_cast<Being::Speech>( + config.getValue("speech", Being::TEXT_OVERHEAD)); mOpacity = config.getValue("guialpha", 0.8); mOverlayDetail = (int) config.getValue("OverlayDetail", 2); mOpenGLEnabled = config.getValue("opengl", false); @@ -454,26 +401,6 @@ void Setup_Video::apply() mPickupParticleEnabled = config.getValue("showpickupparticle", false); } -int Setup_Video::updateSlider(gcn::Slider *slider, gcn::TextField *field, - const std::string &configName) -{ - int value; - std::stringstream temp(field->getText()); - temp >> value; - if (value < slider->getScaleStart()) - { - value = (int) slider->getScaleStart(); - } - else if (value > slider->getScaleEnd()) - { - value = (int) slider->getScaleEnd(); - } - field->setText(toString(value)); - slider->setValue(value); - config.setValue(configName, value); - return value; -} - void Setup_Video::cancel() { mFsCheckBox->setSelected(mFullScreenEnabled); @@ -487,11 +414,6 @@ void Setup_Video::cancel() mOverlayDetailSlider->setValue(mOverlayDetail); mParticleDetailSlider->setValue(mParticleDetail); - mScrollRadiusField->setText(toString(mOriginalScrollRadius)); - mScrollLazinessField->setText(toString(mOriginalScrollLaziness)); - updateSlider(mScrollRadiusSlider, mScrollRadiusField, "ScrollRadius"); - updateSlider(mScrollLazinessSlider, mScrollLazinessField, "ScrollLaziness"); - config.setValue("screen", mFullScreenEnabled); config.setValue("customcursor", mCustomCursorEnabled); config.setValue("visiblenames", mVisibleNamesEnabled); @@ -557,22 +479,9 @@ void Setup_Video::action(const gcn::ActionEvent &event) } else if (event.getId() == "speech") { - int val = (int) mSpeechSlider->getValue(); - switch (val) - { - case 0: - mSpeechLabel->setCaption(_("No text")); - break; - case 1: - mSpeechLabel->setCaption(_("Text")); - break; - case 2: - mSpeechLabel->setCaption(_("Bubbles, no names")); - break; - case 3: - mSpeechLabel->setCaption(_("Bubbles with names")); - break; - } + Being::Speech val = + static_cast<Being::Speech>(mSpeechSlider->getValue()); + mSpeechLabel->setCaption(speechModeToString(val)); mSpeechSlider->setValue(val); config.setValue("speech", val); } @@ -589,53 +498,16 @@ void Setup_Video::action(const gcn::ActionEvent &event) mFps = (int) mFpsSlider->getValue(); mFpsField->setText(toString(mFps)); } - else if (event.getId() == "scrollradiusslider") - { - int val = (int) mScrollRadiusSlider->getValue(); - mScrollRadiusField->setText(toString(val)); - config.setValue("ScrollRadius", val); - } - else if (event.getId() == "scrolllazinessslider") - { - int val = (int) mScrollLazinessSlider->getValue(); - mScrollLazinessField->setText(toString(val)); - config.setValue("ScrollLaziness", val); - } else if (event.getId() == "overlaydetailslider") { int val = (int) mOverlayDetailSlider->getValue(); - switch (val) - { - case 0: - mOverlayDetailField->setCaption(_("off")); - break; - case 1: - mOverlayDetailField->setCaption(_("low")); - break; - case 2: - mOverlayDetailField->setCaption(_("high")); - break; - } + mOverlayDetailField->setCaption(overlayDetailToString(val)); config.setValue("OverlayDetail", val); } else if (event.getId() == "particledetailslider") { int val = (int) mParticleDetailSlider->getValue(); - switch (val) - { - case 0: - mParticleDetailField->setCaption(_("low")); - break; - case 1: - mParticleDetailField->setCaption(_("medium")); - break; - case 2: - mParticleDetailField->setCaption(_("high")); - break; - case 3: - mParticleDetailField->setCaption(_("max")); - break; - } + mParticleDetailField->setCaption(particleDetailToString(val)); config.setValue("particleEmitterSkip", 3 - val); Particle::emitterSkip = 4 - val; } @@ -678,6 +550,4 @@ void Setup_Video::keyPressed(gcn::KeyEvent &event) mFpsField->setText(""); mFps = 0; } - updateSlider(mScrollRadiusSlider, mScrollRadiusField, "ScrollRadius"); - updateSlider(mScrollLazinessSlider, mScrollLazinessField, "ScrollLaziness"); } diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 9b9cbfde..01b9cd4f 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -22,6 +22,7 @@ #ifndef GUI_SETUP_VIDEO_H #define GUI_SETUP_VIDEO_H +#include "being.h" #include "guichanfwd.h" #include "gui/setuptab.h" @@ -44,9 +45,6 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, void keyPressed(gcn::KeyEvent &event); private: - int updateSlider(gcn::Slider *slider, gcn::TextField *field, - const std::string &configName); - bool mFullScreenEnabled; bool mOpenGLEnabled; bool mCustomCursorEnabled; @@ -57,7 +55,7 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, bool mPickupParticleEnabled; double mOpacity; int mFps; - int mSpeechMode; + Being::Speech mSpeechMode; class ModeListModel *mModeListModel; @@ -88,14 +86,6 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, gcn::Slider *mFpsSlider; gcn::TextField *mFpsField; - int mOriginalScrollLaziness; - gcn::Slider *mScrollLazinessSlider; - gcn::TextField *mScrollLazinessField; - - int mOriginalScrollRadius; - gcn::Slider *mScrollRadiusSlider; - gcn::TextField *mScrollRadiusField; - int mOverlayDetail; gcn::Slider *mOverlayDetailSlider; gcn::Label *mOverlayDetailField; diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index b6f6f124..3a4fb75c 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -33,6 +33,9 @@ #include "localplayer.h" #include "log.h" +#include "net/net.h" +#include "net/skillhandler.h" + #include "utils/dtor.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -173,7 +176,7 @@ void SkillDialog::action(const gcn::ActionEvent &event) // Increment skill int selectedSkill = mTable->getSelectedRow(); if (selectedSkill >= 0) - player_node->raiseSkill(mSkillList[selectedSkill]->id); + Net::getSkillHandler()->up(mSkillList[selectedSkill]->id); } else if (event.getId() == "skill" && mTable->getSelectedRow() > -1) { diff --git a/src/gui/status.cpp b/src/gui/status.cpp index c9681fa9..7fc42fdb 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -58,16 +58,16 @@ StatusWindow::StatusWindow(LocalPlayer *player): Units::formatCurrency(mCurrency).c_str())); mHpLabel = new Label(_("HP:")); - mHpBar = new ProgressBar(1.0f, 80, 15, gcn::Color(0, 171, 34)); + mHpBar = new ProgressBar(0.0f, 80, 15, gcn::Color(0, 171, 34)); mXpLabel = new Label(_("Exp:")); - mXpBar = new ProgressBar(1.0f, 80, 15, gcn::Color(143, 192, 211)); + mXpBar = new ProgressBar(0.0f, 80, 15, gcn::Color(143, 192, 211)); mMpLabel = new Label(_("MP:")); - mMpBar = new ProgressBar(1.0f, 80, 15, gcn::Color(26, 102, 230)); + mMpBar = new ProgressBar(0.0f, 80, 15, gcn::Color(26, 102, 230)); mJobLabel = new Label(_("Job:")); - mJobBar = new ProgressBar(1.0f, 80, 15, gcn::Color(220, 135, 203)); + mJobBar = new ProgressBar(0.0f, 80, 15, gcn::Color(220, 135, 203)); // ---------------------- // Stats Part diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index e76c19a7..edbf387b 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -50,7 +50,7 @@ StatusWindow::StatusWindow(LocalPlayer *player): mMoneyLabel = new Label("Money:"); mHpLabel = new Label("HP:"); - mHpBar = new ProgressBar(1.0f, 80, 15, gcn::Color(0, 171, 34)); + mHpBar = new ProgressBar(0.0f, 80, 15, gcn::Color(0, 171, 34)); mHpValueLabel = new Label; int y = 3; diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp index 6502399a..593a49a3 100644 --- a/src/gui/storagewindow.cpp +++ b/src/gui/storagewindow.cpp @@ -77,7 +77,7 @@ StorageWindow::StorageWindow(int invSize): mSlotsLabel = new Label(_("Slots: ")); - mSlotsBar = new ProgressBar(1.0f, 100, 20, gcn::Color(225, 200, 25)); + mSlotsBar = new ProgressBar(0.0f, 100, 20, gcn::Color(225, 200, 25)); mSlotsBar->setText(strprintf("%d/%d", mUsedSlots, mMaxSlots)); mSlotsBar->setProgress((float) mUsedSlots / mMaxSlots); diff --git a/src/gui/widgets/avatar.cpp b/src/gui/widgets/avatar.cpp index 116640d8..b120c51f 100644 --- a/src/gui/widgets/avatar.cpp +++ b/src/gui/widgets/avatar.cpp @@ -104,13 +104,7 @@ void Avatar::updateAvatarLabel() std::ostringstream ss; ss << mName; - if (mName == player_node->getName()) - { - mHp = player_node->getHp(); - mMaxHp = player_node->getMaxHp(); - } - - if (mMaxHp != 0) + if (mName != player_node->getName() && mMaxHp != 0) ss << " (" << mHp << "/" << mMaxHp << ")"; mLabel->setCaption(ss.str()); diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index c98ecee4..f2231fca 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -63,7 +63,7 @@ static TabData const data[TAB_COUNT] = { ImageRect Tab::tabImg[TAB_COUNT]; Tab::Tab() : gcn::Tab(), - mTabColor(guiPalette->getColor(Palette::TEXT)) + mTabColor(&guiPalette->getColor(Palette::TEXT)) { init(); } @@ -127,7 +127,7 @@ void Tab::draw(gcn::Graphics *graphics) { mode = TAB_SELECTED; // if tab is selected, it doesnt need to highlight activity - mLabel->setForegroundColor(mTabColor); + mLabel->setForegroundColor(*mTabColor); mHighlighted = false; } else if (mHighlighted) @@ -137,7 +137,7 @@ void Tab::draw(gcn::Graphics *graphics) } else { - mLabel->setForegroundColor(mTabColor); + mLabel->setForegroundColor(*mTabColor); } } @@ -163,7 +163,7 @@ void Tab::draw(gcn::Graphics *graphics) drawChildren(graphics); } -void Tab::setTabColor(const gcn::Color &color) +void Tab::setTabColor(const gcn::Color *color) { mTabColor = color; } diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index 134d5591..eea2586c 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -45,7 +45,7 @@ class Tab : public gcn::Tab /** * Set the normal color fo the tab's text. */ - void setTabColor(const gcn::Color &color); + void setTabColor(const gcn::Color *color); /** * Set tab highlighted @@ -64,7 +64,7 @@ class Tab : public gcn::Tab static int mInstances; /**< Number of tab instances */ static float mAlpha; - gcn::Color mTabColor; + const gcn::Color *mTabColor; bool mHighlighted; }; diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 17ee3fc4..23325108 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -35,7 +35,7 @@ WhisperTab::WhisperTab(const std::string &nick) : ChatTab(nick), mNick(nick) { - setTabColor(guiPalette->getColor(Palette::WHISPER)); + setTabColor(&guiPalette->getColor(Palette::WHISPER)); } WhisperTab::~WhisperTab() diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp index bd247300..6024e67a 100644 --- a/src/itemshortcut.cpp +++ b/src/itemshortcut.cpp @@ -25,6 +25,9 @@ #include "itemshortcut.h" #include "localplayer.h" +#include "net/inventoryhandler.h" +#include "net/net.h" + #include "utils/stringutils.h" ItemShortcut::ItemShortcut *itemShortcut; @@ -72,16 +75,14 @@ void ItemShortcut::useItem(int index) { if (item->isEquipment()) { -#ifdef EATHENA_SUPPORT if (item->isEquipped()) - player_node->unequipItem(item); + Net::getInventoryHandler()->unequipItem(item); else -#endif - player_node->equipItem(item); + Net::getInventoryHandler()->equipItem(item); } else { - player_node->useItem(item); + Net::getInventoryHandler()->useItem(item); } } } diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index efb8f189..ff05d75b 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -153,10 +153,13 @@ bool KeyboardConfig::hasConflicts() { for (j = i, j++; j < KEY_TOTAL; j++) { - // Allow for item shortcut and emote keys to overlap, but no other keys + // Allow for item shortcut and emote keys to overlap + // as well as emote and ignore keys, but no other keys if (!((((i >= KEY_SHORTCUT_1) && (i <= KEY_SHORTCUT_12)) && ((j >= KEY_EMOTE_1) && (j <= KEY_EMOTE_12))) || - ((i == KEY_TOGGLE_CHAT) && (j == KEY_OK))) && + ((i == KEY_TOGGLE_CHAT) && (j == KEY_OK)) || + ((i == KEY_EMOTE) && + (j == KEY_IGNORE_INPUT_1 || j == KEY_IGNORE_INPUT_2))) && (mKey[i].value == mKey[j].value) ) { diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 8a60a4b3..059ccd31 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -336,53 +336,6 @@ void LocalPlayer::setInvItem(int index, int id, int amount) #endif -void LocalPlayer::inviteToParty(const std::string &name) -{ - Net::getPartyHandler()->invite(name); -} - -void LocalPlayer::inviteToParty(Player *player) -{ - Net::getPartyHandler()->invite(player); -} - -void LocalPlayer::moveInvItem(Item *item, int newIndex) -{ - Net::getInventoryHandler()->moveItem(item->getInvIndex(), newIndex); -} - -void LocalPlayer::equipItem(Item *item) -{ - Net::getInventoryHandler()->equipItem(item); -} - -void LocalPlayer::unequipItem(Item *item) -{ - Net::getInventoryHandler()->unequipItem(item); - - // Tidy equipment directly to avoid weapon still shown bug, for instance -#ifdef TMWSERV_SUPPORT - mEquipment->setEquipment(item->getInvIndex(), 0); -#else - mEquipment->removeEquipment(item->getInvIndex()); -#endif -} - -void LocalPlayer::useItem(Item *item) -{ - Net::getInventoryHandler()->useItem(item); -} - -void LocalPlayer::dropItem(Item *item, int quantity) -{ - Net::getInventoryHandler()->dropItem(item, quantity); -} - -void LocalPlayer::splitItem(Item *item, int quantity) -{ - Net::getInventoryHandler()->splitItem(item, quantity); -} - void LocalPlayer::pickUp(FloorItem *item) { #ifdef TMWSERV_SUPPORT @@ -623,16 +576,6 @@ void LocalPlayer::stopWalking(bool sendToServer) } #endif -#ifdef EATHENA_SUPPORT -void LocalPlayer::raiseSkill(Uint16 skillId) -{ - if (mSkillPoint <= 0) - return; - - Net::getSkillHandler()->up(skillId); -} -#endif - void LocalPlayer::toggleSit() { if (mLastAction != -1) @@ -659,24 +602,6 @@ void LocalPlayer::emote(Uint8 emotion) Net::getPlayerHandler()->emote(emotion); } -void LocalPlayer::tradeReply(bool accept) -{ - if (!accept) - mTrading = false; - - Net::getTradeHandler()->respond(accept); -} - -void LocalPlayer::trade(Being *being) const -{ - Net::getTradeHandler()->request(being); -} - -bool LocalPlayer::tradeRequestOk() const -{ - return !mTrading; -} - #ifdef TMWSERV_SUPPORT void LocalPlayer::attack() @@ -806,11 +731,6 @@ void LocalPlayer::stopAttack() mLastTarget = -1; } -void LocalPlayer::revive() -{ - Net::getPlayerHandler()->respawn(); -} - #ifdef TMWSERV_SUPPORT void LocalPlayer::raiseAttribute(size_t attr) diff --git a/src/localplayer.h b/src/localplayer.h index 930020db..bab254ab 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -187,37 +187,6 @@ class LocalPlayer : public Player void setInvItem(int index, int id, int amount); #endif - /** - * Invite a player to join their party - */ - void inviteToParty(const std::string &name); - - /** - * Invite a player to join their party - */ - void inviteToParty(Player *player); - - /** - * Move the Inventory item from the old slot to the new slot. - */ - void moveInvItem(Item *item, int newIndex); - - /** - * Equips an item. - */ - void equipItem(Item *item); - - /** - * Unequips an item. - */ - void unequipItem(Item *item); - - void useItem(Item *item); - - void dropItem(Item *item, int quantity); - - void splitItem(Item *item, int quantity); - void pickUp(FloorItem *item); #ifdef EATHENA_SUPPORT @@ -233,20 +202,10 @@ class LocalPlayer : public Player int getAttackRange(); /** - * Sents a trade request to the given being. - */ - void trade(Being *being) const; - - /** - * Accept or decline a trade offer - */ - void tradeReply(bool accept); - - /** * Returns true when the player is ready to accept a trade offer. * Returns false otherwise. */ - bool tradeRequestOk() const; + bool tradeRequestOk() const { return !mTrading; } /** * Sets the trading state of the player, i.e. whether or not he is @@ -321,10 +280,7 @@ class LocalPlayer : public Player */ bool withinAttackRange(Being *target); -#ifdef EATHENA_SUPPORT - void raiseSkill(Uint16 skillId); -#else - +#ifdef TMWSERV_SUPPORT /** * Stops the player dead in his tracks */ @@ -344,8 +300,6 @@ class LocalPlayer : public Player void toggleSit(); void emote(Uint8 emotion); - void revive(); - /** * Shows item pickup effect if the player is on a map. */ diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index b8d75671..404bff69 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -87,20 +87,13 @@ GeneralHandler::GeneralHandler(): handledMessages = _messages; generalHandler = this; - std::list<ItemDB::Stat*> stats; - ItemDB::Stat stat; - stat.tag = "str"; stat.format = N_("Strength: %d"); - stats.push_back(&stat); - stat.tag = "agi"; stat.format = N_("Agility: %d"); - stats.push_back(&stat); - stat.tag = "vit"; stat.format = N_("Vitality: %d"); - stats.push_back(&stat); - stat.tag = "int"; stat.format = N_("Intelligence: %d"); - stats.push_back(&stat); - stat.tag = "dex"; stat.format = N_("Dexterity: %d"); - stats.push_back(&stat); - stat.tag = "luck"; stat.format = N_("Luck: %d"); - stats.push_back(&stat); + std::list<ItemDB::Stat> stats; + stats.push_back(ItemDB::Stat("str", N_("Strength %+d"))); + stats.push_back(ItemDB::Stat("agi", N_("Agility %+d"))); + stats.push_back(ItemDB::Stat("vit", N_("Vitality %+d"))); + stats.push_back(ItemDB::Stat("int", N_("Intelligence %+d"))); + stats.push_back(ItemDB::Stat("dex", N_("Dexterity %+d"))); + stats.push_back(ItemDB::Stat("luck", N_("Luck %+d"))); ItemDB::setStatsList(stats); } diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index 12ca0d8d..9b0fc8c5 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -38,7 +38,7 @@ PartyTab::PartyTab() : ChatTab(_("Party")) { - setTabColor(guiPalette->getColor(Palette::PARTY)); + setTabColor(&guiPalette->getColor(Palette::PARTY)); } PartyTab::~PartyTab() diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 1c48aa6c..30c583b8 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -27,6 +27,7 @@ #include "net/messageout.h" #include "configuration.h" +#include "equipment.h" #include "inventory.h" #include "item.h" #include "itemshortcut.h" @@ -318,6 +319,9 @@ void InventoryHandler::unequipItem(const Item *item) MessageOut outMsg(CMSG_PLAYER_UNEQUIP); outMsg.writeInt16(item->getInvIndex() + INVENTORY_OFFSET); + + // Tidy equipment directly to avoid weapon still shown bug, for instance + player_node->mEquipment->removeEquipment(item->getInvIndex()); } void InventoryHandler::useItem(const Item *item) diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index e5b20a38..2f1b02ab 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -79,6 +79,7 @@ void PartyHandler::handleMessage(MessageIn &msg) { partyTab->chatLog(_("Party successfully created."), BY_SERVER); player_node->setInParty(true); + partyWindow->setVisible(true); } break; case SMSG_PARTY_INFO: @@ -90,6 +91,7 @@ void PartyHandler::handleMessage(MessageIn &msg) int length = msg.readInt16(); std::string party = msg.readString(24); + partyWindow->setPartyName(party); int count = (length - 28) / 46; for (int i = 0; i < count; i++) @@ -101,13 +103,7 @@ void PartyHandler::handleMessage(MessageIn &msg) bool online = msg.readInt8() == 0; partyWindow->updateMember(id, nick, leader, online); - - Being *being = beingManager->findBeing(id); - if (being) - being->setName(nick); } - - partyWindow->setVisible(true); } break; case SMSG_PARTY_INVITE_RESPONSE: @@ -230,15 +226,16 @@ void PartyHandler::handleMessage(MessageIn &msg) msg.readInt8(); // fail if (id == player_node->getId()) { - player_node->setInParty(false); partyWindow->clearMembers(); partyWindow->setVisible(false); partyTab->chatLog(_("You have left the party."), BY_SERVER); } else + { partyTab->chatLog(strprintf(_("%s has left your party."), nick.c_str()), BY_SERVER); - partyWindow->removeMember(id); + partyWindow->removeMember(id); + } break; } case SMSG_PARTY_UPDATE_HP: @@ -305,7 +302,7 @@ void PartyHandler::inviteResponse(const std::string &inviter, bool accept) MessageOut outMsg(CMSG_PARTY_INVITED); outMsg.writeInt32(player_node->getId()); outMsg.writeInt32(accept ? 1 : 0); - player_node->setInParty(player_node->getInParty() || accept); + player_node->setInParty(player_node->isInParty() || accept); } void PartyHandler::leave() diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 3f8fbc09..29f0bac4 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -75,7 +75,7 @@ namespace { { void action(const gcn::ActionEvent &event) { - player_node->revive(); + Net::getPlayerHandler()->respawn(); deathNotice = NULL; buyDialog->setVisible(false); sellDialog->setVisible(false); diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index 0239a2c8..69b0fd65 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -26,6 +26,7 @@ #include "net/messagein.h" #include "net/messageout.h" +#include "localplayer.h" #include "log.h" #include "gui/skill.h" @@ -216,6 +217,9 @@ void SkillHandler::handleMessage(MessageIn &msg) void SkillHandler::up(int skillId) { + if (player_node->mSkillPoint <= 0) + return; + MessageOut outMsg(CMSG_SKILL_LEVELUP_REQUEST); outMsg.writeInt16(skillId); } diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index ee8e6733..74722332 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -23,6 +23,7 @@ #include "net/ea/protocol.h" +#include "net/inventoryhandler.h" #include "net/messagein.h" #include "net/messageout.h" @@ -48,7 +49,7 @@ namespace { { void action(const gcn::ActionEvent &event) { - player_node->tradeReply(event.getId() == "yes"); + Net::getTradeHandler()->respond(event.getId() == "yes"); } } listener; } @@ -91,7 +92,7 @@ void TradeHandler::handleMessage(MessageIn &msg) { if (!player_node->tradeRequestOk()) { - player_node->tradeReply(false); + Net::getTradeHandler()->respond(false); break; } @@ -104,7 +105,7 @@ void TradeHandler::handleMessage(MessageIn &msg) } else { - player_node->tradeReply(false); + Net::getTradeHandler()->respond(false); break; } break; @@ -183,7 +184,7 @@ void TradeHandler::handleMessage(MessageIn &msg) // Successfully added item if (item->isEquipment() && item->isEquipped()) { - player_node->unequipItem(item); + Net::getInventoryHandler()->unequipItem(item); } tradeWindow->addItem(item->getId(), true, quantity, item->isEquipment()); @@ -236,6 +237,9 @@ void TradeHandler::request(Being *being) void TradeHandler::respond(bool accept) { + if (!accept) + player_node->setTrading(false); + MessageOut outMsg(CMSG_TRADE_RESPONSE); outMsg.writeInt8(accept ? 3 : 4); } diff --git a/src/net/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp index 0a0ca346..5886aafb 100644 --- a/src/net/tmwserv/generalhandler.cpp +++ b/src/net/tmwserv/generalhandler.cpp @@ -20,6 +20,7 @@ */ #include "gui/inventorywindow.h" +#include "gui/partywindow.h" #include "net/tmwserv/generalhandler.h" @@ -77,20 +78,13 @@ GeneralHandler::GeneralHandler(): generalHandler = this; - std::list<ItemDB::Stat*> stats; - ItemDB::Stat stat; - stat.tag = "str"; stat.format = N_("Strength: %d"); - stats.push_back(&stat); - stat.tag = "agi"; stat.format = N_("Agility: %d"); - stats.push_back(&stat); - stat.tag = "dex"; stat.format = N_("Dexterity: %d"); - stats.push_back(&stat); - stat.tag = "vit"; stat.format = N_("Vitality: %d"); - stats.push_back(&stat); - stat.tag = "int"; stat.format = N_("Intelligence: %d"); - stats.push_back(&stat); - stat.tag = "will"; stat.format = N_("Willpower: %d"); - stats.push_back(&stat); + std::list<ItemDB::Stat> stats; + stats.push_back(ItemDB::Stat("str", N_("Strength %+d"))); + stats.push_back(ItemDB::Stat("agi", N_("Agility %+d"))); + stats.push_back(ItemDB::Stat("dex", N_("Dexterity %+d"))); + stats.push_back(ItemDB::Stat("vit", N_("Vitality %+d"))); + stats.push_back(ItemDB::Stat("int", N_("Intelligence %+d"))); + stats.push_back(ItemDB::Stat("will", N_("Willpower %+d"))); ItemDB::setStatsList(stats); } @@ -151,6 +145,7 @@ void GeneralHandler::tick() void GeneralHandler::guiWindowsLoaded() { inventoryWindow->setSplitAllowed(true); + partyWindow->clearPartyName(); } void GeneralHandler::guiWindowsUnloaded() diff --git a/src/net/tmwserv/inventoryhandler.cpp b/src/net/tmwserv/inventoryhandler.cpp index d78c8318..8110fdd2 100644 --- a/src/net/tmwserv/inventoryhandler.cpp +++ b/src/net/tmwserv/inventoryhandler.cpp @@ -100,6 +100,9 @@ void InventoryHandler::unequipItem(const Item *item) MessageOut msg(PGMSG_UNEQUIP); msg.writeInt8(item->getInvIndex()); Net::GameServer::connection->send(msg); + + // Tidy equipment directly to avoid weapon still shown bug, for instance + player_node->mEquipment->setEquipment(item->getInvIndex(), 0); } void InventoryHandler::useItem(const Item *item) diff --git a/src/net/tmwserv/partyhandler.cpp b/src/net/tmwserv/partyhandler.cpp index 01de1be8..47ef791c 100644 --- a/src/net/tmwserv/partyhandler.cpp +++ b/src/net/tmwserv/partyhandler.cpp @@ -99,7 +99,7 @@ void PartyHandler::handleMessage(MessageIn &msg) localChatTab->chatLog(name + " joined the party"); - if (!player_node->getInParty()) + if (!player_node->isInParty()) player_node->setInParty(true); partyWindow->updateMember(id, name); diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp index c7769ede..b697e8a8 100644 --- a/src/net/tmwserv/playerhandler.cpp +++ b/src/net/tmwserv/playerhandler.cpp @@ -29,6 +29,7 @@ #include "net/messagein.h" #include "net/messageout.h" +#include "net/net.h" #include "effectmanager.h" #include "engine.h" @@ -81,7 +82,7 @@ namespace { { void action(const gcn::ActionEvent &event) { - player_node->revive(); + Net::getPlayerHandler()->respawn(); deathNotice = NULL; buyDialog->setVisible(false); sellDialog->setVisible(false); diff --git a/src/net/tmwserv/tradehandler.cpp b/src/net/tmwserv/tradehandler.cpp index 4c462a3f..74789a34 100644 --- a/src/net/tmwserv/tradehandler.cpp +++ b/src/net/tmwserv/tradehandler.cpp @@ -167,6 +167,8 @@ void TradeHandler::request(Being *being) void TradeHandler::respond(bool accept) { // TODO + if (!accept) + player_node->setTrading(false); } void TradeHandler::addItem(Item *item, int amount) diff --git a/src/player.cpp b/src/player.cpp index f658b8b5..453b8bdd 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -31,7 +31,6 @@ #include "text.h" #include "gui/palette.h" -#include "gui/partywindow.h" #include "resources/colordb.h" #include "resources/itemdb.h" @@ -77,7 +76,11 @@ void Player::setName(const std::string &name) { color = &guiPalette->getColor(Palette::SELF); } - else if (partyWindow->findMember(getId())) + else if (mIsGM) + { + color = &guiPalette->getColor(Palette::GM); + } + else if (mInParty) { color = &guiPalette->getColor(Palette::PARTY); } @@ -301,9 +304,15 @@ short Player::getNumberOfGuilds() #endif -void Player::setInParty(bool value) +void Player::setInParty(bool inParty) { - mInParty = value; + mInParty = inParty; + + if (this != player_node && mName) + { + Palette::ColorType colorType = mInParty ? Palette::PARTY : Palette::PC; + mName->setColor(&guiPalette->getColor(colorType)); + } } void Player::optionChanged(const std::string &value) diff --git a/src/player.h b/src/player.h index 5d037b75..330d0c14 100644 --- a/src/player.h +++ b/src/player.h @@ -120,14 +120,13 @@ class Player : public Being #endif /** - * Set the player in party + * Set whether the player in the LocalPlayer's party. Players that are + * in the same party as the local player get their name displayed in + * a different color. */ - void setInParty(bool value); + void setInParty(bool inParty); - /** - * Returns whether player is in the party - */ - bool getInParty() const { return mInParty; } + bool isInParty() const { return mInParty; } /** * Gets the way the character is blocked by other objects. @@ -138,7 +137,6 @@ class Player : public Being /** * Called when a option (set with config.addListener()) is changed */ - void optionChanged(const std::string &value); protected: diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index 4a431e2a..316bd9ed 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -107,7 +107,7 @@ void PlayerRelationsManager::clear() delete names; } -#define PERSIST_IGNORE_LIST "persist-player-list" +#define PERSIST_IGNORE_LIST "persistent-player-list" #define PLAYER_IGNORE_STRATEGY "player-ignore-strategy" #define DEFAULT_PERMISSIONS "default-player-permissions" @@ -125,7 +125,7 @@ void PlayerRelationsManager::load() { clear(); - mPersistIgnores = config.getValue(PERSIST_IGNORE_LIST, 0); + mPersistIgnores = config.getValue(PERSIST_IGNORE_LIST, 1); mDefaultPermissions = (int) config.getValue(DEFAULT_PERMISSIONS, mDefaultPermissions); std::string ignore_strategy_name = config.getValue(PLAYER_IGNORE_STRATEGY, DEFAULT_IGNORE_STRATEGY); int ignore_strategy_index = getPlayerIgnoreStrategyIndex(ignore_strategy_name); @@ -203,7 +203,8 @@ bool PlayerRelationsManager::hasPermission(Being *being, unsigned int flags) return true; } -bool PlayerRelationsManager::hasPermission(const std::string &name, unsigned int flags) +bool PlayerRelationsManager::hasPermission(const std::string &name, + unsigned int flags) { unsigned int rejections = flags & ~checkPermissionSilently(name, flags); bool permitted = rejections == 0; @@ -214,8 +215,7 @@ bool PlayerRelationsManager::hasPermission(const std::string &name, unsigned int Player *to_ignore = dynamic_cast<Player *>(beingManager->findBeingByName(name, Being::PLAYER)); if (to_ignore) - mIgnoreStrategy->ignore(to_ignore, - rejections); + mIgnoreStrategy->ignore(to_ignore, rejections); } } @@ -297,8 +297,8 @@ public: } virtual void ignore(Player *player, unsigned int flags) - { - } + { + } }; class PIS_dotdotdot : public PlayerIgnoreStrategy diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 66c07849..99907ca7 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -55,9 +55,9 @@ static char const *const fields[][2] = { "mp", N_("MP %+d") } }; -static std::list<ItemDB::Stat*> extraStats; +static std::list<ItemDB::Stat> extraStats; -void ItemDB::setStatsList(std::list<ItemDB::Stat*> stats) +void ItemDB::setStatsList(const std::list<ItemDB::Stat> &stats) { extraStats = stats; } @@ -163,13 +163,13 @@ void ItemDB::load() if (!effect.empty()) effect += " / "; effect += strprintf(gettext(fields[i][1]), value); } - for (std::list<Stat*>::iterator it = extraStats.begin(); + for (std::list<Stat>::iterator it = extraStats.begin(); it != extraStats.end(); it++) { - int value = XML::getProperty(node, (*it)->tag.c_str(), 0); + int value = XML::getProperty(node, it->tag.c_str(), 0); if (!value) continue; if (!effect.empty()) effect += " / "; - effect += strprintf((*it)->format.c_str(), value); + effect += strprintf(it->format.c_str(), value); } std::string temp = XML::getProperty(node, "effect", ""); if (!effect.empty() && !temp.empty()) diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h index 2bb8fd5e..d0964e49 100644 --- a/src/resources/itemdb.h +++ b/src/resources/itemdb.h @@ -46,12 +46,19 @@ namespace ItemDB const ItemInfo &get(int id); const ItemInfo &get(const std::string &name); - struct Stat { + struct Stat + { + Stat(const std::string &tag, + const std::string &format): + tag(tag), + format(format) + {} + std::string tag; std::string format; }; - void setStatsList(std::list<Stat*> stats); + void setStatsList(const std::list<Stat> &stats); // Items database typedef std::map<int, ItemInfo*> ItemInfos; diff --git a/src/utils/sha256.cpp b/src/utils/sha256.cpp index 76763ec3..b9d5c810 100644 --- a/src/utils/sha256.cpp +++ b/src/utils/sha256.cpp @@ -70,7 +70,9 @@ #include "utils/sha256.h" +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include <memory.h> |