summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-13 01:54:28 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-13 04:28:32 +0300
commitacba95ebb0119e7b0f9ef01d9bf3577582857253 (patch)
treeb5346c2a5642456e793b28487020cf1c727d8f07 /src/utils
parent0a47f5c44ddd5fb5157d116ffe0f5ee5f4207eb0 (diff)
downloadmv-acba95ebb0119e7b0f9ef01d9bf3577582857253.tar.gz
mv-acba95ebb0119e7b0f9ef01d9bf3577582857253.tar.bz2
mv-acba95ebb0119e7b0f9ef01d9bf3577582857253.tar.xz
mv-acba95ebb0119e7b0f9ef01d9bf3577582857253.zip
Add clan window.
For now can be opened only by chat command /clan.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/itemxmlutils.cpp25
-rw-r--r--src/utils/itemxmlutils.h5
2 files changed, 30 insertions, 0 deletions
diff --git a/src/utils/itemxmlutils.cpp b/src/utils/itemxmlutils.cpp
index cbf642c4f..2f849b8ce 100644
--- a/src/utils/itemxmlutils.cpp
+++ b/src/utils/itemxmlutils.cpp
@@ -54,3 +54,28 @@ void readItemStatsString(std::string &effect,
value.c_str()));
}
}
+
+void readItemStatsVector(STD_VECTOR<std::string> &effect,
+ XmlNodeConstPtr node,
+ const ItemFieldInfos &fields)
+{
+ if (translator == nullptr)
+ return;
+
+ FOR_EACH (ItemFieldInfos::const_iterator, it, fields)
+ {
+ const std::string fieldName = (*it).first;
+ const ItemFieldType *const field = (*it).second;
+
+ std::string value = XML::getProperty(node,
+ fieldName.c_str(),
+ "");
+ if (value.empty())
+ continue;
+ if (field->sign && isDigit(value))
+ value = std::string("+").append(value);
+ const std::string format = translator->getStr(field->description);
+ effect.push_back(strprintf(format.c_str(),
+ value.c_str()));
+ }
+}
diff --git a/src/utils/itemxmlutils.h b/src/utils/itemxmlutils.h
index 66f5d8fcd..c0f2860cb 100644
--- a/src/utils/itemxmlutils.h
+++ b/src/utils/itemxmlutils.h
@@ -21,6 +21,7 @@
#ifndef UTILS_ITEMXMLUTILS_H
#define UTILS_ITEMXMLUTILS_H
+#include "utils/vector.h"
#include "utils/xml.h"
#include "resources/itemfieldinfos.h"
@@ -31,4 +32,8 @@ void readItemStatsString(std::string &effect,
XmlNodeConstPtr node,
const ItemFieldInfos &fields);
+void readItemStatsVector(STD_VECTOR<std::string> &effect,
+ XmlNodeConstPtr node,
+ const ItemFieldInfos &fields);
+
#endif // UTILS_ITEMXMLUTILS_H