diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index e2103f511..bc805d7c5 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -485,14 +485,8 @@ public: return false; } - static bool CheckModifySpeed(ChatHandler* handler, char const* args, Unit* target, float& speed, float minimumBound, float maximumBound, bool checkInFlight = true) + static bool CheckModifySpeed(ChatHandler* handler, float& speed, Unit* target, float minimumBound, float maximumBound, bool checkInFlight = true) { - if (!*args) - { - return false; - } - - speed = Acore::StringTo(args).value(); if (speed > maximumBound || speed < minimumBound) { @@ -802,20 +796,10 @@ public: return false; } - char const* mount_cstr = strtok(const_cast(args), " "); - char const* speed_cstr = strtok(nullptr, " "); + char* token = strtok((char*)args, " "); + int mount = atoi(token); + float speed = atof(strtok(nullptr, " ")); - if (!mount_cstr) - { - return false; - } - - if (!speed_cstr) - { - speed_cstr = "1"; - } - - uint32 mount = Acore::StringTo(mount_cstr).value(); if (!sCreatureDisplayInfoStore.LookupEntry(mount)) { handler->SendSysMessage(LANG_NO_MOUNT); @@ -837,8 +821,7 @@ public: return false; } - float speed = 0.f; - if (!CheckModifySpeed(handler, speed_cstr, target, speed, 0.1f, 50.0f)) + if (!CheckModifySpeed(handler, speed, target, 0.1f, 50.0f)) { return false; }