Fix commands and starting to use nullptr instead of NULL
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user