From eb1004715f9fa6a7700ea5165a1316f377e0b8f6 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 26 May 2009 00:20:51 +0200 Subject: Guard against an issue where forced wrapping would never succeed In some situations, like when wrapping the "]." part after an item link, the attempt at forced-wrapping the text never succeeded. The additional guard "end > start" protects against these cases. Also made some small optimizations. Removed redundant c_str() calls, noticed by Octalot, and changed " " to ' ' for finding a space. --- src/gui/widgets/browserbox.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index e4f0774b..b1ae5eb7 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -386,7 +386,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) // Auto wrap mode if (mMode == AUTO_WRAP && - (x + font->getWidth(part.c_str()) + 10) > getWidth()) + (x + font->getWidth(part) + 10) > getWidth()) { bool forced = false; char const *hyphen = "~"; @@ -399,14 +399,14 @@ void BrowserBox::draw(gcn::Graphics *graphics) do { if (!forced) - end = row.rfind(" ", end); + end = row.rfind(' ', end); // Check if we have to (stupidly) force-wrap if (end == std::string::npos || end <= start) { forced = true; end = row.size(); - x += hyphenWidth * 2; // Account for the wrap-notifier + x += hyphenWidth; // Account for the wrap-notifier continue; } @@ -416,7 +416,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) end--; // And then to the last byte of the previous one part = row.substr(start, end - start + 1); - } while ((x + font->getWidth(part.c_str()) + 10) > getWidth()); + } while (end > start && (x + font->getWidth(part) + 10) > getWidth()); if (forced) { @@ -432,7 +432,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) wrappedLines++; } font->drawString(graphics, part, x, y); - x += font->getWidth(part.c_str()); + x += font->getWidth(part); } y += font->getHeight(); setHeight((mTextRows.size() + wrappedLines) * font->getHeight()); -- cgit v1.2.3-70-g09d2 From 7dda7e2cdbf7b63c316da2baa5627c7e7dc6d5b2 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 26 May 2009 00:35:59 +0200 Subject: Fixed the line under links to not extend below the text Caused the underline for links at the bottom of the BrowserBox to draw outside of the clip area. --- src/gui/widgets/browserbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index b1ae5eb7..91098074 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -343,7 +343,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) mLinks[link].x1 = x; mLinks[link].y1 = y; mLinks[link].x2 = mLinks[link].x1 + size; - mLinks[link].y2 = y + font->getHeight(); + mLinks[link].y2 = y + font->getHeight() - 1; link++; prevColor = selColor; selColor = col; -- cgit v1.2.3-70-g09d2 From 9c95cf794db33f9c265d414172c439b98e4cc0ba Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 28 May 2009 22:04:48 +0200 Subject: Made two error strings untranslatable They should never be seen by a user. --- po/POTFILES.in | 2 -- src/gui/emotepopup.cpp | 4 +--- src/resources/npcdb.cpp | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/po/POTFILES.in b/po/POTFILES.in index 1d7aef26..fc5de932 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -14,7 +14,6 @@ src/gui/charselectdialog.cpp src/gui/chat.cpp src/gui/confirmdialog.cpp src/gui/connection.cpp -src/gui/emotepopup.cpp src/gui/equipmentwindow.cpp src/gui/guildwindow.cpp src/gui/help.cpp @@ -82,6 +81,5 @@ src/net/tmwserv/generalhandler.cpp src/net/tmwserv/loginhandler.cpp src/resources/itemdb.cpp src/resources/monsterdb.cpp -src/resources/npcdb.cpp src/utils/gettext.h src/utils/stringutils.h diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index 036a25ec..707f4bfa 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -35,8 +35,6 @@ #include "resources/resourcemanager.h" #include "utils/dtor.h" -#include "utils/gettext.h" -#include "utils/stringutils.h" #include #include @@ -61,7 +59,7 @@ EmotePopup::EmotePopup(): ResourceManager *resman = ResourceManager::getInstance(); mSelectionImage = resman->getImage("graphics/gui/selection.png"); if (!mSelectionImage) - logger->error(_("Unable to load selection.png")); + logger->error("Unable to load selection.png"); mSelectionImage->setAlpha(config.getValue("guialpha", 0.8)); diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index 6a880faa..57fa9fc0 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -23,7 +23,6 @@ #include "log.h" -#include "utils/gettext.h" #include "utils/xml.h" namespace @@ -50,7 +49,7 @@ void NPCDB::load() if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "npcs")) { - logger->error(_("NPC Database: Error while loading npcs.xml!")); + logger->error("NPC Database: Error while loading npcs.xml!"); } //iterate s -- cgit v1.2.3-70-g09d2 From 5b6c0dc4b070a4572e0cf37d25dc31092eac76d0 Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Tue, 19 May 2009 00:56:39 +0200 Subject: Dont fade out logon music on athena client this kills first map song. (cherry picked from commit 41d4aa745fd15b4a22f231e316ec353316842212) --- src/main.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index ba6be23a..4fcd41dd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1471,8 +1471,6 @@ int main(int argc, char *argv[]) break; case STATE_GAME: - sound.fadeOutMusic(1000); - delete progressBar; delete progressLabel; delete setupButton; -- cgit v1.2.3-70-g09d2 From d052dbe8646f1d4a80ca543435aeb9afe44321da Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Tue, 19 May 2009 12:52:45 +0200 Subject: Fade out logon music just before initial map change. (cherry picked from commit 0938ec96619016c44a8185634246c0384c62815b) --- src/game.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index 59c57607..82750dac 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -39,6 +39,7 @@ #include "npc.h" #include "particle.h" #include "playerrelations.h" +#include "sound.h" #include "gui/widgets/chattab.h" #include "gui/buy.h" @@ -320,6 +321,9 @@ Game::Game(): joystick = new Joystick(0); #ifdef EATHENA_SUPPORT + // fade out logon-music here too to give the desired effect of "flowing" + // into the game. + sound.fadeOutMusic(1000); map_path = map_path.substr(0, map_path.rfind(".")); engine->changeMap(map_path); #endif -- cgit v1.2.3-70-g09d2