From c60567fe343d54388deafa1fe864d77dc311c151 Mon Sep 17 00:00:00 2001 From: peavey Date: Sun, 10 May 2009 23:55:47 +0200 Subject: nuke a tab indent I put in by mistake --- src/gui/minimap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 3dab63a3..aa06da31 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -95,7 +95,7 @@ void Minimap::setMap(Map *map) mMapImage = resman->getImage(map->getProperty("minimap")); if (!mShow) - return; + return; if (mMapImage) { -- cgit v1.2.3-70-g09d2 From 4c36de64284c060f2fbe097844e5ac24b354a4f5 Mon Sep 17 00:00:00 2001 From: peavey Date: Sun, 10 May 2009 23:56:13 +0200 Subject: Remove 'attack key targets' which was merged in from aethyra. If the botters want a combined key that does both target and attack for athena we could add a such, but its annoying when you play in an active style. --- src/game.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2 From ebefed376b4858e8638f97cf36e95f6e8c047f24 Mon Sep 17 00:00:00 2001 From: peavey Date: Mon, 11 May 2009 00:26:14 +0200 Subject: Fix a few states on minimap that I missed. mShow now replaces the visibility setting since this is only saved on manually setting visibility. go back to saving visibility and use sticky bit to decide if minimap should be turned off or not. --- src/gui/minimap.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index aa06da31..17a7e82a 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -56,13 +56,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 +94,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 +117,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(); } -- cgit v1.2.3-70-g09d2 From 53ba5a7a61ccb0c3c1bda91fafa372d0966dcc82 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 11 May 2009 06:46:23 -0600 Subject: Allow emote and ignore keys to overlap --- src/keyboardconfig.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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) ) { -- cgit v1.2.3-70-g09d2 From 1bb315a8d32a8c0fb95a56ca495f387be7832cfc Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 11 May 2009 09:30:33 -0600 Subject: Fix an odd segfault with custom item stats --- src/net/ea/generalhandler.cpp | 2 +- src/net/tmwserv/generalhandler.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index b8d75671..477caf94 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -59,6 +59,7 @@ #include Net::GeneralHandler *generalHandler; +std::list stats; namespace EAthena { @@ -87,7 +88,6 @@ GeneralHandler::GeneralHandler(): handledMessages = _messages; generalHandler = this; - std::list stats; ItemDB::Stat stat; stat.tag = "str"; stat.format = N_("Strength: %d"); stats.push_back(&stat); diff --git a/src/net/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp index 0a0ca346..8a47e6f9 100644 --- a/src/net/tmwserv/generalhandler.cpp +++ b/src/net/tmwserv/generalhandler.cpp @@ -52,6 +52,8 @@ Net::Connection *gameServerConnection = 0; Net::Connection *chatServerConnection = 0; Net::Connection *accountServerConnection = 0; +std::list stats; + namespace TmwServ { GeneralHandler::GeneralHandler(): @@ -77,7 +79,6 @@ GeneralHandler::GeneralHandler(): generalHandler = this; - std::list stats; ItemDB::Stat stat; stat.tag = "str"; stat.format = N_("Strength: %d"); stats.push_back(&stat); -- cgit v1.2.3-70-g09d2 From 06115c652382d81bb25ce1dc3ad40e14f00ee273 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 11 May 2009 20:05:55 +0200 Subject: Fixed the memory issues with the pointers to item stat modifiers It was a list of pointers to Stat instances that had long been popped off the stack and deleted. --- src/net/ea/generalhandler.cpp | 21 +++++++-------------- src/net/tmwserv/generalhandler.cpp | 22 +++++++--------------- src/resources/itemdb.cpp | 10 +++++----- src/resources/itemdb.h | 11 +++++++++-- 4 files changed, 28 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index 477caf94..f9387184 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -59,7 +59,6 @@ #include Net::GeneralHandler *generalHandler; -std::list stats; namespace EAthena { @@ -88,19 +87,13 @@ GeneralHandler::GeneralHandler(): handledMessages = _messages; generalHandler = this; - 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 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/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp index 8a47e6f9..d283729d 100644 --- a/src/net/tmwserv/generalhandler.cpp +++ b/src/net/tmwserv/generalhandler.cpp @@ -52,8 +52,6 @@ Net::Connection *gameServerConnection = 0; Net::Connection *chatServerConnection = 0; Net::Connection *accountServerConnection = 0; -std::list stats; - namespace TmwServ { GeneralHandler::GeneralHandler(): @@ -79,19 +77,13 @@ GeneralHandler::GeneralHandler(): generalHandler = this; - 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 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); } 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 extraStats; +static std::list extraStats; -void ItemDB::setStatsList(std::list stats) +void ItemDB::setStatsList(const std::list &stats) { extraStats = stats; } @@ -163,13 +163,13 @@ void ItemDB::load() if (!effect.empty()) effect += " / "; effect += strprintf(gettext(fields[i][1]), value); } - for (std::list::iterator it = extraStats.begin(); + for (std::list::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 stats); + void setStatsList(const std::list &stats); // Items database typedef std::map ItemInfos; -- cgit v1.2.3-70-g09d2 From e6ab90659ce1430c8d321a68d59de129197a8312 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 11 May 2009 12:22:23 -0600 Subject: Standardize item statistics format --- src/net/ea/generalhandler.cpp | 12 ++++++------ src/net/tmwserv/generalhandler.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index f9387184..404bff69 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -88,12 +88,12 @@ GeneralHandler::GeneralHandler(): generalHandler = this; std::list 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"))); + 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/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp index d283729d..f7f813a9 100644 --- a/src/net/tmwserv/generalhandler.cpp +++ b/src/net/tmwserv/generalhandler.cpp @@ -78,12 +78,12 @@ GeneralHandler::GeneralHandler(): generalHandler = this; std::list 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"))); + 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); } -- cgit v1.2.3-70-g09d2 From 536fba3a842f2d4a419401723e987dead51567dd Mon Sep 17 00:00:00 2001 From: Tametomo Date: Tue, 5 May 2009 09:11:14 -0600 Subject: Start out all progress bars at 0, so that they progress upwards. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tametomo Signed-off-by: Bjørn Lindeijer --- src/gui/inventorywindow.cpp | 4 ++-- src/gui/ministatus.cpp | 6 +++--- src/gui/status.cpp | 8 ++++---- src/gui/statuswindow.cpp | 2 +- src/gui/storagewindow.cpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index efa5bc2e..1f03c67ee 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); 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/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); -- cgit v1.2.3-70-g09d2 From 90ff9f4ec3ccebd0758d990b960a9550ecc36bba Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 11 May 2009 21:28:12 +0200 Subject: Unduplicated the mapping to string representation Based on a similar change Tametomo made in Aethyra. --- src/being.h | 3 +- src/gui/setup_video.cpp | 142 +++++++++++++++++------------------------------- src/gui/setup_video.h | 3 +- 3 files changed, 54 insertions(+), 94 deletions(-) (limited to 'src') 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/gui/setup_video.cpp b/src/gui/setup_video.cpp index bbbeb6d7..170d0f63 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( + config.getValue("speech", Being::TEXT_OVERHEAD))), mModeListModel(new ModeListModel), mModeList(new ListBox(mModeListModel)), mFsCheckBox(new CheckBox(_("Full screen"), mFullScreenEnabled)), @@ -259,52 +295,13 @@ Setup_Video::Setup_Video(): 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; @@ -446,7 +443,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( + config.getValue("speech", Being::TEXT_OVERHEAD)); mOpacity = config.getValue("guialpha", 0.8); mOverlayDetail = (int) config.getValue("OverlayDetail", 2); mOpenGLEnabled = config.getValue("opengl", false); @@ -557,22 +555,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(mSpeechSlider->getValue()); + mSpeechLabel->setCaption(speechModeToString(val)); mSpeechSlider->setValue(val); config.setValue("speech", val); } @@ -604,38 +589,13 @@ void Setup_Video::action(const gcn::ActionEvent &event) 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; } diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 9b9cbfde..9570d726 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" @@ -57,7 +58,7 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, bool mPickupParticleEnabled; double mOpacity; int mFps; - int mSpeechMode; + Being::Speech mSpeechMode; class ModeListModel *mModeListModel; -- cgit v1.2.3-70-g09d2 From bbb5a9f343987c6952ca5ca5466dbd40ddf80997 Mon Sep 17 00:00:00 2001 From: Tametomo Date: Sat, 2 May 2009 00:49:24 -0600 Subject: Removed scroll laziness and scroll radius options. Both of these were partially broken, and my experience has been that players have been frustrated more by accidentally setting them than actually wanting them. They'll still be settable in the configuration file for anyone who needs them, but they seem more like a programmer's debugger than a useful option. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tametomo Signed-off-by: Bjørn Lindeijer --- src/gui/setup_video.cpp | 90 ++++++------------------------------------------- src/gui/setup_video.h | 11 ------ 2 files changed, 10 insertions(+), 91 deletions(-) (limited to 'src') diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 170d0f63..52d1a4c2 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -203,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("")), @@ -224,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")); @@ -259,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"); @@ -279,22 +267,11 @@ 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); - mSpeechLabel->setCaption(speechModeToString(mSpeechMode)); mSpeechSlider->setValue(mSpeechMode); @@ -331,7 +308,7 @@ Setup_Video::Setup_Video(): 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); @@ -357,25 +334,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, 10, mScrollLazinessSlider); - place(1, 10, scrollLazinessLabel); - place(2, 10, mScrollLazinessField).setPadding(1); - - place(0, 11, mSpeechSlider); - place(1, 11, speechLabel); - place(2, 11, mSpeechLabel, 3).setPadding(2); + place(0, 9, mSpeechSlider); + place(1, 9, speechLabel); + place(2, 9, mSpeechLabel, 3).setPadding(2); - place(0, 12, mOverlayDetailSlider); - place(1, 12, overlayDetailLabel); - place(2, 12, mOverlayDetailField, 3).setPadding(2); + place(0, 10, mOverlayDetailSlider); + place(1, 10, overlayDetailLabel); + place(2, 10, 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)); } @@ -452,26 +421,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); @@ -485,11 +434,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); @@ -574,18 +518,6 @@ 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(); @@ -638,6 +570,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 9570d726..01b9cd4f 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -45,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; @@ -89,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; -- cgit v1.2.3-70-g09d2 From 502b4a462b8d90af75db043e9e180ba959c37583 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 11 May 2009 21:50:18 +0200 Subject: Simplified conversion of font size to index of dropdown --- src/gui/setup_video.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'src') diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 52d1a4c2..9add3251 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -281,27 +281,7 @@ Setup_Video::Setup_Video(): 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 -- cgit v1.2.3-70-g09d2 From 47b127b648939c0c0d7f1efaceca8d675dccf513 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 11 May 2009 22:36:02 +0200 Subject: Made player relations persistent by default and removed option from GUI Also changed the config key to make sure the new default applies to everybody. It is now 'persistent-player-list' instead of 'persist-player-list'. --- src/gui/setup_players.cpp | 8 ++------ src/gui/setup_players.h | 1 - src/playerrelations.cpp | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src') 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/playerrelations.cpp b/src/playerrelations.cpp index 4a431e2a..a14861ef 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); -- cgit v1.2.3-70-g09d2 From 75cd80b9eaee9526bfe1625ad63eccdb7c212161 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 11 May 2009 15:07:40 -0600 Subject: Adjust party window visibility logic It now behaves like most windows: defaults to not visible and will save it's visibility. Only the user should be altering it now. --- src/gui/partywindow.cpp | 14 +------------- src/net/ea/partyhandler.cpp | 3 --- 2 files changed, 1 insertion(+), 16 deletions(-) (limited to 'src') diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index dbd8f3ef..982898fb 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -46,6 +46,7 @@ PartyWindow::PartyWindow() : { setWindowName("Party"); setVisible(false); + setSaveVisible(true); setResizable(true); setSaveVisible(true); setCloseButton(true); @@ -54,7 +55,6 @@ PartyWindow::PartyWindow() : setDefaultSize(590, 200, 200, 200); loadWindowState(); - setVisible(false); // Do not start out visible } PartyWindow::~PartyWindow() @@ -111,12 +111,6 @@ void PartyWindow::updateMember(int id, const std::string &memberName, player->online = online; player->avatar->setName(memberName); player->avatar->setOnline(online); - - // show the window - if (mMembers.size() > 0) - { - setVisible(true); - } } void PartyWindow::updateMemberHP(int id, int hp, int maxhp) @@ -129,12 +123,6 @@ void PartyWindow::updateMemberHP(int id, int hp, int maxhp) void PartyWindow::removeMember(int id) { mMembers.erase(id); - - // if no-one left, remove the party window - if (mMembers.size() < 1) - { - setVisible(false); - } } void PartyWindow::removeMember(const std::string &name) diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index e5b20a38..7216719d 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -106,8 +106,6 @@ void PartyHandler::handleMessage(MessageIn &msg) if (being) being->setName(nick); } - - partyWindow->setVisible(true); } break; case SMSG_PARTY_INVITE_RESPONSE: @@ -232,7 +230,6 @@ void PartyHandler::handleMessage(MessageIn &msg) { player_node->setInParty(false); partyWindow->clearMembers(); - partyWindow->setVisible(false); partyTab->chatLog(_("You have left the party."), BY_SERVER); } else -- cgit v1.2.3-70-g09d2 From d528b18d008590d28627f4f63bf875767c8e0f4c Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 11 May 2009 15:55:26 -0600 Subject: Automatically show/hide party window sometimes --- src/net/ea/partyhandler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 7216719d..0eda7792 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: @@ -230,12 +231,15 @@ void PartyHandler::handleMessage(MessageIn &msg) { 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: -- cgit v1.2.3-70-g09d2 From 9c19ba0ce027fe987b101f14f35b765159947eb0 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 11 May 2009 18:40:08 -0600 Subject: Switch Tab to a color pointer to update on the fly --- src/gui/widgets/tab.cpp | 8 ++++---- src/gui/widgets/tab.h | 4 ++-- src/gui/widgets/whispertab.cpp | 2 +- src/net/ea/gui/partytab.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') 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/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() -- cgit v1.2.3-70-g09d2 From eac0ebd493f6be170c8caa8df21ae147b1486d50 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Mon, 11 May 2009 17:14:03 +1200 Subject: Expand the label in the party window to stop names from being cut off (again) Since there are now brackets around the hp values, we need the room for them, too. --- src/gui/partywindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index 982898fb..cb514844 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -50,9 +50,9 @@ PartyWindow::PartyWindow() : setResizable(true); setSaveVisible(true); setCloseButton(true); - setMinWidth(200); + setMinWidth(212); setMinHeight(200); - setDefaultSize(590, 200, 200, 200); + setDefaultSize(590, 200, 212, 200); loadWindowState(); } -- cgit v1.2.3-70-g09d2 From 6f501e2f687df1550dfc024f7ac5d36a5b88d548 Mon Sep 17 00:00:00 2001 From: Chuck Miller Date: Mon, 11 May 2009 21:31:35 -0400 Subject: Makes sure a item exists in the inventory before saying it is selected Was causing a lot of issues (mainly segfaults) when things were used/dropped/stored/retrieved --- src/gui/itemcontainer.cpp | 14 ++++++++++++++ src/gui/itemcontainer.h | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 4779b004..d2712cba 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -320,6 +320,20 @@ void ItemContainer::widgetResized(const gcn::Event &event) setHeight(mGridRows * BOX_HEIGHT); } +Item *ItemContainer::getSelectedItem() +{ + if (!mSelectedItem) + return NULL; + + if (!mInventory->contains(mSelectedItem)) + { + mSelectedItem = NULL; + return NULL; + } + + return mSelectedItem; +} + int ItemContainer::getSlotIndex(int x, int y) const { if (x < getWidth() && y < getHeight()) diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index bc7caf5d..54d7c35e 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(); /** * Sets selected item to NULL. -- cgit v1.2.3-70-g09d2 From 5d1c423648bc138fe4a67908a0f16247a80e5967 Mon Sep 17 00:00:00 2001 From: Chuck Miller Date: Tue, 12 May 2009 05:24:26 -0400 Subject: Makes ItemContainer use indexes for selected and highlighted items, rather then Item pointers. As suggested by Bjorn --- src/gui/itemcontainer.cpp | 129 +++++++++++++++++++++------------------------- src/gui/itemcontainer.h | 6 +-- src/localplayer.cpp | 5 -- src/localplayer.h | 5 -- 4 files changed, 61 insertions(+), 84 deletions(-) (limited to 'src') diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index d2712cba..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(); } @@ -320,20 +323,6 @@ void ItemContainer::widgetResized(const gcn::Event &event) setHeight(mGridRows * BOX_HEIGHT); } -Item *ItemContainer::getSelectedItem() -{ - if (!mSelectedItem) - return NULL; - - if (!mInventory->contains(mSelectedItem)) - { - mSelectedItem = NULL; - return NULL; - } - - return mSelectedItem; -} - int ItemContainer::getSlotIndex(int x, int y) const { if (x < getWidth() && y < getHeight()) @@ -346,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; } @@ -396,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 54d7c35e..f446a647 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -86,7 +86,7 @@ class ItemContainer : public gcn::Widget, /** * Returns the selected item. */ - Item *getSelectedItem(); + Item *getSelectedItem() const; /** * Sets selected item to NULL. @@ -144,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 @@ -173,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/localplayer.cpp b/src/localplayer.cpp index 8a60a4b3..b571c4b0 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -346,11 +346,6 @@ 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); diff --git a/src/localplayer.h b/src/localplayer.h index 930020db..acf2ee63 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -197,11 +197,6 @@ class LocalPlayer : public Player */ 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. */ -- cgit v1.2.3-70-g09d2 From d9813185f0f91a4254579ce04a3fe96bf13fe694 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 12 May 2009 22:15:20 +1200 Subject: Don't show Hp and maxHp for the local player in the party window It's already being displayed elsewhere, and it's partly broken anyway. --- src/gui/widgets/avatar.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') 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()); -- cgit v1.2.3-70-g09d2 From b4d5e2a9c92fe5b0f53c3d08b87c324960c3215c Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 12 May 2009 15:34:50 +0200 Subject: Don't unconditionally include config.h Since it isn't generated on all platforms or by all build systems. Problem reported by Aard. --- src/utils/sha256.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2 From 657afb7b642d5b02289c6bb5bc883c2987cdf5d1 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 08:11:35 -0600 Subject: Remove methods from LocalPlayer that just call Net And make a few others like that, and remove them too. --- src/commandhandler.cpp | 3 +- src/gui/equipmentwindow.cpp | 5 ++- src/gui/inventorywindow.cpp | 6 +-- src/gui/itemamount.cpp | 8 ++-- src/gui/popupmenu.cpp | 12 +++--- src/gui/skill.cpp | 5 ++- src/itemshortcut.cpp | 11 +++--- src/localplayer.cpp | 75 ------------------------------------ src/localplayer.h | 42 +------------------- src/net/ea/inventoryhandler.cpp | 4 ++ src/net/ea/playerhandler.cpp | 2 +- src/net/ea/skillhandler.cpp | 4 ++ src/net/ea/tradehandler.cpp | 12 ++++-- src/net/tmwserv/inventoryhandler.cpp | 3 ++ src/net/tmwserv/playerhandler.cpp | 3 +- src/net/tmwserv/tradehandler.cpp | 2 + 16 files changed, 57 insertions(+), 140 deletions(-) (limited to 'src') 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/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 1f03c67ee..d6cd3a84 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -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/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(being)); + Net::getPartyHandler()->invite(dynamic_cast(being)); } else if (link == "name" && being) 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/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/localplayer.cpp b/src/localplayer.cpp index b571c4b0..059ccd31 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -336,48 +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::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 @@ -618,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) @@ -654,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() @@ -801,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 acf2ee63..52e2b74b 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -187,32 +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); - - /** - * 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 @@ -227,21 +201,11 @@ 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 @@ -317,7 +281,7 @@ class LocalPlayer : public Player bool withinAttackRange(Being *target); #ifdef EATHENA_SUPPORT - void raiseSkill(Uint16 skillId); + //void raiseSkill(Uint16 skillId); #else /** @@ -339,8 +303,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/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/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/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/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) -- cgit v1.2.3-70-g09d2 From fd47b191acef2230183cee1ab54901c777291e46 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 09:34:00 -0600 Subject: Don't automatically switch to new WhisperTabs --- src/gui/chat.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 027297a2..72c1976d 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -493,7 +493,5 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo) ChatTab *ret = mWhispers[tempNick] = new WhisperTab(nick); - mChatTabs->setSelectedTab(ret); - return ret; } -- cgit v1.2.3-70-g09d2 From a2aa7c577b6d69b8185111a8ea8781957ce45b38 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 10:41:31 -0600 Subject: Handle in party status in a much saner way --- src/gui/minimap.cpp | 12 +++++++----- src/gui/partywindow.cpp | 32 ++++++++++++++++++++++++++------ src/net/ea/partyhandler.cpp | 7 +------ src/player.cpp | 6 ++++-- src/player.h | 2 +- 5 files changed, 39 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 17a7e82a..160c0722 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" @@ -182,6 +181,8 @@ void Minimap::draw(gcn::Graphics *graphics) { case Being::PLAYER: { + const Player* player = static_cast(being); + Palette::ColorType type = Palette::PC; if (being == player_node) @@ -189,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(being)->isGM()) - type = Palette::GM_NAME; - graphics->setColor(guiPalette->getColor(type)); break; } diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index cb514844..b13f4b0b 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" @@ -105,12 +108,16 @@ 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); + PartyMember *member = findOrCreateMember(id); + member->name = memberName; + member->leader = leader; + member->online = online; + member->avatar->setName(memberName); + member->avatar->setOnline(online); + + Player *player = dynamic_cast(beingManager->findBeing(id)); + if (player) + player->setInParty(true); } void PartyWindow::updateMemberHP(int id, int hp, int maxhp) @@ -123,6 +130,10 @@ void PartyWindow::updateMemberHP(int id, int hp, int maxhp) void PartyWindow::removeMember(int id) { mMembers.erase(id); + + Player *player = dynamic_cast(beingManager->findBeing(id)); + if (player) + player->setInParty(false); } void PartyWindow::removeMember(const std::string &name) @@ -189,10 +200,19 @@ void PartyWindow::action(const gcn::ActionEvent &event) } } +void clearMembersSub(std::pair p) +{ + Player *player = dynamic_cast(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/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 0eda7792..072297dd 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -102,10 +102,6 @@ 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); } } break; @@ -229,7 +225,6 @@ 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); @@ -306,7 +301,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/player.cpp b/src/player.cpp index f658b8b5..e797fdfe 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,7 @@ void Player::setName(const std::string &name) { color = &guiPalette->getColor(Palette::SELF); } - else if (partyWindow->findMember(getId())) + else if (mInParty) { color = &guiPalette->getColor(Palette::PARTY); } @@ -304,6 +303,9 @@ short Player::getNumberOfGuilds() void Player::setInParty(bool value) { mInParty = value; + + if (this != player_node && mName) + mName->setColor(&guiPalette->getColor(value ? Palette::PARTY : Palette::PC)); } void Player::optionChanged(const std::string &value) diff --git a/src/player.h b/src/player.h index 5d037b75..af6412d4 100644 --- a/src/player.h +++ b/src/player.h @@ -127,7 +127,7 @@ class Player : public Being /** * 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. -- cgit v1.2.3-70-g09d2 From 34489687667ba5622ad3ba109381ee4c39da24e5 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 10:52:07 -0600 Subject: Show party name in party window --- src/gui/partywindow.cpp | 10 ++++++++++ src/gui/partywindow.h | 4 ++++ src/net/ea/partyhandler.cpp | 1 + src/net/tmwserv/generalhandler.cpp | 2 ++ 4 files changed, 17 insertions(+) (limited to 'src') diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index b13f4b0b..52a7b97e 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -65,6 +65,16 @@ PartyWindow::~PartyWindow() delete_all(mMembers); } +void PartyWindow::setPartyName(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); diff --git a/src/gui/partywindow.h b/src/gui/partywindow.h index 65e8d772..c3fe75f4 100644 --- a/src/gui/partywindow.h +++ b/src/gui/partywindow.h @@ -65,6 +65,10 @@ class PartyWindow : public Window, gcn::ActionListener */ ~PartyWindow(); + void setPartyName(std::string name); + + void clearPartyName(); + /** * Find a party member based on ID. Returns NULL if not found. */ diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 072297dd..2f1b02ab 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -91,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++) diff --git a/src/net/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp index f7f813a9..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" @@ -144,6 +145,7 @@ void GeneralHandler::tick() void GeneralHandler::guiWindowsLoaded() { inventoryWindow->setSplitAllowed(true); + partyWindow->clearPartyName(); } void GeneralHandler::guiWindowsUnloaded() -- cgit v1.2.3-70-g09d2 From 29286a78abf94f71fcddad3b7e78a482d287fecd Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Tue, 12 May 2009 19:05:40 +0200 Subject: Fixed linking for CMake/Win32 --- src/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') 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) -- cgit v1.2.3-70-g09d2 From 057c4592a0260af3efca3f7871abf24d8ed77c5d Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 12:05:04 -0600 Subject: Fix switching to new tabs on /query --- src/gui/chat.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 72c1976d..eca224fc 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -493,5 +493,8 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo) ChatTab *ret = mWhispers[tempNick] = new WhisperTab(nick); + if (switchTo) + mChatTabs->setSelectedTab(ret); + return ret; } -- cgit v1.2.3-70-g09d2 From c6a2f58d221247456946100082a580cce9733917 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 12 May 2009 20:30:46 +0200 Subject: Some small cleanups and fixed compile with tmwserv support --- src/gui/minimap.cpp | 2 +- src/gui/partywindow.cpp | 10 ++++------ src/gui/partywindow.h | 2 +- src/localplayer.h | 5 +---- src/net/tmwserv/partyhandler.cpp | 2 +- src/player.cpp | 9 ++++++--- src/player.h | 10 ++++------ src/playerrelations.cpp | 10 +++++----- 8 files changed, 23 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 160c0722..a5bdc59d 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -181,7 +181,7 @@ void Minimap::draw(gcn::Graphics *graphics) { case Being::PLAYER: { - const Player* player = static_cast(being); + const Player *player = static_cast(being); Palette::ColorType type = Palette::PC; diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index 52a7b97e..317811ee 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -65,7 +65,7 @@ PartyWindow::~PartyWindow() delete_all(mMembers); } -void PartyWindow::setPartyName(std::string name) +void PartyWindow::setPartyName(const std::string &name) { setCaption(strprintf(_("Party (%s)"), name.c_str())); } @@ -125,8 +125,7 @@ void PartyWindow::updateMember(int id, const std::string &memberName, member->avatar->setName(memberName); member->avatar->setOnline(online); - Player *player = dynamic_cast(beingManager->findBeing(id)); - if (player) + if (Player *player = dynamic_cast(beingManager->findBeing(id))) player->setInParty(true); } @@ -141,8 +140,7 @@ void PartyWindow::removeMember(int id) { mMembers.erase(id); - Player *player = dynamic_cast(beingManager->findBeing(id)); - if (player) + if (Player *player = dynamic_cast(beingManager->findBeing(id))) player->setInParty(false); } @@ -210,7 +208,7 @@ void PartyWindow::action(const gcn::ActionEvent &event) } } -void clearMembersSub(std::pair p) +void clearMembersSub(const std::pair &p) { Player *player = dynamic_cast(beingManager->findBeing(p.first)); if (player) diff --git a/src/gui/partywindow.h b/src/gui/partywindow.h index c3fe75f4..8cea500f 100644 --- a/src/gui/partywindow.h +++ b/src/gui/partywindow.h @@ -65,7 +65,7 @@ class PartyWindow : public Window, gcn::ActionListener */ ~PartyWindow(); - void setPartyName(std::string name); + void setPartyName(const std::string &name); void clearPartyName(); diff --git a/src/localplayer.h b/src/localplayer.h index 52e2b74b..bab254ab 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -280,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 */ 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/player.cpp b/src/player.cpp index e797fdfe..b7370e03 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -300,12 +300,15 @@ short Player::getNumberOfGuilds() #endif -void Player::setInParty(bool value) +void Player::setInParty(bool inParty) { - mInParty = value; + mInParty = inParty; if (this != player_node && mName) - mName->setColor(&guiPalette->getColor(value ? Palette::PARTY : Palette::PC)); + { + 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 af6412d4..330d0c14 100644 --- a/src/player.h +++ b/src/player.h @@ -120,13 +120,12 @@ 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 isInParty() const { return mInParty; } /** @@ -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 a14861ef..316bd9ed 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -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(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 -- cgit v1.2.3-70-g09d2 From 0257eaf4d3945eac7cb3e50ccf8dfef18fa29698 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 12 May 2009 12:33:32 -0600 Subject: Add proper GM hilighting to other players --- src/player.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/player.cpp b/src/player.cpp index b7370e03..453b8bdd 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -76,6 +76,10 @@ void Player::setName(const std::string &name) { color = &guiPalette->getColor(Palette::SELF); } + else if (mIsGM) + { + color = &guiPalette->getColor(Palette::GM); + } else if (mInParty) { color = &guiPalette->getColor(Palette::PARTY); -- cgit v1.2.3-70-g09d2