diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-05-04 17:32:03 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-05-04 17:32:03 +0000 |
commit | cc493fae6ed87c2a101ea1ce1a6c2bb821bd51d5 (patch) | |
tree | cbc8d381cb22fe27bac58e5061b9fc1032a5b5f1 | |
parent | 4dbb3e75160e465dbcdb6de282d2e4ad8f89bdc0 (diff) | |
download | mana-cc493fae6ed87c2a101ea1ce1a6c2bb821bd51d5.tar.gz mana-cc493fae6ed87c2a101ea1ce1a6c2bb821bd51d5.tar.bz2 mana-cc493fae6ed87c2a101ea1ce1a6c2bb821bd51d5.tar.xz mana-cc493fae6ed87c2a101ea1ce1a6c2bb821bd51d5.zip |
Merged revisions 4031-4044,4046-4058,4061-4062,4064,4066-4067,4069-4070,4072-4079,4082-4092,4094-4097,4099,4101-4109,4112-4115,4117-4129,4131-4150 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/branches/0.0
........
r4031 | the_enemy | 2008-04-03 14:53:00 +0200 (Thu, 03 Apr 2008) | 1 line
Tweaked disconnect dialog to fix crash bug id=250
........
r4050 | b_lindeijer | 2008-04-07 19:37:23 +0200 (Mon, 07 Apr 2008) | 2 lines
Merged changes made for the 0.0.24.1 release (4046:4048 from 0.0.24 branch).
........
r4066 | b_lindeijer | 2008-04-10 23:48:36 +0200 (Thu, 10 Apr 2008) | 2 lines
Fixed compile warning.
........
r4076 | b_lindeijer | 2008-04-12 20:36:15 +0200 (Sat, 12 Apr 2008) | 3 lines
Fixed display of item shortcut container. gcn::Widget::setWidth is no longer
virtual.
........
r4079 | crush_tmw | 2008-04-14 09:50:25 +0200 (Mon, 14 Apr 2008) | 1 line
Fixed multi-channel image dyeing (patch by fate)
........
r4096 | b_lindeijer | 2008-04-16 10:39:59 +0200 (Wed, 16 Apr 2008) | 3 lines
Restored the text wrapping in TextBox, since it was based on overriding a
method that is no longer virtual in Guichan 0.8.0 (gcn::TextBox::setText()).
........
r4097 | peaveydk | 2008-04-16 13:27:31 +0200 (Wed, 16 Apr 2008) | 1 line
Fix a basic_string::at sometimes being out of range in BrowserBox::draw when checking for line separators.
........
r4099 | peaveydk | 2008-04-16 13:50:12 +0200 (Wed, 16 Apr 2008) | 1 line
Also fix potential out of range in BrowserBox::draw when checking for color codes.
........
r4150 | b_lindeijer | 2008-04-20 21:24:33 +0200 (Sun, 20 Apr 2008) | 2 lines
Forgot to remove the sound effects apparently, removed now.
........
-rw-r--r-- | ChangeLog | 37 | ||||
-rw-r--r-- | NEWS | 13 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | data/help/changes.txt | 30 | ||||
-rw-r--r-- | data/help/header.txt | 2 | ||||
-rw-r--r-- | src/being.cpp | 8 | ||||
-rw-r--r-- | src/game.cpp | 4 | ||||
-rw-r--r-- | src/gui/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemshortcutcontainer.cpp | 6 | ||||
-rw-r--r-- | src/gui/itemshortcutcontainer.h | 12 | ||||
-rw-r--r-- | src/gui/itemshortcutwindow.cpp | 18 | ||||
-rw-r--r-- | src/gui/itemshortcutwindow.h | 12 | ||||
-rw-r--r-- | src/gui/npc_text.cpp | 8 | ||||
-rw-r--r-- | src/gui/npc_text.h | 7 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 32 | ||||
-rw-r--r-- | src/gui/scrollarea.h | 13 | ||||
-rw-r--r-- | src/gui/textbox.cpp | 9 | ||||
-rw-r--r-- | src/gui/textbox.h | 7 | ||||
-rw-r--r-- | src/resources/dye.cpp | 7 |
19 files changed, 109 insertions, 120 deletions
@@ -140,11 +140,23 @@ * src/gui/guildlistbox.cpp, src/gui/guildwindow.h, src/gui/widgets/tabbedarea.cpp, src/gui/chat.cpp, src/gui/guildlistbox.h, src/gui/guildwindow.cpp, src/guild.cpp, - src/guild.h, src/net/guildhandler.cpp: Fixed online status so that + src/guild.h, src/net/guildhandler.cpp: Fixed online status so that users are shown as online. - * src/gui/chat.cpp, src/net/protocol.h, + * src/gui/chat.cpp, src/net/protocol.h, src/net/chatserver/chatserver.cpp: Remove private channels. +2008-04-16 Bjørn Lindeijer <bjorn@lindeijer.nl> + + * src/gui/npc_text.h, src/gui/textbox.cpp, src/gui/npc_text.cpp, + src/gui/scrollarea.h, src/gui/textbox.h: Restored the text wrapping in + TextBox, since it was based on overriding a method that is no longer + virtual in Guichan 0.8.0. + +2008-04-16 Dennis Friis <peavey@placid.dk> + + * src/gui/browserbox.cpp: Fix a basic_string::at sometimes being out + of range in BrowserBox::draw when checking for color codes. + 2008-04-15 David Athay <ko2fan@gmail.com> * src/gui/guildlistbox.cpp, src/gui/guildwindow.h @@ -168,6 +180,10 @@ Added new TabbedArea which extends gui::TabbedArea. Changed Guild and Chat windows to use new TabbedArea. Added private messaging. +2008-04-14 Philipp Sehmisch <tmw@crushnet.org> + + * src/resources/dye.cpp: Fixed multi-channel dyeing (patch by fate) + 2008-04-12 Yohann Ferreira <bertram@cegetel.net> * src/CMakeLists.txt: Fixed a compilation error using Cmake. @@ -180,6 +196,10 @@ src/log.h, src/resources/mapreader.cpp, src/resources/spritedef.cpp: Fixed some compiler warnings and don't try to load particle effects when no file is set. + * src/gui/itemshortcutcontainer.h, src/gui/itemshortcutcontainer.cpp, + src/gui/itemshortcutwindow.cpp, src/gui/scrollarea.h, + src/gui/scrollarea.cpp, src/gui/itemshortcutwindow.h: Fixed display of + item shortcut container. gcn::Widget::setWidth is no longer virtual. 2008-04-09 Bjørn Lindeijer <bjorn@lindeijer.nl> @@ -207,6 +227,9 @@ * src/resources/spritedef.cpp, src/resources/spritedef.h, data/graphics/sprites/item008.xml: Added support for basing one sprite definition on another by including it. + * data/help/changes.txt, data/help/header.txt, NEWS: Updates to news + from 0.0.24.1 release. + * src/being.cpp: Fixed crash on trying to show out of range emoticon. 2008-04-03 Philipp Sehmisch <tmw@crushnet.org> @@ -216,10 +239,11 @@ 2008-04-03 David Athay <ko2fan@gmail.com> + * src/game.cpp: Tweaked disconnect dialog, hoping to fix a crash bug. * src/localplayer.cpp, src/gui/popupmenu.cpp, src/localplayer.h, tmw.cbp: Added ability to right click a player and invite to guild. - * src/gui/connection.cpp, src/gui/login.cpp, - src/gui/char_select.cpp, src/main.cpp: Added patch from + * src/gui/connection.cpp, src/gui/login.cpp, + src/gui/char_select.cpp, src/main.cpp: Added patch from postalworker bug id=117 to fix cancel connecting to a sick server. * src/net/guildhandler.cpp, src/net/protocol.h: Added updating guild member list. @@ -227,7 +251,7 @@ 2008-04-01 David Athay <ko2fan@gmail.com> * src/game.cpp, src/gui/guildwindow.h, src/gui/chat.cpp, - src/gui/guildwindow.cpp, src/net/guildhandler.cpp: Fixed up chat + src/gui/guildwindow.cpp, src/net/guildhandler.cpp: Fixed up chat and guilds. * src/gui/chat.cpp: Made it possible to move the chat window. @@ -237,7 +261,8 @@ src/resources/npcdb.cpp, data/npcs.xml, src/Makefile.am, tmc.cbp: Implemented NPC XML database which maps NPC IDs to one or more animation files and thus enables animated NPCs. - * data/graphics/sprites/npc-test.png, data/graphics/sprites/npc-test.xml, + * data/graphics/sprites/npc-test.png, + data/graphics/sprites/npc-test.xml, data/graphics/sprites/npc-treasurebox.png, data/graphics/sprites/npc-treasurebox.xml: Added some animated NPCs by lost soul for testing purpose. @@ -1,4 +1,17 @@ 0.0.24.1 (7 April 2008) +- Added /clear command to clear chat window +- Added ability to close quit dialog by pressing ESC +- Added key for targetting nearest player +- Added the possibility to assign particle effects to monsters +- Added possibility to pass through players with key controls +- Fixed crash on exit after connection to server was lost +- Fixed initialization of some variables +- Fixed an error with chat messages without a sender that include a colon +- Fixed minimap to not keep reappearing when hidden +- Fixed a GCC 4.3 compile error +- Fixed music loading from non-default location +- Fixed crash on trying to show out of range emoticon +- Updated Dev-C++ and Code::Blocks project files 0.0.24 (24 December 2007) - Added female specific hair styles @@ -1,7 +1,7 @@ THE MANA WORLD ============== - Version: 0.1.0 Date: XX/XX/2007 + Version: 0.1.0 Date: XX/XX/2008 Development team: - See AUTHORS file for a list diff --git a/data/help/changes.txt b/data/help/changes.txt index 26bd21d1..8b47cc9c 100644 --- a/data/help/changes.txt +++ b/data/help/changes.txt @@ -3,6 +3,21 @@ ##3 === RECENT CHANGES === + 0.0.24.1 (7 April 2008) + - Added /clear command to clear chat window + - Added ability to close quit dialog by pressing ESC + - Added key for targetting nearest player + - Added the possibility to assign particle effects to monsters + - Added possibility to pass through players with key controls + - Fixed crash on exit after connection to server was lost + - Fixed initialization of some variables + - Fixed an error with chat messages without a sender that include a colon + - Fixed minimap to not keep reappearing when hidden + - Fixed a GCC 4.3 compile error + - Fixed music loading from non-default location + - Fixed crash on trying to show out of range emoticon + - Updated Dev-C++ and Code::Blocks project files + 0.0.24 (24 December 2007) - Added female specific hair styles - Added user-definable key settings @@ -55,18 +70,3 @@ - Fixed mouse coordinates in debug window - Fixed clicking on GUI to cause the player to start walking sometimes - 0.0.22 (24 December 2006) - - Added support for female-specific equipment graphics - - Added support for monster sounds - - Added item icons to buy/sell dialogs - - Enhanced character select dialog to show equipment - - Changed to new update host (http://updates.themanaworld.org) - - Worked around a Guichan exception thrown for mice with many buttons - - Changed mouse walk to keep following mouse while button is held down - - Extended font support for å and Å - - Disabled RLE compression on all surfaces in software mode - - Fixed joystick setting not to show disabled when it's actually enabled - - Fixed money field to no longer hide below the bottom of the window - - Fixed pathfinding to allow walking through beings when they block your path - - Fixed an issue with NPC dialogs staying open after player respawn - diff --git a/data/help/header.txt b/data/help/header.txt index 19afb84f..57e9f141 100644 --- a/data/help/header.txt +++ b/data/help/header.txt @@ -2,7 +2,7 @@ ##1 T H E M A N A W O R L D ##1 ========================================== - ##2Version:##6 0.0.24 ##2Date:##324 December 2007 + ##2Version:##6 0.0.24.1 ##2Date:##37 April 2008 ##2 Website: http://themanaworld.org diff --git a/src/being.cpp b/src/being.cpp index 5a877d85..b984708e 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -584,10 +584,12 @@ Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY) if (!mEmotion) return; - int px = mPx + offsetX + 3; - int py = mPy + offsetY - 60; + const int px = mPx + offsetX + 3; + const int py = mPy + offsetY - 60; + const int emotionIndex = mEmotion - 1; - graphics->drawImage(emotionSet->get(mEmotion - 1), px, py); + if (emotionIndex >= 0 && emotionIndex < (int) emotionSet->size()) + graphics->drawImage(emotionSet->get(emotionIndex), px, py); } void diff --git a/src/game.cpp b/src/game.cpp index d762bde2..8860d4c4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -145,6 +145,7 @@ namespace { if (event.getId() == "yes" || event.getId() == "ok") { done = true; } + disconnectedDialog = NULL; } } exitListener; } @@ -445,9 +446,8 @@ void Game::logic() OkDialog("Network Error", "The connection to the server was lost, the program will now quit"); disconnectedDialog->addActionListener(&exitListener); + disconnectedDialog->requestMoveToTop(); } - - disconnectedDialog->requestMoveToTop(); } } } diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 61bc571b..53a2ac0f 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -311,7 +311,7 @@ BrowserBox::draw(gcn::Graphics *graphics) (!mUseLinksAndUserColors && (start == 0))) { // Check for color change in format "##x", x = [L,P,0..9] - if (row.find("##", start) == start) + if (row.find("##", start) == start && row.size() > start + 2) { switch (row.at(start + 2)) { diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp index d86a99ef..e8cc5711 100644 --- a/src/gui/itemshortcutcontainer.cpp +++ b/src/gui/itemshortcutcontainer.cpp @@ -40,6 +40,7 @@ ItemShortcutContainer::ItemShortcutContainer(): mItemMoved(NULL) { addMouseListener(this); + addWidgetListener(this); ResourceManager *resman = ResourceManager::getInstance(); @@ -119,11 +120,8 @@ ItemShortcutContainer::draw(gcn::Graphics *graphics) } } -void -ItemShortcutContainer::setWidth(int width) +void ItemShortcutContainer::widgetResized(const gcn::Event &event) { - gcn::Widget::setWidth(width); - mGridWidth = getWidth() / mBoxWidth; if (mGridWidth < 1) { mGridWidth = 1; diff --git a/src/gui/itemshortcutcontainer.h b/src/gui/itemshortcutcontainer.h index c69525e0..58f0aea7 100644 --- a/src/gui/itemshortcutcontainer.h +++ b/src/gui/itemshortcutcontainer.h @@ -26,6 +26,7 @@ #include <guichan/mouselistener.hpp> #include <guichan/widget.hpp> +#include <guichan/widgetlistener.hpp> class Image; class Item; @@ -35,7 +36,9 @@ class Item; * * \ingroup GUI */ -class ItemShortcutContainer : public gcn::Widget, public gcn::MouseListener +class ItemShortcutContainer : public gcn::Widget, + public gcn::WidgetListener, + public gcn::MouseListener { public: /** @@ -59,10 +62,10 @@ class ItemShortcutContainer : public gcn::Widget, public gcn::MouseListener void draw(gcn::Graphics *graphics); /** - * Sets the width of the container. This is used to determine the new - * height of the container. + * Invoked when a widget changes its size. This is used to determine + * the new height of the container. */ - void setWidth(int width); + void widgetResized(const gcn::Event &event); /** * Handles mouse when dragged. @@ -79,7 +82,6 @@ class ItemShortcutContainer : public gcn::Widget, public gcn::MouseListener */ void mouseReleased(gcn::MouseEvent &event); - int getMaxItems() { return mMaxItems; } diff --git a/src/gui/itemshortcutwindow.cpp b/src/gui/itemshortcutwindow.cpp index c7b2bd05..fb75e20d 100644 --- a/src/gui/itemshortcutwindow.cpp +++ b/src/gui/itemshortcutwindow.cpp @@ -44,11 +44,12 @@ ItemShortcutWindow::ItemShortcutWindow() setMaxWidth(mItems->getBoxWidth() * mItems->getMaxItems() + border); setMaxHeight(mItems->getBoxHeight() * mItems->getMaxItems() + border); - mInvenScroll = new ScrollArea(mItems); - mInvenScroll->setPosition(SCROLL_PADDING, SCROLL_PADDING); - mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mScrollArea = new ScrollArea(mItems); + mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING); + mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mScrollArea->setOpaque(false); - add(mInvenScroll); + add(mScrollArea); loadWindowState("ItemShortcut"); } @@ -56,12 +57,7 @@ ItemShortcutWindow::ItemShortcutWindow() ItemShortcutWindow::~ItemShortcutWindow() { delete mItems; - delete mInvenScroll; -} - -void ItemShortcutWindow::logic() -{ - Window::logic(); + delete mScrollArea; } void ItemShortcutWindow::widgetResized(const gcn::Event &event) @@ -70,7 +66,7 @@ void ItemShortcutWindow::widgetResized(const gcn::Event &event) const gcn::Rectangle &area = getChildrenArea(); - mInvenScroll->setSize( + mScrollArea->setSize( area.width - SCROLL_PADDING, area.height - SCROLL_PADDING); } diff --git a/src/gui/itemshortcutwindow.h b/src/gui/itemshortcutwindow.h index 51685e49..9742abdc 100644 --- a/src/gui/itemshortcutwindow.h +++ b/src/gui/itemshortcutwindow.h @@ -26,12 +26,11 @@ #include "window.h" -#include "../guichanfwd.h" - class ItemShortcutContainer; +class ScrollArea; /** - * Inventory dialog. + * A window around the ItemShortcutContainer. * * \ingroup Interface */ @@ -49,11 +48,6 @@ class ItemShortcutWindow : public Window ~ItemShortcutWindow(); /** - * Logic (updates buttons and weight information). - */ - void logic(); - - /** * Called whenever the widget changes size. */ void widgetResized(const gcn::Event &event); @@ -61,7 +55,7 @@ class ItemShortcutWindow : public Window private: ItemShortcutContainer *mItems; - gcn::ScrollArea *mInvenScroll; + ScrollArea *mScrollArea; }; extern ItemShortcutWindow *itemShortcutWindow; diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index 023307a7..fd02a14a 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -36,7 +36,7 @@ NpcTextDialog::NpcTextDialog(): Window(_("NPC")) { - mTextBox = new TextBox(); + mTextBox = new TextBox; mTextBox->setEditable(false); gcn::ScrollArea *scrollArea = new ScrollArea(mTextBox); Button *okButton = new Button(_("Ok"), "ok", this); @@ -57,15 +57,15 @@ NpcTextDialog::NpcTextDialog(): } void -NpcTextDialog::setText(const char *text) +NpcTextDialog::setText(const std::string &text) { - mTextBox->setText(text); + mTextBox->setTextWrapped(text); } void NpcTextDialog::addText(const std::string &text) { - mTextBox->setText(mTextBox->getText() + text + "\n"); + mTextBox->setTextWrapped(mTextBox->getText() + text + "\n"); } void diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index 869661c4..0ef1b938 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -28,7 +28,8 @@ #include <guichan/actionlistener.hpp> #include "window.h" -#include "../guichanfwd.h" + +class TextBox; /** * The npc text dialog. @@ -57,7 +58,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener * @param string The new text. */ void - setText(const char *string); + setText(const std::string &string); /** * Adds the text to the text shows in the dialog. Also adds a newline @@ -69,7 +70,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener addText(const std::string &string); private: - gcn::TextBox *mTextBox; + TextBox *mTextBox; }; #endif diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index 9c88f8e3..255aa2d8 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -165,14 +165,6 @@ void ScrollArea::logic() void ScrollArea::draw(gcn::Graphics *graphics) { - checkPolicies(); - - int alpha = getBaseColor().a; - gcn::Color highlightColor = getBaseColor() + 0x303030; - highlightColor.a = alpha; - gcn::Color shadowColor = getBaseColor() - 0x303030; - shadowColor.a = alpha; - if (mVBarVisible) { drawUpButton(graphics); @@ -198,29 +190,7 @@ void ScrollArea::draw(gcn::Graphics *graphics) mScrollbarWidth)); } - gcn::Widget *content = getContent(); - - if (content != NULL) - { - graphics->pushClipArea(getChildrenArea()); - - if (content->getFrameSize() > 0) - { - gcn::Rectangle rec = content->getDimension(); - rec.x -= content->getFrameSize(); - rec.y -= content->getFrameSize(); - rec.width += 2 * content->getFrameSize(); - rec.height += 2 * content->getFrameSize(); - graphics->pushClipArea(rec); - content->drawFrame(graphics); - graphics->popClipArea(); - } - - graphics->pushClipArea(content->getDimension()); - content->draw(graphics); - graphics->popClipArea(); - graphics->popClipArea(); - } + drawChildren(graphics); } void ScrollArea::drawFrame(gcn::Graphics *graphics) diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h index 9fb7093d..be361f68 100644 --- a/src/gui/scrollarea.h +++ b/src/gui/scrollarea.h @@ -34,17 +34,18 @@ class ImageRect; * * \ingroup GUI */ -class ScrollArea : public gcn::ScrollArea { +class ScrollArea : public gcn::ScrollArea +{ public: /** * Constructor. */ - ScrollArea(bool gc=true); + ScrollArea(bool gc = true); /** * Constructor. */ - ScrollArea(gcn::Widget *content, bool gc=true); + ScrollArea(gcn::Widget *content, bool gc = true); /** * Destructor. @@ -70,14 +71,12 @@ class ScrollArea : public gcn::ScrollArea { /** * Sets whether the widget should draw its background or not. */ - void - setOpaque(bool opaque); + void setOpaque(bool opaque); /** * Returns whether the widget draws its background or not. */ - bool - isOpaque() { return mOpaque; } + bool isOpaque() const { return mOpaque; } protected: enum BUTTON_DIR { diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp index 84c8ad4b..8d16dc46 100644 --- a/src/gui/textbox.cpp +++ b/src/gui/textbox.cpp @@ -35,14 +35,7 @@ TextBox::TextBox(): setFrameSize(0); } -TextBox::TextBox(const std::string& text): - gcn::TextBox(text) -{ - setOpaque(false); - setFrameSize(0); -} - -void TextBox::setText(const std::string &text) +void TextBox::setTextWrapped(const std::string &text) { // Make sure parent scroll area sets width of this widget if (getParent()) diff --git a/src/gui/textbox.h b/src/gui/textbox.h index 54523281..f06f98ec 100644 --- a/src/gui/textbox.h +++ b/src/gui/textbox.h @@ -41,14 +41,9 @@ class TextBox : public gcn::TextBox { TextBox(); /** - * Constructor. - */ - TextBox(const std::string& text); - - /** * Sets the text after wrapping it to the current width of the widget. */ - void setText(const std::string &text); + void setTextWrapped(const std::string &text); }; #endif diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index c27f32c1..a43b1204 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -191,18 +191,19 @@ void Dye::instantiate(std::string &target, std::string const &palettes) std::string::size_type pos = next_pos; next_pos = target.find(';', pos); if (next_pos == std::string::npos) next_pos = last_pos; - if (next_pos == pos + 1) + if (next_pos == pos + 1 && pal_pos != std::string::npos) { - std::string::size_type pal_next_pos = palettes.find(';'); + std::string::size_type pal_next_pos = palettes.find(';', pal_pos); s << target[pos] << ':'; if (pal_next_pos == std::string::npos) { s << palettes.substr(pal_pos); s << target.substr(next_pos); + pal_pos = std::string::npos; break; } s << palettes.substr(pal_pos, pal_next_pos - pal_pos); - pal_pos = pal_next_pos; + pal_pos = pal_next_pos + 1; } else if (next_pos > pos + 2) { |