aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent-Michael <vincent_michael@gmx.de>2016-05-08 00:25:57 +0200
committervincent-michael <vincent_michael@gmx.de>2016-05-08 16:12:11 +0200
commit3a74b52ddc96c47d676e77f032908d822453d9a2 (patch)
tree5c4b6ecdacd338723cb4ba7033b8f7271f1ee6d4
parent797a168f9acddbd0f718ec956b68297c677ebda9 (diff)
Core/Commands: Cleanup in 0940f3e0776b58bd7abad472347da7d0dea2ac50
(cherry picked from commit a3b4c40073ec50a9e65eff8ae3b2799c5e42d326)
-rw-r--r--src/server/scripts/Commands/cs_server.cpp24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp
index 6fdb3bcb847..2061df83d57 100644
--- a/src/server/scripts/Commands/cs_server.cpp
+++ b/src/server/scripts/Commands/cs_server.cpp
@@ -29,7 +29,7 @@ EndScriptData */
#include "Player.h"
#include "ScriptMgr.h"
#include "GitRevision.h"
-#include <regex>
+#include "Util.h"
class server_commandscript : public CommandScript
{
@@ -328,27 +328,7 @@ private:
}
else
{
- std::string timeStr(args);
- static std::regex const regex("[0-9]+[A-Za-z]");
- auto itr = std::sregex_iterator(timeStr.begin(), timeStr.end(), regex);
- auto timesEnd = std::sregex_iterator();
-
- for (; itr != timesEnd; ++itr)
- {
- std::string timeString = itr->str();
-
- int32 amount = atoi(timeString.c_str());
- if (std::count(timeString.begin(), timeString.end(), 'd') == 1)
- delay += amount * DAY;
- else if (std::count(timeString.begin(), timeString.end(), 'h') == 1)
- delay += amount * HOUR;
- else if (std::count(timeString.begin(), timeString.end(), 'm') == 1)
- delay += amount * MINUTE;
- else if (std::count(timeString.begin(), timeString.end(), 's') == 1)
- delay += amount * 1;
- else
- return false;
- }
+ delay = TimeStringToSecs(std::string(args));
if (delay == 0 || delay < 0)
return false;