summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/resources/mapreader.cpp7
-rw-r--r--src/utils/stringutils.cpp6
-rw-r--r--src/utils/stringutils.h9
3 files changed, 18 insertions, 4 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 291dd732..60b5e9d2 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -241,8 +241,8 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
{
if (xmlStrEqual(objectNode->name, BAD_CAST "object"))
{
- const std::string objType =
- XML::getProperty(objectNode, "type", "");
+ std::string objType = XML::getProperty(objectNode, "type", "");
+ objType = toUpper(objType);
if (objType == "WARP" || objType == "NPC" ||
objType == "SCRIPT" || objType == "SPAWN")
@@ -251,8 +251,7 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
continue;
}
- const std::string objName =
- XML::getProperty(objectNode, "name", "");
+ const std::string objName = XML::getProperty(objectNode, "name", "");
const int objX = XML::getProperty(objectNode, "x", 0);
const int objY = XML::getProperty(objectNode, "y", 0);
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index adcedaa1..67a0d831 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -50,6 +50,12 @@ std::string &toLower(std::string &str)
return str;
}
+std::string &toUpper(std::string &str)
+{
+ std::transform(str.begin(), str.end(), str.begin(), toupper);
+ return str;
+}
+
unsigned int atox(const std::string &str)
{
unsigned int value;
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index c5757d0f..51144a8a 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -42,6 +42,15 @@ std::string &trim(std::string &str);
std::string &toLower(std::string &str);
/**
+ * Converts the given strong to upper case.
+ *
+ * @param str the string to convert to upper case
+ * @return a reference to the given string converted to upper case
+ */
+std::string &toUpper(std::string &str);
+
+
+/**
* Converts an ascii hexidecimal string to an integer
*
* @param str the hex string to convert to an int