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

@@ -32,13 +32,11 @@ public:
{ "self", SEC_ADMINISTRATOR, false, &HandleCastSelfCommand, "" },
{ "target", SEC_ADMINISTRATOR, false, &HandleCastTargetCommad, "" },
{ "dest", SEC_ADMINISTRATOR, false, &HandleCastDestCommand, "" },
{ "", SEC_ADMINISTRATOR, false, &HandleCastCommand, "" },
{ NULL, 0, false, NULL, "" }
{ "", SEC_ADMINISTRATOR, false, &HandleCastCommand, "" }
};
static std::vector<ChatCommand> commandTable =
{
{ "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
{ NULL, 0, false, NULL, "" }
{ "cast", SEC_ADMINISTRATOR, false, nullptr, "", castCommandTable }
};
return commandTable;
}
@@ -85,7 +83,7 @@ public:
return false;
}
char* triggeredStr = strtok(NULL, " ");
char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -93,7 +91,7 @@ public:
return false;
}
bool triggered = (triggeredStr != NULL);
bool triggered = (triggeredStr != nullptr);
handler->GetSession()->GetPlayer()->CastSpell(target, spellId, triggered);
@@ -140,7 +138,7 @@ public:
return false;
}
char* triggeredStr = strtok(NULL, " ");
char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -148,7 +146,7 @@ public:
return false;
}
bool triggered = (triggeredStr != NULL);
bool triggered = (triggeredStr != nullptr);
caster->CastSpell(handler->GetSession()->GetPlayer(), spellId, triggered);
@@ -189,14 +187,14 @@ public:
return false;
}
char* distStr = strtok(NULL, " ");
char* distStr = strtok(nullptr, " ");
float dist = 0;
if (distStr)
sscanf(distStr, "%f", &dist);
char* triggeredStr = strtok(NULL, " ");
char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -204,7 +202,7 @@ public:
return false;
}
bool triggered = (triggeredStr != NULL);
bool triggered = (triggeredStr != nullptr);
float x, y, z;
handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, dist);
@@ -256,7 +254,7 @@ public:
return false;
}
char* triggeredStr = strtok(NULL, " ");
char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -264,7 +262,7 @@ public:
return false;
}
bool triggered = (triggeredStr != NULL);
bool triggered = (triggeredStr != nullptr);
target->CastSpell(target, spellId, triggered);
@@ -317,7 +315,7 @@ public:
return false;
}
char* triggeredStr = strtok(NULL, " ");
char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -325,7 +323,7 @@ public:
return false;
}
bool triggered = (triggeredStr != NULL);
bool triggered = (triggeredStr != nullptr);
caster->CastSpell(caster->GetVictim(), spellId, triggered);
@@ -371,9 +369,9 @@ public:
return false;
}
char* posX = strtok(NULL, " ");
char* posY = strtok(NULL, " ");
char* posZ = strtok(NULL, " ");
char* posX = strtok(nullptr, " ");
char* posY = strtok(nullptr, " ");
char* posZ = strtok(nullptr, " ");
if (!posX || !posY || !posZ)
return false;
@@ -382,7 +380,7 @@ public:
float y = float(atof(posY));
float z = float(atof(posZ));
char* triggeredStr = strtok(NULL, " ");
char* triggeredStr = strtok(nullptr, " ");
if (triggeredStr)
{
int l = strlen(triggeredStr);
@@ -390,7 +388,7 @@ public:
return false;
}
bool triggered = (triggeredStr != NULL);
bool triggered = (triggeredStr != nullptr);
caster->CastSpell(x, y, z, spellId, triggered);