Fix commands and starting to use nullptr instead of NULL

This commit is contained in:
Yehonal
2016-08-20 09:49:37 +02:00
parent d7fdf7c940
commit 1b1767e9f4
32 changed files with 394 additions and 479 deletions

View File

@@ -33,8 +33,7 @@ public:
{ "walk", SEC_GAMEMASTER, false, &HandleModifySpeedCommand, "" },
{ "backwalk", SEC_GAMEMASTER, false, &HandleModifyBWalkCommand, "" },
{ "swim", SEC_GAMEMASTER, false, &HandleModifySwimCommand, "" },
{ "", SEC_GAMEMASTER, false, &HandleModifyASpeedCommand, "" },
{ NULL, 0, false, NULL, "" }
{ "", SEC_GAMEMASTER, false, &HandleModifyASpeedCommand, "" }
};
static std::vector<ChatCommand> modifyCommandTable =
@@ -58,15 +57,13 @@ public:
{ "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "" },
{ "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "" },
{ "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "" },
{ "speed", SEC_GAMEMASTER, false, NULL, "", modifyspeedCommandTable },
{ NULL, 0, false, NULL, "" }
{ "speed", SEC_GAMEMASTER, false, nullptr, "", modifyspeedCommandTable }
};
static std::vector<ChatCommand> commandTable =
{
{ "morph", SEC_GAMEMASTER, false, &HandleModifyMorphCommand, "" },
{ "demorph", SEC_GAMEMASTER, false, &HandleDeMorphCommand, "" },
{ "modify", SEC_GAMEMASTER, false, NULL, "", modifyCommandTable },
{ NULL, 0, false, NULL, "" }
{ "modify", SEC_GAMEMASTER, false, nullptr, "", modifyCommandTable }
};
return commandTable;
}
@@ -156,7 +153,7 @@ public:
// if (!pmana)
// return false;
// char* pmanaMax = strtok(NULL, " ");
// char* pmanaMax = strtok(nullptr, " ");
// if (!pmanaMax)
// return false;
@@ -207,7 +204,7 @@ public:
// if (!pmana)
// return false;
// char* pmanaMax = strtok(NULL, " ");
// char* pmanaMax = strtok(nullptr, " ");
// if (!pmanaMax)
// return false;
@@ -319,13 +316,13 @@ public:
uint32 factionid = atoi(pfactionid);
uint32 flag;
char *pflag = strtok(NULL, " ");
char *pflag = strtok(nullptr, " ");
if (!pflag)
flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
else
flag = atoi(pflag);
char* pnpcflag = strtok(NULL, " ");
char* pnpcflag = strtok(nullptr, " ");
uint32 npcflag;
if (!pnpcflag)
@@ -333,7 +330,7 @@ public:
else
npcflag = atoi(pnpcflag);
char* pdyflag = strtok(NULL, " ");
char* pdyflag = strtok(nullptr, " ");
uint32 dyflag;
if (!pdyflag)
@@ -368,17 +365,17 @@ public:
if (!pspellflatid)
return false;
char* pop = strtok(NULL, " ");
char* pop = strtok(nullptr, " ");
if (!pop)
return false;
char* pval = strtok(NULL, " ");
char* pval = strtok(nullptr, " ");
if (!pval)
return false;
uint16 mark;
char* pmark = strtok(NULL, " ");
char* pmark = strtok(nullptr, " ");
uint8 spellflatid = atoi(pspellflatid);
uint8 op = atoi(pop);
@@ -389,7 +386,7 @@ public:
mark = atoi(pmark);
Player* target = handler->getSelectedPlayer();
if (target == NULL)
if (target == nullptr)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
@@ -1080,7 +1077,7 @@ public:
if (!pField)
return false;
char* pBit = strtok(NULL, " ");
char* pBit = strtok(nullptr, " ");
if (!pBit)
return false;
@@ -1178,7 +1175,7 @@ public:
uint32 factionId = atoi(factionTxt);
int32 amount = 0;
char *rankTxt = strtok(NULL, " ");
char *rankTxt = strtok(nullptr, " ");
if (!factionTxt || !rankTxt)
return false;
@@ -1207,7 +1204,7 @@ public:
if (wrank.substr(0, wrankStr.size()) == wrankStr)
{
char *deltaTxt = strtok(NULL, " ");
char *deltaTxt = strtok(nullptr, " ");
if (deltaTxt)
{
int32 delta = atoi(deltaTxt);