aboutsummaryrefslogtreecommitdiff
path: root/src
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 00:26:30 +0200
commita3b4c40073ec50a9e65eff8ae3b2799c5e42d326 (patch)
tree0fadc4f4651adaeef3e273020e639e08edaa53ab /src
parentd621023192a6480aa0f338908a353002fc6accf1 (diff)
Core/Commands: Cleanup in 0940f3e0776b58bd7abad472347da7d0dea2ac50
Diffstat (limited to 'src')
-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 60f63650e54..57877845067 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
{
@@ -331,27 +331,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;