diff options
author | David Athay <ko2fan@gmail.com> | 2009-04-13 16:03:38 +0100 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2009-04-13 16:03:38 +0100 |
commit | ceff9177ea052c9e398fc9f337cf5320deba14ed (patch) | |
tree | 563e740f4ad9ddd9fe89d4385c7700efcb7a5320 /src/gui/widgets | |
parent | effc112bed400d632368ca633d8a6600ea8c8aae (diff) | |
download | Mana-ceff9177ea052c9e398fc9f337cf5320deba14ed.tar.gz Mana-ceff9177ea052c9e398fc9f337cf5320deba14ed.tar.bz2 Mana-ceff9177ea052c9e398fc9f337cf5320deba14ed.tar.xz Mana-ceff9177ea052c9e398fc9f337cf5320deba14ed.zip |
Fixed broken links
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 11 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 3 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 6b1cb434..603f2056 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -70,7 +70,7 @@ void BrowserBox::addRow(const std::string &row) std::string tmp = row; std::string newRow; BROWSER_LINK bLink; - int idx1, idx2, idx3; + std::string::size_type idx1, idx2, idx3; TrueTypeFont *font = static_cast<TrueTypeFont*>(getFont()); // Use links and user defined colors @@ -78,10 +78,13 @@ void BrowserBox::addRow(const std::string &row) { // Check for links in format "@@link|Caption@@" idx1 = tmp.find("@@"); - while (idx1 >= 0) + while (idx1 != std::string::npos) { idx2 = tmp.find("|", idx1); idx3 = tmp.find("@@", idx2); + + if (idx2 == std::string::npos || idx3 == std::string::npos) + break; bLink.link = tmp.substr(idx1 + 2, idx2 - (idx1 + 2)); bLink.caption = tmp.substr(idx2 + 1, idx3 - (idx2 + 1)); bLink.y1 = mTextRows.size() * font->getHeight(); @@ -91,7 +94,7 @@ void BrowserBox::addRow(const std::string &row) std::string tmp2 = newRow; idx1 = tmp2.find("##"); - while (idx1 >= 0) + while (idx1 != std::string::npos) { tmp2.erase(idx1, 3); idx1 = tmp2.find("##"); @@ -143,7 +146,7 @@ void BrowserBox::addRow(const std::string &row) if (mMode == AUTO_SIZE) { std::string plain = newRow; - for (idx1 = plain.find("##"); idx1 >= 0; idx1 = plain.find("##")) + for (idx1 = plain.find("##"); idx1 != std::string::npos; idx1 = plain.find("##")) plain.erase(idx1, 3); // Adjust the BrowserBox size diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index bbf71e83..1879a918 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -163,9 +163,6 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord) tmp.nick = ""; lineColor = "##S"; } - - // check for @, # or [ in nick - tmp.nick = removeBadChars(tmp.nick); #ifdef EATHENA_SUPPORT if (tmp.nick.empty() && tmp.text.substr(0, 17) == "Visible GM status") |