summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-25 22:29:29 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-25 22:29:29 +0300
commit3a091245572872f5cda79eab92eb392f92c02b39 (patch)
tree512e1b815194d865f67714542ab076411e084f32 /src/utils
parent10029599ee4cb4c26531303ab0e07cedc856f1ad (diff)
downloadManaVerse-3a091245572872f5cda79eab92eb392f92c02b39.tar.gz
ManaVerse-3a091245572872f5cda79eab92eb392f92c02b39.tar.bz2
ManaVerse-3a091245572872f5cda79eab92eb392f92c02b39.tar.xz
ManaVerse-3a091245572872f5cda79eab92eb392f92c02b39.zip
Move chat command /move into actions.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp16
-rw-r--r--src/utils/stringutils.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 31d68a418..11143206e 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -730,3 +730,19 @@ void secureChatCommand(std::string &str)
if (str[0] == '/' || str[0] == '@' || str[0] == '#')
str = "_" + str;
}
+
+bool parse2Int(const std::string &args, int &x, int &y)
+{
+ bool isValid = false;
+ const size_t pos = args.find(" ");
+ if (pos != std::string::npos)
+ {
+ if (pos + 1 < args.length())
+ {
+ x = atoi(args.substr(0, pos).c_str());
+ y = atoi(args.substr(pos + 1, args.length()).c_str());
+ isValid = true;
+ }
+ }
+ return isValid;
+}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 4f84dab76..5cf685a89 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -238,4 +238,6 @@ bool isDigit(const std::string &str);
void secureChatCommand(std::string &str);
+bool parse2Int(const std::string &args, int &x, int &y);
+
#endif // UTILS_STRINGUTILS_H