From 3a091245572872f5cda79eab92eb392f92c02b39 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 Aug 2014 22:29:29 +0300 Subject: Move chat command /move into actions. --- src/utils/stringutils.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/utils/stringutils.cpp') 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; +} -- cgit v1.2.3-60-g2f50