summaryrefslogtreecommitdiff
path: root/src/scripts/Commands/cs_wp.cpp
diff options
context:
space:
mode:
authorYehonal <yehonal.azeroth@gmail.com>2016-08-20 09:49:37 +0200
committerYehonal <yehonal.azeroth@gmail.com>2016-08-20 09:49:37 +0200
commit1b1767e9f4c20d1e20541968de98d00814f63247 (patch)
treeee95040cf29644aff151f9aebdf3bfd9e18ae08d /src/scripts/Commands/cs_wp.cpp
parentd7fdf7c940317aebcbbeeaf156469e1571e01498 (diff)
Fix commands and starting to use nullptr instead of NULL
Diffstat (limited to 'src/scripts/Commands/cs_wp.cpp')
-rw-r--r--src/scripts/Commands/cs_wp.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/scripts/Commands/cs_wp.cpp b/src/scripts/Commands/cs_wp.cpp
index c3eb660ad4..0873fda8c0 100644
--- a/src/scripts/Commands/cs_wp.cpp
+++ b/src/scripts/Commands/cs_wp.cpp
@@ -33,13 +33,11 @@ public:
{ "modify", SEC_GAMEMASTER, false, &HandleWpModifyCommand, "" },
{ "unload", SEC_GAMEMASTER, false, &HandleWpUnLoadCommand, "" },
{ "reload", SEC_ADMINISTRATOR, false, &HandleWpReloadCommand, "" },
- { "show", SEC_GAMEMASTER, false, &HandleWpShowCommand, "" },
- { NULL, 0, false, NULL, "" }
+ { "show", SEC_GAMEMASTER, false, &HandleWpShowCommand, "" }
};
static std::vector<ChatCommand> commandTable =
{
- { "wp", SEC_GAMEMASTER, false, NULL, "", wpCommandTable },
- { NULL, 0, false, NULL, "" }
+ { "wp", SEC_GAMEMASTER, false, nullptr, "", wpCommandTable }
};
return commandTable;
}
@@ -60,14 +58,14 @@ public:
* -> adds a waypoint to the currently selected creature
*
*
- * @param args if the user did not provide a GUID, it is NULL
+ * @param args if the user did not provide a GUID, it is nullptr
*
* @return true - command did succeed, false - something went wrong
*/
static bool HandleWpAddCommand(ChatHandler* handler, const char* args)
{
// optional
- char* path_number = NULL;
+ char* path_number = nullptr;
uint32 pathid = 0;
if (*args)
@@ -133,7 +131,7 @@ public:
return false;
// optional
- char* path_number = NULL;
+ char* path_number = nullptr;
if (*args)
path_number = strtok((char*)args, " ");
@@ -203,7 +201,7 @@ public:
target->LoadPath(pathid);
target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
target->GetMotionMaster()->Initialize();
- target->MonsterSay("Path loaded.", LANG_UNIVERSAL, NULL);
+ target->MonsterSay("Path loaded.", LANG_UNIVERSAL, nullptr);
return true;
}
@@ -259,7 +257,7 @@ public:
target->SetDefaultMovementType(IDLE_MOTION_TYPE);
target->GetMotionMaster()->MoveTargetedHome();
target->GetMotionMaster()->Initialize();
- target->MonsterSay("Path unloaded.", LANG_UNIVERSAL, NULL);
+ target->MonsterSay("Path unloaded.", LANG_UNIVERSAL, nullptr);
return true;
}
handler->PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path.");
@@ -279,7 +277,7 @@ public:
if ((show != "add") && (show != "mod") && (show != "del") && (show != "listid"))
return false;
- char* arg_id = strtok(NULL, " ");
+ char* arg_id = strtok(nullptr, " ");
uint32 id = 0;
if (show == "add")
@@ -413,7 +411,7 @@ public:
return true;
}
- char* arg_2 = strtok(NULL, " ");
+ char* arg_2 = strtok(nullptr, " ");
if (!arg_2)
{
@@ -433,7 +431,7 @@ public:
char* arg_3;
std::string arg_str_2 = arg_2;
- arg_3 = strtok(NULL, " ");
+ arg_3 = strtok(nullptr, " ");
if (!arg_3)
{
@@ -557,7 +555,7 @@ public:
}
// Next arg is: <PATHID> <WPNUM> <ARGUMENT>
- char* arg_str = NULL;
+ char* arg_str = nullptr;
// Did user provide a GUID
// or did the user select a creature?
@@ -620,10 +618,10 @@ public:
// We have the waypoint number and the GUID of the "master npc"
// Text is enclosed in "<>", all other arguments not
- arg_str = strtok((char*)NULL, " ");
+ arg_str = strtok((char*)nullptr, " ");
// Check for argument
- if (show != "del" && show != "move" && arg_str == NULL)
+ if (show != "del" && show != "move" && arg_str == nullptr)
{
handler->PSendSysMessage(LANG_WAYPOINT_ARGUMENTREQ, show_str);
return false;
@@ -683,7 +681,7 @@ public:
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
delete wpCreature2;
- wpCreature2 = NULL;
+ wpCreature2 = nullptr;
return false;
}
@@ -694,7 +692,7 @@ public:
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
delete wpCreature2;
- wpCreature2 = NULL;
+ wpCreature2 = nullptr;
return false;
}
//sMapMgr->GetMap(npcCreature->GetMapId())->Add(wpCreature2);
@@ -720,7 +718,7 @@ public:
if (text == 0)
{
// show_str check for present in list of correct values, no sql injection possible
- WorldDatabase.PExecute("UPDATE waypoint_data SET %s=NULL WHERE id='%u' AND point='%u'", show_str, pathid, point); // Query can't be a prepared statement
+ WorldDatabase.PExecute("UPDATE waypoint_data SET %s=nullptr WHERE id='%u' AND point='%u'", show_str, pathid, point); // Query can't be a prepared statement
}
else
{
@@ -745,7 +743,7 @@ public:
return false;
// second arg: GUID (optional, if a creature is selected)
- char* guid_str = strtok((char*)NULL, " ");
+ char* guid_str = strtok((char*)nullptr, " ");
uint32 pathid = 0;
Creature* target = handler->getSelectedCreature();