diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-06-15 19:25:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-06-15 19:25:09 +0300 |
commit | 649fdb1c512e9608aa05c99a08b867c8758eeaf8 (patch) | |
tree | 36aefb040eefdc08cef57f760b3ac67a842b56b8 /src/utils/stringutils.cpp | |
parent | ffabda4c473711ffa8fdfe37c2a4460fe31347ac (diff) | |
download | plus-649fdb1c512e9608aa05c99a08b867c8758eeaf8.tar.gz plus-649fdb1c512e9608aa05c99a08b867c8758eeaf8.tar.bz2 plus-649fdb1c512e9608aa05c99a08b867c8758eeaf8.tar.xz plus-649fdb1c512e9608aa05c99a08b867c8758eeaf8.zip |
Add support for monster look.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index a07cd1a96..a0e31f06d 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -508,6 +508,36 @@ std::string combineDye2(std::string file, const std::string &dye) } } +std::string combineDye3(std::string file, const std::string &dye) +{ + if (dye.empty()) + return file; + + const size_t pos = file.find_last_of("|"); + if (pos != std::string::npos) + { + const std::string dye1 = file.substr(pos + 1); + std::string str; + file = file.substr(0, pos); + const std::list<std::string> list1 = splitToStringList(dye1, ';'); + const std::list<std::string> list2 = splitToStringList(dye, ';'); + for (std::list<std::string>::const_iterator it1 = list1.begin(), + it2 = list2.begin(), it1_end = list1.end(), it2_end = list2.end(); + it1 != it1_end && it2 != it2_end; ++it1, ++it2) + { + str.append(*it1).append(":").append(*it2).append(";"); + } + return file.append("|").append(str); + } + else + { + if (dye.empty() || file.empty()) + return file; + else + return file.append("|").append(dye); + } +} + std::string packList(const std::list<std::string> &list) { std::list<std::string>::const_iterator i = list.begin(); |