summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/questswindow.cpp6
-rw-r--r--src/utils/stringutils.cpp8
-rw-r--r--src/utils/stringutils.h4
3 files changed, 8 insertions, 10 deletions
diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp
index 42042e58f..d863e3dbd 100644
--- a/src/gui/questswindow.cpp
+++ b/src/gui/questswindow.cpp
@@ -259,8 +259,8 @@ void QuestsWindow::loadQuest(const int var, const XmlNodePtr node)
delete quest;
return;
}
- quest->incomplete = splitToIntSet(incompleteStr, ',');
- quest->complete = splitToIntSet(completeStr, ',');
+ splitToIntSet(quest->incomplete, incompleteStr, ',');
+ splitToIntSet(quest->complete, completeStr, ',');
if (quest->incomplete.empty() && quest->complete.empty())
{
logger->log("complete flags incorrect");
@@ -297,7 +297,7 @@ void QuestsWindow::loadEffect(const int var, const XmlNodePtr node)
effect->id = XML::getProperty(node, "npc", -1);
effect->effectId = XML::getProperty(node, "effect", -1);
const std::string values = XML::getProperty(node, "value", "");
- effect->values = splitToIntSet(values, ',');
+ splitToIntSet(effect->values, values, ',');
if (effect->map.empty() || effect->id == -1
|| effect->effectId == -1 || values.empty())
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index a0e31f06d..69474bd93 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -396,16 +396,14 @@ std::string normalize(const std::string &name)
return toLower(trim(normalized));
}
-std::set<int> splitToIntSet(const std::string &text,
- const char separator)
+void splitToIntSet(std::set<int> &tokens,
+ const std::string &text,
+ const char separator)
{
- std::set<int> tokens;
std::stringstream ss(text);
std::string item;
while (std::getline(ss, item, separator))
tokens.insert(atoi(item.c_str()));
-
- return tokens;
}
std::list<int> splitToIntList(const std::string &text,
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 96645261b..6a900663e 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -175,8 +175,8 @@ void replaceSpecialChars(std::string &text);
*/
std::string normalize(const std::string &name) A_WARN_UNUSED;
-std::set<int> splitToIntSet(const std::string &text,
- const char separator) A_WARN_UNUSED;
+void splitToIntSet(std::set<int> &tokens, const std::string &text,
+ const char separator) A_WARN_UNUSED;
std::list<int> splitToIntList(const std::string &text,
const char separator) A_WARN_UNUSED;