summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-04-14 07:50:25 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-04-14 07:50:25 +0000
commit51700ac6902da26847a2c0fd03780e20c6954b1f (patch)
tree55b84f56b0a316a57abd2565803a7eca33d16f44 /src
parent8c62978f845432f8cac046a0d6fd4587c087f22f (diff)
downloadmana-51700ac6902da26847a2c0fd03780e20c6954b1f.tar.gz
mana-51700ac6902da26847a2c0fd03780e20c6954b1f.tar.bz2
mana-51700ac6902da26847a2c0fd03780e20c6954b1f.tar.xz
mana-51700ac6902da26847a2c0fd03780e20c6954b1f.zip
Fixed multi-channel image dyeing (patch by fate)
Diffstat (limited to 'src')
-rw-r--r--src/resources/dye.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 2ce4a48d..195d5dd1 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)
{