diff options
32 files changed, 394 insertions, 479 deletions
diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index 963d95d3d9..220e9685f7 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -348,10 +348,10 @@ bool ChatHandler::SetDataForCommandInTable(std::vector<ChatCommand>& table, char while (*text == ' ') ++text; - for (uint32 i = 0; table[i].Name != nullptr; i++) + for (uint32 i = 0; i < table.size(); i++) { // for data fill use full explicit command names - if (table[i].Name != cmd) + if (table[i].Name == nullptr || table[i].Name != cmd) continue; // select subcommand from child commands list (including "") @@ -372,7 +372,7 @@ bool ChatHandler::SetDataForCommandInTable(std::vector<ChatCommand>& table, char } //if (table[i].SecurityLevel != security) - ;//sLog->outDetail("Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security); + // sLog->outDetail("Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security); table[i].SecurityLevel = security; table[i].Help = help; @@ -383,9 +383,9 @@ bool ChatHandler::SetDataForCommandInTable(std::vector<ChatCommand>& table, char if (!cmd.empty()) { if (&table == &getCommandTable()) - sLog->outError("Table `command` have not existed command '%s', skip.", cmd.c_str()); + sLog->outError("Table `command` have non-existing command '%s', skip.", cmd.c_str()); else - sLog->outError("Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str()); + sLog->outError("Table `command` have non-existing subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str()); } return false; diff --git a/src/scripts/Commands/cs_account.cpp b/src/scripts/Commands/cs_account.cpp index 479f422171..22596bd939 100644 --- a/src/scripts/Commands/cs_account.cpp +++ b/src/scripts/Commands/cs_account.cpp @@ -29,8 +29,7 @@ public: { { "addon", SEC_ADMINISTRATOR, true, &HandleAccountSetAddonCommand, "" }, { "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "" }, - { "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "" }, - { NULL, SEC_PLAYER, false, NULL, "" } + { "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "" } }; static std::vector<ChatCommand> accountCommandTable = { @@ -39,15 +38,13 @@ public: { "delete", SEC_CONSOLE, true, &HandleAccountDeleteCommand, "" }, { "onlinelist", SEC_CONSOLE, true, &HandleAccountOnlineListCommand, "" }, { "lock", SEC_PLAYER, false, &HandleAccountLockCommand, "" }, - { "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable }, + { "set", SEC_ADMINISTRATOR, true, nullptr, "", accountSetCommandTable }, { "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "" }, - { "", SEC_PLAYER, false, &HandleAccountCommand, "" }, - { NULL, SEC_PLAYER, false, NULL, "" } + { "", SEC_PLAYER, false, &HandleAccountCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "account", SEC_PLAYER, true, NULL, "", accountCommandTable }, - { NULL, SEC_PLAYER, false, NULL, "" } + { "account", SEC_PLAYER, true, nullptr, "", accountCommandTable } }; return commandTable; } @@ -92,7 +89,7 @@ public: ///- %Parse the command line arguments char* accountName = strtok((char*)args, " "); - char* password = strtok(NULL, " "); + char* password = strtok(nullptr, " "); if (!accountName || !password) return false; @@ -160,7 +157,7 @@ public: /// Commands not recommended call from chat, but support anyway /// can delete only for account with less security /// This is also reject self apply in fact - if (handler->HasLowerSecurityAccount(NULL, accountId, true)) + if (handler->HasLowerSecurityAccount(nullptr, accountId, true)) return false; AccountOpResult result = AccountMgr::DeleteAccount(accountId); @@ -281,8 +278,8 @@ public: } char* oldPassword = strtok((char*)args, " "); - char* newPassword = strtok(NULL, " "); - char* passwordConfirmation = strtok(NULL, " "); + char* newPassword = strtok(nullptr, " "); + char* passwordConfirmation = strtok(nullptr, " "); if (!oldPassword || !newPassword || !passwordConfirmation) { @@ -336,7 +333,7 @@ public: { ///- Get the command line arguments char* account = strtok((char*)args, " "); - char* exp = strtok(NULL, " "); + char* exp = strtok(nullptr, " "); if (!account) return false; @@ -377,7 +374,7 @@ public: // Let set addon state only for lesser (strong) security level // or to self account if (handler->GetSession() && handler->GetSession()->GetAccountId() != accountId && - handler->HasLowerSecurityAccount(NULL, accountId, true)) + handler->HasLowerSecurityAccount(nullptr, accountId, true)) return false; int expansion = atoi(exp); //get int anyway (0 if error) @@ -405,8 +402,8 @@ public: uint32 targetSecurity = 0; uint32 gm = 0; char* arg1 = strtok((char*)args, " "); - char* arg2 = strtok(NULL, " "); - char* arg3 = strtok(NULL, " "); + char* arg2 = strtok(nullptr, " "); + char* arg3 = strtok(nullptr, " "); bool isAccountNameGiven = true; if (arg1 && !arg3) @@ -441,7 +438,7 @@ public: return false; } - // handler->getSession() == NULL only for console + // handler->getSession() == nullptr only for console targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId(); int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2); uint32 playerSecurity; @@ -529,8 +526,8 @@ public: ///- Get the command line arguments char* account = strtok((char*)args, " "); - char* password = strtok(NULL, " "); - char* passwordConfirmation = strtok(NULL, " "); + char* password = strtok(nullptr, " "); + char* passwordConfirmation = strtok(nullptr, " "); if (!account || !password || !passwordConfirmation) return false; @@ -553,7 +550,7 @@ public: /// can set password only for target with less security /// This is also reject self apply in fact - if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true)) + if (handler->HasLowerSecurityAccount(nullptr, targetAccountId, true)) return false; if (strcmp(password, passwordConfirmation)) diff --git a/src/scripts/Commands/cs_achievement.cpp b/src/scripts/Commands/cs_achievement.cpp index b10084527f..cb9470e431 100644 --- a/src/scripts/Commands/cs_achievement.cpp +++ b/src/scripts/Commands/cs_achievement.cpp @@ -26,13 +26,11 @@ public: static std::vector<ChatCommand> achievementCommandTable = { { "add", SEC_ADMINISTRATOR, false, &HandleAchievementAddCommand, "" }, - { "checkall", SEC_ADMINISTRATOR, false, &HandleAchievementCheckAllCommand, "" }, - { NULL, 0, false, NULL, "" } + { "checkall", SEC_ADMINISTRATOR, false, &HandleAchievementCheckAllCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "achievement", SEC_ADMINISTRATOR, false, NULL, "", achievementCommandTable }, - { NULL, 0, false, NULL, "" } + { "achievement", SEC_ADMINISTRATOR, false, nullptr, "", achievementCommandTable } }; return commandTable; } diff --git a/src/scripts/Commands/cs_ban.cpp b/src/scripts/Commands/cs_ban.cpp index 9be996214f..52cad18f0c 100644 --- a/src/scripts/Commands/cs_ban.cpp +++ b/src/scripts/Commands/cs_ban.cpp @@ -31,38 +31,33 @@ public: { "account", SEC_ADMINISTRATOR, true, &HandleUnBanAccountCommand, "" }, { "character", SEC_ADMINISTRATOR, true, &HandleUnBanCharacterCommand, "" }, { "playeraccount", SEC_ADMINISTRATOR, true, &HandleUnBanAccountByCharCommand, "" }, - { "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "" }, - { NULL, 0, false, NULL, "" } + { "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "" } }; static std::vector<ChatCommand> banlistCommandTable = { { "account", SEC_ADMINISTRATOR, true, &HandleBanListAccountCommand, "" }, { "character", SEC_ADMINISTRATOR, true, &HandleBanListCharacterCommand, "" }, - { "ip", SEC_ADMINISTRATOR, true, &HandleBanListIPCommand, "" }, - { NULL, 0, false, NULL, "" } + { "ip", SEC_ADMINISTRATOR, true, &HandleBanListIPCommand, "" } }; static std::vector<ChatCommand> baninfoCommandTable = { { "account", SEC_ADMINISTRATOR, true, &HandleBanInfoAccountCommand, "" }, { "character", SEC_ADMINISTRATOR, true, &HandleBanInfoCharacterCommand, "" }, - { "ip", SEC_ADMINISTRATOR, true, &HandleBanInfoIPCommand, "" }, - { NULL, 0, false, NULL, "" } + { "ip", SEC_ADMINISTRATOR, true, &HandleBanInfoIPCommand, "" } }; static std::vector<ChatCommand> banCommandTable = { { "account", SEC_ADMINISTRATOR, true, &HandleBanAccountCommand, "" }, { "character", SEC_ADMINISTRATOR, true, &HandleBanCharacterCommand, "" }, { "playeraccount", SEC_ADMINISTRATOR, true, &HandleBanAccountByCharCommand, "" }, - { "ip", SEC_ADMINISTRATOR, true, &HandleBanIPCommand, "" }, - { NULL, 0, false, NULL, "" } + { "ip", SEC_ADMINISTRATOR, true, &HandleBanIPCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "ban", SEC_ADMINISTRATOR, true, NULL, "", banCommandTable }, - { "baninfo", SEC_ADMINISTRATOR, true, NULL, "", baninfoCommandTable }, - { "banlist", SEC_ADMINISTRATOR, true, NULL, "", banlistCommandTable }, - { "unban", SEC_ADMINISTRATOR, true, NULL, "", unbanCommandTable }, - { NULL, 0, false, NULL, "" } + { "ban", SEC_ADMINISTRATOR, true, nullptr, "", banCommandTable }, + { "baninfo", SEC_ADMINISTRATOR, true, nullptr, "", baninfoCommandTable }, + { "banlist", SEC_ADMINISTRATOR, true, nullptr, "", banlistCommandTable }, + { "unban", SEC_ADMINISTRATOR, true, nullptr, "", unbanCommandTable } }; return commandTable; } @@ -83,11 +78,11 @@ public: std::string name = nameStr; - char* durationStr = strtok(NULL, " "); + char* durationStr = strtok(nullptr, " "); if (!durationStr || !atoi(durationStr)) return false; - char* reasonStr = strtok(NULL, ""); + char* reasonStr = strtok(nullptr, ""); if (!reasonStr) return false; @@ -142,11 +137,11 @@ public: std::string nameOrIP = cnameOrIP; - char* durationStr = strtok(NULL, " "); + char* durationStr = strtok(nullptr, " "); if (!durationStr || !atoi(durationStr)) return false; - char* reasonStr = strtok(NULL, ""); + char* reasonStr = strtok(nullptr, ""); if (!reasonStr) return false; @@ -250,7 +245,7 @@ public: time_t unbanDate = time_t(fields[3].GetUInt32()); bool active = false; - if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(NULL))) + if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(nullptr))) active = true; bool permanent = (fields[1].GetUInt64() == uint64(0)); std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true); @@ -298,7 +293,7 @@ public: Field* fields = result->Fetch(); time_t unbanDate = time_t(fields[3].GetUInt32()); bool active = false; - if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(NULL))) + if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(nullptr))) active = true; bool permanent = (fields[1].GetUInt32() == uint32(0)); std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true); diff --git a/src/scripts/Commands/cs_bf.cpp b/src/scripts/Commands/cs_bf.cpp index 4e88686b19..6544edff3e 100644 --- a/src/scripts/Commands/cs_bf.cpp +++ b/src/scripts/Commands/cs_bf.cpp @@ -28,13 +28,11 @@ public: { "stop", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnd, "" }, { "switch", SEC_ADMINISTRATOR, false, &HandleBattlefieldSwitch, "" }, { "timer", SEC_ADMINISTRATOR, false, &HandleBattlefieldTimer, "" }, - { "enable", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnable, "" }, - { NULL, 0, false, NULL, "" } + { "enable", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnable, "" } }; static std::vector<ChatCommand> commandTable = { - { "bf", SEC_ADMINISTRATOR, false, NULL, "", battlefieldcommandTable }, - { NULL, 0, false, NULL, "" } + { "bf", SEC_ADMINISTRATOR, false, nullptr, "", battlefieldcommandTable } }; return commandTable; } @@ -141,7 +139,7 @@ public: char* battleid_str = strtok((char*)args, " "); if (!battleid_str) return false; - char* time_str = strtok(NULL, " "); + char* time_str = strtok(nullptr, " "); if (!time_str) return false; diff --git a/src/scripts/Commands/cs_cast.cpp b/src/scripts/Commands/cs_cast.cpp index 743a9f75aa..e65fcb76e2 100644 --- a/src/scripts/Commands/cs_cast.cpp +++ b/src/scripts/Commands/cs_cast.cpp @@ -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); diff --git a/src/scripts/Commands/cs_character.cpp b/src/scripts/Commands/cs_character.cpp index bfd078ebe4..dcf98d5e6a 100644 --- a/src/scripts/Commands/cs_character.cpp +++ b/src/scripts/Commands/cs_character.cpp @@ -29,8 +29,7 @@ public: static std::vector<ChatCommand> pdumpCommandTable = { { "load", SEC_ADMINISTRATOR, true, &HandlePDumpLoadCommand, "" }, - { "write", SEC_ADMINISTRATOR, true, &HandlePDumpWriteCommand, "" }, - { NULL, 0, false, NULL, "" } + { "write", SEC_ADMINISTRATOR, true, &HandlePDumpWriteCommand, "" } }; static std::vector<ChatCommand> characterCommandTable = @@ -41,16 +40,14 @@ public: { "level", SEC_ADMINISTRATOR, true, &HandleCharacterLevelCommand, "" }, { "rename", SEC_GAMEMASTER, true, &HandleCharacterRenameCommand, "" }, { "reputation", SEC_GAMEMASTER, true, &HandleCharacterReputationCommand, "" }, - { "titles", SEC_GAMEMASTER, true, &HandleCharacterTitlesCommand, "" }, - { NULL, 0, false, NULL, "" } + { "titles", SEC_GAMEMASTER, true, &HandleCharacterTitlesCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable }, + { "character", SEC_GAMEMASTER, true, nullptr, "", characterCommandTable }, { "levelup", SEC_ADMINISTRATOR, false, &HandleLevelUpCommand, "" }, - { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, - { NULL, 0, false, NULL, "" } + { "pdump", SEC_ADMINISTRATOR, true, nullptr, "", pdumpCommandTable } }; return commandTable; } @@ -159,7 +156,7 @@ public: else { // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) + if (handler->HasLowerSecurity(nullptr, targetGuid)) return false; std::string oldNameLink = handler->playerLink(targetName); @@ -186,7 +183,7 @@ public: if (isalpha(levelStr[0])) { nameStr = levelStr; - levelStr = NULL; // current level will used + levelStr = nullptr; // current level will used } Player* target; @@ -205,7 +202,7 @@ public: newlevel = DEFAULT_MAX_LEVEL; HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler); - if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including player == NULL + if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including player == nullptr { std::string nameLink = handler->playerLink(targetName); handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel); @@ -352,7 +349,7 @@ public: if (levelStr && isalpha(levelStr[0])) { nameStr = levelStr; - levelStr = NULL; // current level will used + levelStr = nullptr; // current level will used } Player* target; @@ -373,7 +370,7 @@ public: HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler); - if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including chr == NULL + if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including chr == nullptr { std::string nameLink = handler->playerLink(targetName); handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel); @@ -391,7 +388,7 @@ public: if (!fileStr) return false; - char* accountStr = strtok(NULL, " "); + char* accountStr = strtok(nullptr, " "); if (!accountStr) return false; @@ -422,8 +419,8 @@ public: return false; } - char* guidStr = NULL; - char* nameStr = strtok(NULL, " "); + char* guidStr = nullptr; + char* nameStr = strtok(nullptr, " "); std::string name; if (nameStr) @@ -444,7 +441,7 @@ public: return false; } - guidStr = strtok(NULL, " "); + guidStr = strtok(nullptr, " "); } uint32 guid = 0; @@ -499,7 +496,7 @@ public: return false; char* fileStr = strtok((char*)args, " "); - char* playerStr = strtok(NULL, " "); + char* playerStr = strtok(nullptr, " "); if (!fileStr && !playerStr) { diff --git a/src/scripts/Commands/cs_debug.cpp b/src/scripts/Commands/cs_debug.cpp index 996343dcf1..fd544dfe63 100644 --- a/src/scripts/Commands/cs_debug.cpp +++ b/src/scripts/Commands/cs_debug.cpp @@ -35,8 +35,7 @@ public: { { "cinematic", SEC_GAMEMASTER, false, &HandleDebugPlayCinematicCommand, "" }, { "movie", SEC_GAMEMASTER, false, &HandleDebugPlayMovieCommand, "" }, - { "sound", SEC_GAMEMASTER, false, &HandleDebugPlaySoundCommand, "" }, - { NULL, SEC_PLAYER, false, NULL, "" } + { "sound", SEC_GAMEMASTER, false, &HandleDebugPlaySoundCommand, "" } }; static std::vector<ChatCommand> debugSendCommandTable = { @@ -50,8 +49,7 @@ public: { "qinvalidmsg", SEC_ADMINISTRATOR, false, &HandleDebugSendQuestInvalidMsgCommand, "" }, { "sellerror", SEC_ADMINISTRATOR, false, &HandleDebugSendSellErrorCommand, "" }, { "setphaseshift", SEC_ADMINISTRATOR, false, &HandleDebugSendSetPhaseShiftCommand, "" }, - { "spellfail", SEC_ADMINISTRATOR, false, &HandleDebugSendSpellFailCommand, "" }, - { NULL, SEC_PLAYER, false, NULL, "" } + { "spellfail", SEC_ADMINISTRATOR, false, &HandleDebugSendSpellFailCommand, "" } }; static std::vector<ChatCommand> debugCommandTable = { @@ -66,8 +64,8 @@ public: { "getvalue", SEC_ADMINISTRATOR, false, &HandleDebugGetValueCommand, "" }, { "getitemvalue", SEC_ADMINISTRATOR, false, &HandleDebugGetItemValueCommand, "" }, { "Mod32Value", SEC_ADMINISTRATOR, false, &HandleDebugMod32ValueCommand, "" }, - { "play", SEC_GAMEMASTER, false, NULL, "", debugPlayCommandTable }, - { "send", SEC_ADMINISTRATOR, false, NULL, "", debugSendCommandTable }, + { "play", SEC_GAMEMASTER, false, nullptr, "", debugPlayCommandTable }, + { "send", SEC_ADMINISTRATOR, false, nullptr, "", debugSendCommandTable }, { "setaurastate", SEC_ADMINISTRATOR, false, &HandleDebugSetAuraStateCommand, "" }, { "setitemvalue", SEC_ADMINISTRATOR, false, &HandleDebugSetItemValueCommand, "" }, { "setvalue", SEC_ADMINISTRATOR, false, &HandleDebugSetValueCommand, "" }, @@ -80,14 +78,13 @@ public: { "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "" }, { "los", SEC_GAMEMASTER, false, &HandleDebugLoSCommand, "" }, { "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "" }, - { "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "" }, - { NULL, SEC_PLAYER, false, NULL, "" } + { "unitstate", SEC_ADMINISTRATOR, false, &HandleDebugUnitStateCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "debug", SEC_GAMEMASTER, true, NULL, "", debugCommandTable }, + { "debug", SEC_GAMEMASTER, true, nullptr, "", debugCommandTable }, { "wpgps", SEC_ADMINISTRATOR, false, &HandleWPGPSCommand, "", }, - { NULL, SEC_PLAYER, false, NULL, "", } + { nullptr, SEC_PLAYER, false, nullptr, "", } }; return commandTable; } @@ -191,10 +188,10 @@ public: if (failNum == 0 && *result != '0') return false; - char* fail1 = strtok(NULL, " "); + char* fail1 = strtok(nullptr, " "); uint8 failArg1 = fail1 ? (uint8)atoi(fail1) : 0; - char* fail2 = strtok(NULL, " "); + char* fail2 = strtok(nullptr, " "); uint8 failArg2 = fail2 ? (uint8)atoi(fail2) : 0; WorldPacket data(SMSG_CAST_FAILED, 5); @@ -217,7 +214,7 @@ public: return false; InventoryResult msg = InventoryResult(atoi(args)); - handler->GetSession()->GetPlayer()->SendEquipError(msg, NULL, NULL); + handler->GetSession()->GetPlayer()->SendEquipError(msg, nullptr, nullptr); return true; } @@ -244,7 +241,7 @@ public: static bool HandleDebugSendOpcodeCommand(ChatHandler* handler, char const* /*args*/) { Unit* unit = handler->getSelectedUnit(); - Player* player = NULL; + Player* player = nullptr; if (!unit || (unit->GetTypeId() != TYPEID_PLAYER)) player = handler->GetSession()->GetPlayer(); else @@ -415,7 +412,7 @@ public: static bool HandleDebugUpdateWorldStateCommand(ChatHandler* handler, char const* args) { char* w = strtok((char*)args, " "); - char* s = strtok(NULL, " "); + char* s = strtok(nullptr, " "); if (!w || !s) return false; @@ -631,9 +628,9 @@ public: continue; } - if (updateQueue[qp] == NULL) + if (updateQueue[qp] == nullptr) { - handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to NULL in the queue!", item->GetSlot(), item->GetGUIDLow(), qp); + handler->PSendSysMessage("The item with slot %d and guid %d has its queuepos (%d) pointing to nullptr in the queue!", item->GetSlot(), item->GetGUIDLow(), qp); error = true; continue; } @@ -699,9 +696,9 @@ public: continue; } - if (updateQueue[qp] == NULL) + if (updateQueue[qp] == nullptr) { - handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); + handler->PSendSysMessage("The item in bag %d at slot %d having guid %d has a queuepos (%d) that points to nullptr in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); error = true; continue; } @@ -748,7 +745,7 @@ public: Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot()); - if (test == NULL) + if (test == nullptr) { handler->PSendSysMessage("queue(" SIZEFMTD "): The bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have any item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow()); error = true; @@ -869,7 +866,7 @@ public: if (!i) return false; - char* j = strtok(NULL, " "); + char* j = strtok(nullptr, " "); uint32 entry = (uint32)atoi(i); int8 seatId = j ? (int8)atoi(j) : -1; @@ -878,7 +875,7 @@ public: handler->GetSession()->GetPlayer()->EnterVehicle(target, seatId); else { - Creature* passenger = NULL; + Creature* passenger = nullptr; Trinity::AllCreaturesOfEntryInRange check(handler->GetSession()->GetPlayer(), entry, 20.0f); Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(handler->GetSession()->GetPlayer(), passenger, check); handler->GetSession()->GetPlayer()->VisitNearbyObject(30.0f, searcher); @@ -897,7 +894,7 @@ public: return false; char* e = strtok((char*)args, " "); - char* i = strtok(NULL, " "); + char* i = strtok(nullptr, " "); if (!e) return false; @@ -963,7 +960,7 @@ public: return false; char* e = strtok((char*)args, " "); - char* f = strtok(NULL, " "); + char* f = strtok(nullptr, " "); if (!e || !f) return false; @@ -992,8 +989,8 @@ public: return false; char* e = strtok((char*)args, " "); - char* f = strtok(NULL, " "); - char* g = strtok(NULL, " "); + char* f = strtok(nullptr, " "); + char* g = strtok(nullptr, " "); if (!e || !f || !g) return false; @@ -1091,8 +1088,8 @@ public: return false; char* x = strtok((char*)args, " "); - char* y = strtok(NULL, " "); - char* z = strtok(NULL, " "); + char* y = strtok(nullptr, " "); + char* z = strtok(nullptr, " "); if (!x || !y) return false; @@ -1140,7 +1137,7 @@ public: return false; char* x = strtok((char*)args, " "); - char* z = strtok(NULL, " "); + char* z = strtok(nullptr, " "); if (!x) return false; @@ -1186,7 +1183,7 @@ public: return false; char* x = strtok((char*)args, " "); - char* y = strtok(NULL, " "); + char* y = strtok(nullptr, " "); if (!x || !y) return false; @@ -1241,7 +1238,7 @@ public: else if (updateIndex >= UNIT_END) return true; - char* val = strtok(NULL, " "); + char* val = strtok(nullptr, " "); if (!val) { value = unit->GetUInt32Value(updateIndex); @@ -1273,7 +1270,7 @@ public: } char* x = strtok((char*)args, " "); - char* y = strtok(NULL, " "); + char* y = strtok(nullptr, " "); if (!x || !y) return false; @@ -1307,7 +1304,7 @@ public: if (!mask1) return false; - char* mask2 = strtok(NULL, " \n"); + char* mask2 = strtok(nullptr, " \n"); uint32 moveFlags = (uint32)atoi(mask1); target->SetUnitMovementFlags(moveFlags); diff --git a/src/scripts/Commands/cs_event.cpp b/src/scripts/Commands/cs_event.cpp index 2738d9c7ed..596750f5a8 100644 --- a/src/scripts/Commands/cs_event.cpp +++ b/src/scripts/Commands/cs_event.cpp @@ -29,13 +29,11 @@ public: { "activelist", SEC_GAMEMASTER, true, &HandleEventActiveListCommand, "" }, { "start", SEC_GAMEMASTER, true, &HandleEventStartCommand, "" }, { "stop", SEC_GAMEMASTER, true, &HandleEventStopCommand, "" }, - { "", SEC_GAMEMASTER, true, &HandleEventInfoCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_GAMEMASTER, true, &HandleEventInfoCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "event", SEC_GAMEMASTER, false, NULL, "", eventCommandTable }, - { NULL, 0, false, NULL, "" } + { "event", SEC_GAMEMASTER, false, nullptr, "", eventCommandTable } }; return commandTable; } @@ -106,8 +104,8 @@ public: std::string endTimeStr = TimeToTimestampStr(eventData.end); uint32 delay = sGameEventMgr->NextCheck(eventId); - time_t nextTime = time(NULL) + delay; - std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(NULL) + delay) : "-"; + time_t nextTime = time(nullptr) + delay; + std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(nullptr) + delay) : "-"; std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE, true); std::string lengthStr = secsToTimeString(eventData.length * MINUTE, true); diff --git a/src/scripts/Commands/cs_gm.cpp b/src/scripts/Commands/cs_gm.cpp index 3debda2bbc..06b2033d52 100644 --- a/src/scripts/Commands/cs_gm.cpp +++ b/src/scripts/Commands/cs_gm.cpp @@ -34,13 +34,11 @@ public: //{ "ingame", SEC_PLAYER, true, &HandleGMListIngameCommand, "" }, { "list", SEC_ADMINISTRATOR, true, &HandleGMListFullCommand, "" }, { "visible", SEC_GAMEMASTER, false, &HandleGMVisibleCommand, "" }, - { "", SEC_GAMEMASTER, false, &HandleGMCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_GAMEMASTER, false, &HandleGMCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "gm", SEC_GAMEMASTER, false, NULL, "", gmCommandTable }, - { NULL, 0, false, NULL, "" } + { "gm", SEC_GAMEMASTER, false, nullptr, "", gmCommandTable } }; return commandTable; } diff --git a/src/scripts/Commands/cs_go.cpp b/src/scripts/Commands/cs_go.cpp index 3c84cb6598..352a177ea9 100644 --- a/src/scripts/Commands/cs_go.cpp +++ b/src/scripts/Commands/cs_go.cpp @@ -37,14 +37,12 @@ public: { "zonexy", SEC_GAMEMASTER, false, &HandleGoZoneXYCommand, "" }, { "xyz", SEC_GAMEMASTER, false, &HandleGoXYZCommand, "" }, { "ticket", SEC_GAMEMASTER, false, &HandleGoTicketCommand, "" }, - { "", SEC_GAMEMASTER, false, &HandleGoXYZCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_GAMEMASTER, false, &HandleGoXYZCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "go", SEC_GAMEMASTER, false, NULL, "", goCommandTable }, - { NULL, 0, false, NULL, "" } + { "go", SEC_GAMEMASTER, false, nullptr, "", goCommandTable } }; return commandTable; } @@ -79,7 +77,7 @@ public: { // Get the "creature_template.entry" // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r - char* tail = strtok(NULL, ""); + char* tail = strtok(nullptr, ""); if (!tail) return false; char* id = handler->extractKeyFromLink(tail, "Hcreature_entry"); @@ -210,8 +208,8 @@ public: Player* player = handler->GetSession()->GetPlayer(); char* gridX = strtok((char*)args, " "); - char* gridY = strtok(NULL, " "); - char* id = strtok(NULL, " "); + char* gridY = strtok(nullptr, " "); + char* id = strtok(nullptr, " "); if (!gridX || !gridY) return false; @@ -402,8 +400,8 @@ public: Player* player = handler->GetSession()->GetPlayer(); char* zoneX = strtok((char*)args, " "); - char* zoneY = strtok(NULL, " "); - char* tail = strtok(NULL, ""); + char* zoneY = strtok(nullptr, " "); + char* tail = strtok(nullptr, ""); char* id = handler->extractKeyFromLink(tail, "Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r @@ -474,10 +472,10 @@ public: Player* player = handler->GetSession()->GetPlayer(); char* goX = strtok((char*)args, " "); - char* goY = strtok(NULL, " "); - char* goZ = strtok(NULL, " "); - char* id = strtok(NULL, " "); - char* port = strtok(NULL, " "); + char* goY = strtok(nullptr, " "); + char* goZ = strtok(nullptr, " "); + char* id = strtok(nullptr, " "); + char* port = strtok(nullptr, " "); if (!goX || !goY) return false; diff --git a/src/scripts/Commands/cs_gobject.cpp b/src/scripts/Commands/cs_gobject.cpp index 465a491f41..bbb80fb0f1 100644 --- a/src/scripts/Commands/cs_gobject.cpp +++ b/src/scripts/Commands/cs_gobject.cpp @@ -33,14 +33,12 @@ public: static std::vector<ChatCommand> gobjectAddCommandTable = { { "temp", SEC_GAMEMASTER, false, &HandleGameObjectAddTempCommand, "" }, - { "", SEC_GAMEMASTER, false, &HandleGameObjectAddCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_GAMEMASTER, false, &HandleGameObjectAddCommand, "" } }; static std::vector<ChatCommand> gobjectSetCommandTable = { { "phase", SEC_GAMEMASTER, false, &HandleGameObjectSetPhaseCommand, "" }, - { "state", SEC_GAMEMASTER, false, &HandleGameObjectSetStateCommand, "" }, - { NULL, 0, false, NULL, "" } + { "state", SEC_GAMEMASTER, false, &HandleGameObjectSetStateCommand, "" } }; static std::vector<ChatCommand> gobjectCommandTable = { @@ -51,14 +49,12 @@ public: { "near", SEC_GAMEMASTER, false, &HandleGameObjectNearCommand, "" }, { "target", SEC_GAMEMASTER, false, &HandleGameObjectTargetCommand, "" }, { "turn", SEC_GAMEMASTER, false, &HandleGameObjectTurnCommand, "" }, - { "add", SEC_GAMEMASTER, false, NULL, "", gobjectAddCommandTable }, - { "set", SEC_GAMEMASTER, false, NULL, "", gobjectSetCommandTable }, - { NULL, 0, false, NULL, "" } + { "add", SEC_GAMEMASTER, false, nullptr, "", gobjectAddCommandTable }, + { "set", SEC_GAMEMASTER, false, nullptr, "", gobjectSetCommandTable } }; static std::vector<ChatCommand> commandTable = { - { "gobject", SEC_GAMEMASTER, false, NULL, "", gobjectCommandTable }, - { NULL, 0, false, NULL, "" } + { "gobject", SEC_GAMEMASTER, false, nullptr, "", gobjectCommandTable } }; return commandTable; } @@ -76,7 +72,7 @@ public: if (!guidLow) return false; - GameObject* object = NULL; + GameObject* object = nullptr; // by DB guid if (GameObjectData const* goData = sObjectMgr->GetGOData(guidLow)) @@ -113,7 +109,7 @@ public: if (!objectId) return false; - char* spawntimeSecs = strtok(NULL, " "); + char* spawntimeSecs = strtok(nullptr, " "); const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId); @@ -188,7 +184,7 @@ public: Player* player = handler->GetSession()->GetPlayer(); - char* spawntime = strtok(NULL, " "); + char* spawntime = strtok(nullptr, " "); uint32 spawntm = 300; if (spawntime) @@ -240,7 +236,7 @@ public: else { std::ostringstream eventFilter; - eventFilter << " AND (eventEntry IS NULL "; + eventFilter << " AND (eventEntry IS nullptr "; bool initString = true; for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr) @@ -314,7 +310,7 @@ public: if (target) { - int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(NULL)); + int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(nullptr)); if (curRespawnDelay < 0) curRespawnDelay = 0; @@ -338,7 +334,7 @@ public: if (!guidLow) return false; - GameObject* object = NULL; + GameObject* object = nullptr; // by DB guid if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) @@ -386,7 +382,7 @@ public: if (!guidLow) return false; - GameObject* object = NULL; + GameObject* object = nullptr; // by DB guid if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) @@ -399,17 +395,17 @@ public: return false; } - char* orientation = strtok(NULL, " "); + char* orientation = strtok(nullptr, " "); float oz = 0.f, oy = 0.f, ox = 0.f; if (orientation) { oz = float(atof(orientation)); - orientation = strtok(NULL, " "); + orientation = strtok(nullptr, " "); if (orientation) { oy = float(atof(orientation)); - orientation = strtok(NULL, " "); + orientation = strtok(nullptr, " "); if (orientation) ox = float(atof(orientation)); } @@ -444,7 +440,7 @@ public: if (!guidLow) return false; - GameObject* object = NULL; + GameObject* object = nullptr; // by DB guid if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) @@ -457,9 +453,9 @@ public: return false; } - char* toX = strtok(NULL, " "); - char* toY = strtok(NULL, " "); - char* toZ = strtok(NULL, " "); + char* toX = strtok(nullptr, " "); + char* toY = strtok(nullptr, " "); + char* toZ = strtok(nullptr, " "); if (!toX) { @@ -509,7 +505,7 @@ public: if (!guidLow) return false; - GameObject* object = NULL; + GameObject* object = nullptr; // by DB guid if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) @@ -522,7 +518,7 @@ public: return false; } - char* phase = strtok (NULL, " "); + char* phase = strtok (nullptr, " "); uint32 phaseMask = phase ? atoi(phase) : 0; if (phaseMask == 0) { @@ -589,7 +585,7 @@ public: uint32 displayId = 0; std::string name; uint32 lootId = 0; - GameObject* gameObject = NULL; + GameObject* gameObject = nullptr; if (!*args) { @@ -646,7 +642,7 @@ public: if (!guidLow) return false; - GameObject* object = NULL; + GameObject* object = nullptr; if (guidLow > 0) { @@ -664,7 +660,7 @@ public: return false; } - char* type = strtok(NULL, " "); + char* type = strtok(nullptr, " "); if (!type) return false; @@ -678,7 +674,7 @@ public: return true; } - char* state = strtok(NULL, " "); + char* state = strtok(nullptr, " "); if (!state) return false; diff --git a/src/scripts/Commands/cs_guild.cpp b/src/scripts/Commands/cs_guild.cpp index ad37a9bfc2..f8ae16d58b 100644 --- a/src/scripts/Commands/cs_guild.cpp +++ b/src/scripts/Commands/cs_guild.cpp @@ -31,13 +31,11 @@ public: { "delete", SEC_GAMEMASTER, true, &HandleGuildDeleteCommand, "" }, { "invite", SEC_GAMEMASTER, true, &HandleGuildInviteCommand, "" }, { "uninvite", SEC_GAMEMASTER, true, &HandleGuildUninviteCommand, "" }, - { "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "" }, - { NULL, 0, false, NULL, "" } + { "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, - { NULL, 0, false, NULL, "" } + { "guild", SEC_ADMINISTRATOR, true, nullptr, "", guildCommandTable } }; return commandTable; } @@ -57,10 +55,10 @@ public: // if not guild name only (in "") then player name Player* target; - if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target)) + if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : nullptr, &target)) return false; - char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; + char* tailStr = *args != '"' ? strtok(nullptr, "") : (char*)args; if (!tailStr) return false; @@ -118,10 +116,10 @@ public: // if not guild name only (in "") then player name uint64 targetGuid; - if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &targetGuid)) + if (!handler->extractPlayerTarget(*args != '"' ? (char*)args : nullptr, nullptr, &targetGuid)) return false; - char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; + char* tailStr = *args != '"' ? strtok(nullptr, "") : (char*)args; if (!tailStr) return false; diff --git a/src/scripts/Commands/cs_honor.cpp b/src/scripts/Commands/cs_honor.cpp index 2daccb1dbd..39c13e22fa 100644 --- a/src/scripts/Commands/cs_honor.cpp +++ b/src/scripts/Commands/cs_honor.cpp @@ -27,21 +27,18 @@ public: static std::vector<ChatCommand> honorAddCommandTable = { { "kill", SEC_GAMEMASTER, false, &HandleHonorAddKillCommand, "" }, - { "", SEC_GAMEMASTER, false, &HandleHonorAddCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_GAMEMASTER, false, &HandleHonorAddCommand, "" } }; static std::vector<ChatCommand> honorCommandTable = { - { "add", SEC_GAMEMASTER, false, NULL, "", honorAddCommandTable }, - { "update", SEC_GAMEMASTER, false, &HandleHonorUpdateCommand, "" }, - { NULL, 0, false, NULL, "" } + { "add", SEC_GAMEMASTER, false, nullptr, "", honorAddCommandTable }, + { "update", SEC_GAMEMASTER, false, &HandleHonorUpdateCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable }, - { NULL, 0, false, NULL, "" } + { "honor", SEC_GAMEMASTER, false, nullptr, "", honorCommandTable } }; return commandTable; } @@ -64,7 +61,7 @@ public: return false; uint32 amount = (uint32)atoi(args); - target->RewardHonor(NULL, 1, amount); + target->RewardHonor(nullptr, 1, amount); return true; } diff --git a/src/scripts/Commands/cs_instance.cpp b/src/scripts/Commands/cs_instance.cpp index 8866da386f..4e053395e4 100644 --- a/src/scripts/Commands/cs_instance.cpp +++ b/src/scripts/Commands/cs_instance.cpp @@ -34,14 +34,12 @@ public: { "stats", SEC_ADMINISTRATOR, true, &HandleInstanceStatsCommand, "" }, { "savedata", SEC_ADMINISTRATOR, false, &HandleInstanceSaveDataCommand, "" }, { "setbossstate", SEC_GAMEMASTER, true, &HandleInstanceSetBossStateCommand, "" }, - { "getbossstate", SEC_GAMEMASTER, true, &HandleInstanceGetBossStateCommand, "" }, - { NULL, 0, false, NULL, "" } + { "getbossstate", SEC_GAMEMASTER, true, &HandleInstanceGetBossStateCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, - { NULL, 0, false, NULL, "" } + { "instance", SEC_ADMINISTRATOR, true, nullptr, "", instanceCommandTable } }; return commandTable; @@ -73,7 +71,7 @@ public: { InstanceSave* save = itr->second.save; uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime(); - uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0); + uint32 ttr = (resetTime >= time(nullptr) ? resetTime - time(nullptr) : 0); std::string timeleft = GetTimeString(ttr); handler->PSendSysMessage("map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : "")); counter++; @@ -94,7 +92,7 @@ public: player = handler->GetSession()->GetPlayer(); char* map = strtok((char*)args, " "); - char* pDiff = strtok(NULL, " "); + char* pDiff = strtok(nullptr, " "); int8 diff = -1; if (pDiff) diff = atoi(pDiff); @@ -117,7 +115,7 @@ public: if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty())) { uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime(); - uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0); + uint32 ttr = (resetTime >= time(nullptr) ? resetTime - time(nullptr) : 0); std::string timeleft = GetTimeString(ttr); handler->PSendSysMessage("unbinding map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : "")); sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), itr->first, Difficulty(i), true, player); @@ -175,11 +173,11 @@ public: return false; char* param1 = strtok((char*)args, " "); - char* param2 = strtok(NULL, " "); - char* param3 = strtok(NULL, " "); + char* param2 = strtok(nullptr, " "); + char* param3 = strtok(nullptr, " "); uint32 encounterId = 0; int32 state = 0; - Player* player = NULL; + Player* player = nullptr; std::string playerName; // Character name must be provided when using this from console. @@ -244,9 +242,9 @@ public: return false; char* param1 = strtok((char*)args, " "); - char* param2 = strtok(NULL, " "); + char* param2 = strtok(nullptr, " "); uint32 encounterId = 0; - Player* player = NULL; + Player* player = nullptr; std::string playerName; // Character name must be provided when using this from console. diff --git a/src/scripts/Commands/cs_learn.cpp b/src/scripts/Commands/cs_learn.cpp index 662be7c98c..a24f7dfa39 100644 --- a/src/scripts/Commands/cs_learn.cpp +++ b/src/scripts/Commands/cs_learn.cpp @@ -32,33 +32,29 @@ public: { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "" }, { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "" }, { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "" }, - { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "" }, - { NULL, 0, false, NULL, "" } + { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "" } }; static std::vector<ChatCommand> learnAllCommandTable = { - { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable }, + { "my", SEC_ADMINISTRATOR, false, nullptr, "", learnAllMyCommandTable }, { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "" }, { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "" }, { "default", SEC_GAMEMASTER, false, &HandleLearnAllDefaultCommand, "" }, { "lang", SEC_GAMEMASTER, false, &HandleLearnAllLangCommand, "" }, - { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "" }, - { NULL, 0, false, NULL, "" } + { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "" } }; static std::vector<ChatCommand> learnCommandTable = { - { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable }, - { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "" }, - { NULL, 0, false, NULL, "" } + { "all", SEC_ADMINISTRATOR, false, nullptr, "", learnAllCommandTable }, + { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "learn", SEC_GAMEMASTER, false, NULL, "", learnCommandTable }, - { "unlearn", SEC_ADMINISTRATOR, false, &HandleUnLearnCommand, "" }, - { NULL, 0, false, NULL, "" } + { "learn", SEC_GAMEMASTER, false, nullptr, "", learnCommandTable }, + { "unlearn", SEC_ADMINISTRATOR, false, &HandleUnLearnCommand, "" } }; return commandTable; } @@ -103,7 +99,7 @@ public: return false; } - char const* all = strtok(NULL, " "); + char const* all = strtok(nullptr, " "); bool allRanks = all ? (strncmp(all, "all", strlen(all)) == 0) : false; if (!allRanks && targetPlayer->HasSpell(spell)) @@ -389,7 +385,7 @@ public: std::string name; - SkillLineEntry const* targetSkillInfo = NULL; + SkillLineEntry const* targetSkillInfo = nullptr; for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) { SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i); @@ -485,7 +481,7 @@ public: if (!spellId) return false; - char const* allStr = strtok(NULL, " "); + char const* allStr = strtok(nullptr, " "); bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false; Player* target = handler->getSelectedPlayer(); diff --git a/src/scripts/Commands/cs_lfg.cpp b/src/scripts/Commands/cs_lfg.cpp index 3a061336db..86f057cd0a 100644 --- a/src/scripts/Commands/cs_lfg.cpp +++ b/src/scripts/Commands/cs_lfg.cpp @@ -39,22 +39,22 @@ public: { "queue", SEC_GAMEMASTER, false, &HandleLfgQueueInfoCommand, "" }, { "clean", SEC_ADMINISTRATOR, false, &HandleLfgCleanCommand, "" }, { "options", SEC_ADMINISTRATOR, false, &HandleLfgOptionsCommand, "" }, - { NULL, SEC_PLAYER, false, NULL, "" } + { nullptr, SEC_PLAYER, false, nullptr, "" } }; static std::vector<ChatCommand> commandTable = { - { "lfg", SEC_GAMEMASTER, false, NULL, "", lfgCommandTable }, - { NULL, SEC_PLAYER, false, NULL, "" } + { "lfg", SEC_GAMEMASTER, false, nullptr, "", lfgCommandTable }, + { nullptr, SEC_PLAYER, false, nullptr, "" } }; return commandTable; } static bool HandleLfgPlayerInfoCommand(ChatHandler* handler, char const* args) { - Player* target = NULL; + Player* target = nullptr; std::string playerName; - if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) + if (!handler->extractPlayerTarget((char*)args, &target, nullptr, &playerName)) return false; GetPlayerInfo(handler, target); @@ -63,9 +63,9 @@ public: static bool HandleLfgGroupInfoCommand(ChatHandler* handler, char const* args) { - Player* target = NULL; + Player* target = nullptr; std::string playerName; - if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) + if (!handler->extractPlayerTarget((char*)args, &target, nullptr, &playerName)) return false; Group* grp = target->GetGroup(); @@ -80,7 +80,7 @@ public: handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(), state.c_str(), sLFGMgr->GetDungeon(guid)); - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) GetPlayerInfo(handler, itr->GetSource()); */ return true; diff --git a/src/scripts/Commands/cs_list.cpp b/src/scripts/Commands/cs_list.cpp index e6686064c4..6230c26b4b 100644 --- a/src/scripts/Commands/cs_list.cpp +++ b/src/scripts/Commands/cs_list.cpp @@ -31,13 +31,11 @@ public: { "creature", SEC_ADMINISTRATOR, true, &HandleListCreatureCommand, "" }, { "item", SEC_ADMINISTRATOR, true, &HandleListItemCommand, "" }, { "object", SEC_ADMINISTRATOR, true, &HandleListObjectCommand, "" }, - { "auras", SEC_ADMINISTRATOR, false, &HandleListAurasCommand, "" }, - { NULL, 0, false, NULL, "" } + { "auras", SEC_ADMINISTRATOR, false, &HandleListAurasCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable }, - { NULL, 0, false, NULL, "" } + { "list", SEC_ADMINISTRATOR, true, nullptr, "", listCommandTable } }; return commandTable; } @@ -68,7 +66,7 @@ public: return false; } - char* countStr = strtok(NULL, " "); + char* countStr = strtok(nullptr, " "); uint32 count = countStr ? atol(countStr) : 10; if (count == 0) @@ -140,7 +138,7 @@ public: return false; } - char* countStr = strtok(NULL, " "); + char* countStr = strtok(nullptr, " "); uint32 count = countStr ? atol(countStr) : 10; if (count == 0) @@ -215,7 +213,7 @@ public: result = CharacterDatabase.Query(stmt); } else - result = PreparedQueryResult(NULL); + result = PreparedQueryResult(nullptr); if (result) { @@ -262,7 +260,7 @@ public: result = CharacterDatabase.Query(stmt); } else - result = PreparedQueryResult(NULL); + result = PreparedQueryResult(nullptr); if (result) { @@ -357,7 +355,7 @@ public: return false; } - char* countStr = strtok(NULL, " "); + char* countStr = strtok(nullptr, " "); uint32 count = countStr ? atol(countStr) : 10; if (count == 0) diff --git a/src/scripts/Commands/cs_lookup.cpp b/src/scripts/Commands/cs_lookup.cpp index 1d245f6d0a..5d2476071a 100644 --- a/src/scripts/Commands/cs_lookup.cpp +++ b/src/scripts/Commands/cs_lookup.cpp @@ -32,15 +32,13 @@ public: { { "ip", SEC_GAMEMASTER, true, &HandleLookupPlayerIpCommand, "" }, { "account", SEC_GAMEMASTER, true, &HandleLookupPlayerAccountCommand, "" }, - { "email", SEC_GAMEMASTER, true, &HandleLookupPlayerEmailCommand, "" }, - { NULL, 0, false, NULL, "" } + { "email", SEC_GAMEMASTER, true, &HandleLookupPlayerEmailCommand, "" } }; static std::vector<ChatCommand> lookupSpellCommandTable = { { "id", SEC_ADMINISTRATOR, true, &HandleLookupSpellIdCommand, "" }, - { "", SEC_ADMINISTRATOR, true, &HandleLookupSpellCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_ADMINISTRATOR, true, &HandleLookupSpellCommand, "" } }; static std::vector<ChatCommand> lookupCommandTable = @@ -53,20 +51,18 @@ public: { "itemset", SEC_ADMINISTRATOR, true, &HandleLookupItemSetCommand, "" }, { "object", SEC_ADMINISTRATOR, true, &HandleLookupObjectCommand, "" }, { "quest", SEC_ADMINISTRATOR, true, &HandleLookupQuestCommand, "" }, - { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable }, + { "player", SEC_GAMEMASTER, true, nullptr, "", lookupPlayerCommandTable }, { "skill", SEC_ADMINISTRATOR, true, &HandleLookupSkillCommand, "" }, - { "spell", SEC_ADMINISTRATOR, true, NULL, "", lookupSpellCommandTable }, + { "spell", SEC_ADMINISTRATOR, true, nullptr, "", lookupSpellCommandTable }, { "taxinode", SEC_ADMINISTRATOR, true, &HandleLookupTaxiNodeCommand, "" }, { "tele", SEC_GAMEMASTER, true, &HandleLookupTeleCommand, "" }, { "title", SEC_GAMEMASTER, true, &HandleLookupTitleCommand, "" }, - { "map", SEC_ADMINISTRATOR, true, &HandleLookupMapCommand, "" }, - { NULL, 0, false, NULL, "" } + { "map", SEC_ADMINISTRATOR, true, &HandleLookupMapCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, - { NULL, 0, false, NULL, "" } + { "lookup", SEC_ADMINISTRATOR, true, nullptr, "", lookupCommandTable } }; return commandTable; } @@ -257,7 +253,7 @@ public: if (!*args) return false; - // Can be NULL at console call + // Can be nullptr at console call Player* target = handler->getSelectedPlayer(); std::string namePart = args; @@ -278,7 +274,7 @@ public: FactionEntry const* factionEntry = sFactionStore.LookupEntry(id); if (factionEntry) { - FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL; + FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : nullptr; int locale = handler->GetSessionDbcLocale(); std::string name = factionEntry->name[locale]; @@ -318,7 +314,7 @@ public: else ss << id << " - " << name << ' ' << localeNames[locale]; - if (factionState) // and then target != NULL also + if (factionState) // and then target != nullptr also { uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry); std::string rankName = handler->GetTrinityString(index); @@ -529,7 +525,7 @@ public: if (!*args) return false; - // can be NULL at console call + // can be nullptr at console call Player* target = handler->getSelectedPlayer(); std::string namePart = args; @@ -605,7 +601,7 @@ public: if (!*args) return false; - // can be NULL in console call + // can be nullptr in console call Player* target = handler->getSelectedPlayer(); std::string namePart = args; @@ -693,7 +689,7 @@ public: if (!*args) return false; - // can be NULL at console call + // can be nullptr at console call Player* target = handler->getSelectedPlayer(); std::string namePart = args; @@ -805,7 +801,7 @@ public: if (!*args) return false; - // can be NULL at console call + // can be nullptr at console call Player* target = handler->getSelectedPlayer(); uint32 id = atoi((char*)args); @@ -1025,7 +1021,7 @@ public: if (!*args) return false; - // can be NULL in console call + // can be nullptr in console call Player* target = handler->getSelectedPlayer(); // title name have single string arg for player name @@ -1182,7 +1178,7 @@ public: Player* target = handler->getSelectedPlayer(); if (!*args) { - // NULL only if used from console + // nullptr only if used from console if (!target || target == handler->GetSession()->GetPlayer()) return false; @@ -1192,7 +1188,7 @@ public: else { ip = strtok((char*)args, " "); - limitStr = strtok(NULL, " "); + limitStr = strtok(nullptr, " "); limit = limitStr ? atoi(limitStr) : -1; } @@ -1209,7 +1205,7 @@ public: return false; std::string account = strtok((char*)args, " "); - char* limitStr = strtok(NULL, " "); + char* limitStr = strtok(nullptr, " "); int32 limit = limitStr ? atoi(limitStr) : -1; if (!AccountMgr::normalizeString @@ -1229,7 +1225,7 @@ public: return false; std::string email = strtok((char*)args, " "); - char* limitStr = strtok(NULL, " "); + char* limitStr = strtok(nullptr, " "); int32 limit = limitStr ? atoi(limitStr) : -1; PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL); @@ -1281,7 +1277,7 @@ public: uint32 guid = characterFields[0].GetUInt32(); std::string name = characterFields[1].GetString(); uint8 plevel = 0, prace = 0, pclass = 0; - bool online = (ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)) != NULL); + bool online = (ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)) != nullptr); if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(guid)) { diff --git a/src/scripts/Commands/cs_message.cpp b/src/scripts/Commands/cs_message.cpp index 0782c5e360..6214a19653 100644 --- a/src/scripts/Commands/cs_message.cpp +++ b/src/scripts/Commands/cs_message.cpp @@ -32,8 +32,7 @@ public: { "gmannounce", SEC_GAMEMASTER, true, &HandleGMAnnounceCommand, "" }, { "notify", SEC_GAMEMASTER, true, &HandleNotifyCommand, "" }, { "gmnotify", SEC_GAMEMASTER, true, &HandleGMNotifyCommand, "" }, - { "whispers", SEC_GAMEMASTER, false, &HandleWhispersCommand, "" }, - { NULL, 0, false, NULL, "" } + { "whispers", SEC_GAMEMASTER, false, &HandleWhispersCommand, "" } }; return commandTable; } diff --git a/src/scripts/Commands/cs_misc.cpp b/src/scripts/Commands/cs_misc.cpp index fffbf2dfc9..e38f9b5d9e 100644 --- a/src/scripts/Commands/cs_misc.cpp +++ b/src/scripts/Commands/cs_misc.cpp @@ -41,23 +41,20 @@ public: { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "" }, { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "" }, { "join", SEC_ADMINISTRATOR, false, &HandleGroupJoinCommand, "" }, - { "list", SEC_ADMINISTRATOR, false, &HandleGroupListCommand, "" }, - { NULL, 0, false, NULL, "" } + { "list", SEC_ADMINISTRATOR, false, &HandleGroupListCommand, "" } }; static std::vector<ChatCommand> petCommandTable = { { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "" }, { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "" }, - { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "" }, - { NULL, 0, false, NULL, "" } + { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "" } }; static std::vector<ChatCommand> sendCommandTable = { { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "" }, { "mail", SEC_GAMEMASTER, true, &HandleSendMailCommand, "" }, { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "" }, - { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "" }, - { NULL, 0, false, NULL, "" } + { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "" } }; static std::vector<ChatCommand> commandTable = { @@ -96,8 +93,8 @@ public: { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "" }, { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "" }, { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "" }, - { "send", SEC_GAMEMASTER, true, NULL, "", sendCommandTable }, - { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, + { "send", SEC_GAMEMASTER, true, nullptr, "", sendCommandTable }, + { "pet", SEC_GAMEMASTER, false, nullptr, "", petCommandTable }, { "mute", SEC_GAMEMASTER, true, &HandleMuteCommand, "" }, { "unmute", SEC_GAMEMASTER, true, &HandleUnmuteCommand, "" }, { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "" }, @@ -109,15 +106,14 @@ public: { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterwalkCommand, "" }, { "freeze", SEC_GAMEMASTER, false, &HandleFreezeCommand, "" }, { "unfreeze", SEC_GAMEMASTER, false, &HandleUnFreezeCommand, "" }, - { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable }, + { "group", SEC_ADMINISTRATOR, false, nullptr, "", groupCommandTable }, { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "" }, { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "" }, { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "" }, { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "" }, { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "" }, { "skirmish", SEC_ADMINISTRATOR, false, HandleSkirmishCommand, "" }, - { "mailbox", SEC_ADMINISTRATOR, false, &HandleMailBoxCommand, "" }, - { NULL, 0, false, NULL, "" } + { "mailbox", SEC_ADMINISTRATOR, false, &HandleMailBoxCommand, "" } }; return commandTable; } @@ -205,8 +201,8 @@ public: uint8 hcnt = count / 2; uint8 error = 0; std::string last_name; - Player* plr = NULL; - Player* players[10] = {NULL}; + Player* plr = nullptr; + Player* players[10] = {nullptr}; uint8 cnt = 0; for (; i != tokens.end(); ++i) { @@ -371,7 +367,7 @@ public: static bool HandleGPSCommand(ChatHandler* handler, char const* args) { - WorldObject* object = NULL; + WorldObject* object = nullptr; if (*args) { uint64 guid = handler->extractGuidFromLink((char*)args); @@ -622,7 +618,7 @@ public: else { // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) + if (handler->HasLowerSecurity(nullptr, targetGuid)) return false; std::string nameLink = handler->playerLink(targetName); @@ -740,7 +736,7 @@ public: else { // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) + if (handler->HasLowerSecurity(nullptr, targetGuid)) return false; std::string nameLink = handler->playerLink(targetName); @@ -795,7 +791,7 @@ public: return false; } - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* player = itr->GetSource(); @@ -883,7 +879,7 @@ public: Unit::Kill(handler->GetSession()->GetPlayer(), target); } else - Unit::DealDamage(handler->GetSession()->GetPlayer(), target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false, true); + Unit::DealDamage(handler->GetSession()->GetPlayer(), target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false, true); } return true; @@ -974,7 +970,7 @@ public: if (!param1) return false; - char const* param2 = strtok(NULL, " "); + char const* param2 = strtok(nullptr, " "); if (!param2) return false; @@ -1037,7 +1033,7 @@ public: static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args) { - WorldObject* obj = NULL; + WorldObject* obj = nullptr; if (*args) { @@ -1113,9 +1109,9 @@ public: // kick player static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args) { - Player* target = NULL; + Player* target = nullptr; std::string playerName; - if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) + if (!handler->extractPlayerTarget((char*)args, &target, nullptr, &playerName)) return false; if (handler->GetSession() && target == handler->GetSession()->GetPlayer()) @@ -1158,10 +1154,10 @@ public: return false; std::string location_str = "inn"; - if (char const* loc = strtok(NULL, " ")) + if (char const* loc = strtok(nullptr, " ")) location_str = loc; - Player* player = NULL; + Player* player = nullptr; if (!handler->extractPlayerTarget(player_str, &player)) return false; @@ -1256,7 +1252,7 @@ public: TeamId teamId; - char* px2 = strtok(NULL, " "); + char* px2 = strtok(nullptr, " "); if (!px2) teamId = TEAM_NEUTRAL; @@ -1499,12 +1495,12 @@ public: itemId = uint32(atol(id)); } - char const* ccount = strtok(NULL, " "); + char const* ccount = strtok(nullptr, " "); int32 count = 1; if (ccount) - count = strtol(ccount, NULL, 10); + count = strtol(ccount, nullptr, 10); if (count == 0) count = 1; @@ -1626,7 +1622,7 @@ public: } else { - player->SendEquipError(msg, NULL, NULL, itr->second.ItemId); + player->SendEquipError(msg, nullptr, nullptr, itr->second.ItemId); handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1); } } @@ -1663,7 +1659,7 @@ public: // *Change the weather of a cell char const* px = strtok((char*)args, " "); - char const* py = strtok(NULL, " "); + char const* py = strtok(nullptr, " "); if (!px || !py) return false; @@ -1713,11 +1709,11 @@ public: if (!skillStr) return false; - char const* levelStr = strtok(NULL, " "); + char const* levelStr = strtok(nullptr, " "); if (!levelStr) return false; - char const* maxPureSkill = strtok(NULL, " "); + char const* maxPureSkill = strtok(nullptr, " "); int32 skill = atoi(skillStr); if (skill <= 0) @@ -1831,7 +1827,7 @@ public: else { // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) + if (handler->HasLowerSecurity(nullptr, targetGuid)) return false; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); @@ -1921,11 +1917,11 @@ public: banreason = fields[3].GetString(); } - if (muteTime > 0 && muteTime > time(NULL)) - handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str(), muteBy.c_str(), muteReason.c_str()); + if (muteTime > 0 && muteTime > time(nullptr)) + handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(nullptr), true).c_str(), muteBy.c_str(), muteReason.c_str()); if (banTime >= 0) - handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str()); + handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(nullptr), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str()); std::string raceStr, ClassStr; switch (race) @@ -2081,9 +2077,9 @@ public: if (!delayStr) return false; - char const* muteReason = strtok(NULL, "\r"); + char const* muteReason = strtok(nullptr, "\r"); std::string muteReasonStr = "No reason"; - if (muteReason != NULL) + if (muteReason != nullptr) muteReasonStr = muteReason; Player* target; @@ -2115,7 +2111,7 @@ public: if (target) { // Target is online, mute will be in effect right away. - int64 muteTime = time(NULL) + notSpeakTime * MINUTE; + int64 muteTime = time(nullptr) + notSpeakTime * MINUTE; target->GetSession()->m_muteTime = muteTime; stmt->setInt64(0, muteTime); ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str()); @@ -2237,7 +2233,7 @@ public: break; case CHASE_MOTION_TYPE: { - Unit* target = NULL; + Unit* target = nullptr; if (unit->GetTypeId() == TYPEID_PLAYER) target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget(); else @@ -2253,7 +2249,7 @@ public: } case FOLLOW_MOTION_TYPE: { - Unit* target = NULL; + Unit* target = nullptr; if (unit->GetTypeId() == TYPEID_PLAYER) target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget(); else @@ -2355,7 +2351,7 @@ public: if (target->GetTypeId() == TYPEID_UNIT && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth()); - Unit::DealDamage(handler->GetSession()->GetPlayer(), target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false, true); + Unit::DealDamage(handler->GetSession()->GetPlayer(), target, damage, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false, true); if (target != handler->GetSession()->GetPlayer()) handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0); return true; @@ -2363,7 +2359,7 @@ public: static bool HandleCombatStopCommand(ChatHandler* handler, char const* args) { - Player* target = NULL; + Player* target = nullptr; if (args && strlen(args) > 0) { @@ -2460,7 +2456,7 @@ public: if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; - char* tail1 = strtok(NULL, ""); + char* tail1 = strtok(nullptr, ""); if (!tail1) return false; @@ -2468,7 +2464,7 @@ public: if (!msgSubject) return false; - char* tail2 = strtok(NULL, ""); + char* tail2 = strtok(nullptr, ""); if (!tail2) return false; @@ -2504,7 +2500,7 @@ public: if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) return false; - char* tail1 = strtok(NULL, ""); + char* tail1 = strtok(nullptr, ""); if (!tail1) return false; @@ -2512,7 +2508,7 @@ public: if (!msgSubject) return false; - char* tail2 = strtok(NULL, ""); + char* tail2 = strtok(nullptr, ""); if (!tail2) return false; @@ -2530,17 +2526,17 @@ public: ItemPairs items; // get all tail string - char* tail = strtok(NULL, ""); + char* tail = strtok(nullptr, ""); // get from tail next item str while (char* itemStr = strtok(tail, " ")) { // and get new tail - tail = strtok(NULL, ""); + tail = strtok(nullptr, ""); // parse item str char const* itemIdStr = strtok(itemStr, ":"); - char const* itemCountStr = strtok(NULL, " "); + char const* itemCountStr = strtok(nullptr, " "); uint32 itemId = atoi(itemIdStr); if (!itemId) @@ -2613,7 +2609,7 @@ public: if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName)) return false; - char* tail1 = strtok(NULL, ""); + char* tail1 = strtok(nullptr, ""); if (!tail1) return false; @@ -2621,7 +2617,7 @@ public: if (!msgSubject) return false; - char* tail2 = strtok(NULL, ""); + char* tail2 = strtok(nullptr, ""); if (!tail2) return false; @@ -2629,7 +2625,7 @@ public: if (!msgText) return false; - char* moneyStr = strtok(NULL, ""); + char* moneyStr = strtok(nullptr, ""); int32 money = moneyStr ? atoi(moneyStr) : 0; if (money <= 0) return false; @@ -2657,14 +2653,14 @@ public: static bool HandleSendMessageCommand(ChatHandler* handler, char const* args) { /// - Find the player - Player* player = NULL; + Player* player = nullptr; if (!handler->extractPlayerTarget((char*)args, &player)) return false; if (!player) return false; - char* msgStr = strtok(NULL, ""); + char* msgStr = strtok(nullptr, ""); if (!msgStr) return false; @@ -2919,8 +2915,8 @@ public: static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args) { - Player* player = NULL; - Group* group = NULL; + Player* player = nullptr; + Group* group = nullptr; uint64 guid = 0; char* nameStr = strtok((char*)args, " "); @@ -2936,8 +2932,8 @@ public: static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args) { - Player* player = NULL; - Group* group = NULL; + Player* player = nullptr; + Group* group = nullptr; uint64 guid = 0; char* nameStr = strtok((char*)args, " "); @@ -2950,8 +2946,8 @@ public: static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args) { - Player* player = NULL; - Group* group = NULL; + Player* player = nullptr; + Group* group = nullptr; uint64 guid = 0; char* nameStr = strtok((char*)args, " "); @@ -2967,19 +2963,19 @@ public: if (!*args) return false; - Player* playerSource = NULL; - Group* groupSource = NULL; + Player* playerSource = nullptr; + Group* groupSource = nullptr; uint64 guidSource = 0; uint64 guidTarget = 0; char* nameplgrStr = strtok((char*)args, " "); - char* nameplStr = strtok(NULL, " "); + char* nameplStr = strtok(nullptr, " "); if (handler->GetPlayerGroupAndGUIDByName(nameplgrStr, playerSource, groupSource, guidSource, true)) { if (groupSource) { - Group* groupTarget = NULL; - Player* playerTarget = NULL; + Group* groupTarget = nullptr; + Player* playerTarget = nullptr; if (handler->GetPlayerGroupAndGUIDByName(nameplStr, playerTarget, groupTarget, guidTarget, true)) { if (!groupTarget && playerTarget->GetGroup() != groupSource) @@ -3033,7 +3029,7 @@ public: else if (!handler->extractPlayerTarget((char*)args, &playerTarget, &guidTarget, &nameTarget)) return false; - Group* groupTarget = NULL; + Group* groupTarget = nullptr; if (playerTarget) groupTarget = playerTarget->GetGroup(); diff --git a/src/scripts/Commands/cs_modify.cpp b/src/scripts/Commands/cs_modify.cpp index a087c4dc4d..94fb1d0cfa 100644 --- a/src/scripts/Commands/cs_modify.cpp +++ b/src/scripts/Commands/cs_modify.cpp @@ -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); diff --git a/src/scripts/Commands/cs_npc.cpp b/src/scripts/Commands/cs_npc.cpp index 8992cd5ac2..5b30e66742 100644 --- a/src/scripts/Commands/cs_npc.cpp +++ b/src/scripts/Commands/cs_npc.cpp @@ -74,20 +74,17 @@ public: //{ TODO: fix or remove this command { "weapon", SEC_ADMINISTRATOR, false, &HandleNpcAddWeaponCommand, "" }, //} - { "", SEC_GAMEMASTER, false, &HandleNpcAddCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_GAMEMASTER, false, &HandleNpcAddCommand, "" } }; static std::vector<ChatCommand> npcDeleteCommandTable = { { "item", SEC_GAMEMASTER, false, &HandleNpcDeleteVendorItemCommand, "" }, - { "", SEC_GAMEMASTER, false, &HandleNpcDeleteCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_GAMEMASTER, false, &HandleNpcDeleteCommand, "" } }; static std::vector<ChatCommand> npcFollowCommandTable = { { "stop", SEC_GAMEMASTER, false, &HandleNpcUnFollowCommand, "" }, - { "", SEC_GAMEMASTER, false, &HandleNpcFollowCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_GAMEMASTER, false, &HandleNpcFollowCommand, "" } }; static std::vector<ChatCommand> npcSetCommandTable = { @@ -105,9 +102,8 @@ public: { "data", SEC_ADMINISTRATOR, false, &HandleNpcSetDataCommand, "" }, //{ TODO: fix or remove these commands { "name", SEC_GAMEMASTER, false, &HandleNpcSetNameCommand, "" }, - { "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "" }, + { "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "" } //} - { NULL, 0, false, NULL, "" } }; static std::vector<ChatCommand> npcCommandTable = { @@ -120,16 +116,14 @@ public: { "whisper", SEC_GAMEMASTER, false, &HandleNpcWhisperCommand, "" }, { "yell", SEC_GAMEMASTER, false, &HandleNpcYellCommand, "" }, { "tame", SEC_GAMEMASTER, false, &HandleNpcTameCommand, "" }, - { "add", SEC_GAMEMASTER, false, NULL, "", npcAddCommandTable }, - { "delete", SEC_GAMEMASTER, false, NULL, "", npcDeleteCommandTable }, - { "follow", SEC_GAMEMASTER, false, NULL, "", npcFollowCommandTable }, - { "set", SEC_GAMEMASTER, false, NULL, "", npcSetCommandTable }, - { NULL, 0, false, NULL, "" } + { "add", SEC_GAMEMASTER, false, nullptr, "", npcAddCommandTable }, + { "delete", SEC_GAMEMASTER, false, nullptr, "", npcDeleteCommandTable }, + { "follow", SEC_GAMEMASTER, false, nullptr, "", npcFollowCommandTable }, + { "set", SEC_GAMEMASTER, false, nullptr, "", npcSetCommandTable } }; static std::vector<ChatCommand> commandTable = { - { "npc", SEC_GAMEMASTER, false, NULL, "", npcCommandTable }, - { NULL, 0, false, NULL, "" } + { "npc", SEC_GAMEMASTER, false, nullptr, "", npcCommandTable } }; return commandTable; } @@ -144,7 +138,7 @@ public: if (!charID) return false; - char* team = strtok(NULL, " "); + char* team = strtok(nullptr, " "); int32 teamval = 0; if (team) teamval = atoi(team); @@ -229,17 +223,17 @@ public: uint32 itemId = item_int; - char* fmaxcount = strtok(NULL, " "); //add maxcount, default: 0 + char* fmaxcount = strtok(nullptr, " "); //add maxcount, default: 0 uint32 maxcount = 0; if (fmaxcount) maxcount = atol(fmaxcount); - char* fincrtime = strtok(NULL, " "); //add incrtime, default: 0 + char* fincrtime = strtok(nullptr, " "); //add incrtime, default: 0 uint32 incrtime = 0; if (fincrtime) incrtime = atol(fincrtime); - char* fextendedcost = strtok(NULL, " "); //add ExtendedCost, default: 0 + char* fextendedcost = strtok(nullptr, " "); //add ExtendedCost, default: 0 uint32 extendedcost = fextendedcost ? atol(fextendedcost) : 0; Creature* vendor = handler->getSelectedCreature(); if (!vendor) @@ -272,11 +266,11 @@ public: return false; char* guidStr = strtok((char*)args, " "); - char* waitStr = strtok((char*)NULL, " "); + char* waitStr = strtok((char*)nullptr, " "); uint32 lowGuid = atoi((char*)guidStr); - Creature* creature = NULL; + Creature* creature = nullptr; /* FIXME: impossible without entry if (lowguid) @@ -413,7 +407,7 @@ public: static bool HandleNpcDeleteCommand(ChatHandler* handler, const char* args) { - Creature* unit = NULL; + Creature* unit = nullptr; if (*args) { @@ -568,7 +562,7 @@ public: return false; char* arg1 = strtok((char*)args, " "); - char* arg2 = strtok((char*)NULL, ""); + char* arg2 = strtok((char*)nullptr, ""); if (!arg1 || !arg2) return false; @@ -632,7 +626,7 @@ public: uint32 Entry = target->GetEntry(); CreatureTemplate const* cInfo = target->GetCreatureTemplate(); - int64 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL); + int64 curRespawnDelay = target->GetRespawnTimeEx()-time(nullptr); if (curRespawnDelay < 0) curRespawnDelay = 0; std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), true); @@ -860,8 +854,8 @@ public: // later switched on/off according to special events (like escort // quests, etc) char* guid_str = strtok((char*)args, " "); - char* type_str = strtok((char*)NULL, " "); - char* dontdel_str = strtok((char*)NULL, " "); + char* type_str = strtok((char*)nullptr, " "); + char* dontdel_str = strtok((char*)nullptr, " "); bool doNotDelete = false; @@ -869,7 +863,7 @@ public: return false; uint32 lowguid = 0; - Creature* creature = NULL; + Creature* creature = nullptr; if (dontdel_str) { @@ -895,7 +889,7 @@ public: { //sLog->outError("DEBUG: type_str, NODEL "); doNotDelete = true; - type_str = NULL; + type_str = nullptr; } } } @@ -935,7 +929,7 @@ public: } // now lowguid is low guid really existed creature - // and creature point (maybe) to this creature or NULL + // and creature point (maybe) to this creature or nullptr MovementGeneratorType move_type; @@ -1112,7 +1106,7 @@ public: return false; } - creature->MonsterSay(args, LANG_UNIVERSAL, NULL); + creature->MonsterSay(args, LANG_UNIVERSAL, nullptr); // make some emotes char lastchar = args[strlen(args) - 1]; @@ -1190,7 +1184,7 @@ public: return false; char* receiver_str = strtok((char*)args, " "); - char* text = strtok(NULL, ""); + char* text = strtok(nullptr, ""); Creature* creature = handler->getSelectedCreature(); if (!creature || !receiver_str || !text) @@ -1220,7 +1214,7 @@ public: return false; } - creature->MonsterYell(args, LANG_UNIVERSAL, NULL); + creature->MonsterYell(args, LANG_UNIVERSAL, nullptr); // make an emote creature->HandleEmoteCommand(EMOTE_ONESHOT_SHOUT); @@ -1427,7 +1421,7 @@ public: if (!pSlotID) return false; - char* pItemID = strtok(NULL, " "); + char* pItemID = strtok(nullptr, " "); if (!pItemID) return false; diff --git a/src/scripts/Commands/cs_quest.cpp b/src/scripts/Commands/cs_quest.cpp index 84822a2b57..c8e7d51d63 100644 --- a/src/scripts/Commands/cs_quest.cpp +++ b/src/scripts/Commands/cs_quest.cpp @@ -30,12 +30,12 @@ public: { "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "" }, { "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "" }, { "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "" }, - { NULL, SEC_PLAYER, false, NULL, "" } + { nullptr, SEC_PLAYER, false, nullptr, "" } }; static std::vector<ChatCommand> commandTable = { - { "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable }, - { NULL, SEC_PLAYER, false, NULL, "" } + { "quest", SEC_ADMINISTRATOR, false, nullptr, "", questCommandTable }, + { nullptr, SEC_PLAYER, false, nullptr, "" } }; return commandTable; } @@ -80,7 +80,7 @@ public: // ok, normal (creature/GO starting) quest if (player->CanAddQuest(quest, true)) - player->AddQuestAndCheckCompletion(quest, NULL); + player->AddQuestAndCheckCompletion(quest, nullptr); return true; } diff --git a/src/scripts/Commands/cs_reload.cpp b/src/scripts/Commands/cs_reload.cpp index feaeefae6e..6c40601510 100644 --- a/src/scripts/Commands/cs_reload.cpp +++ b/src/scripts/Commands/cs_reload.cpp @@ -48,8 +48,7 @@ public: { "quest", SEC_ADMINISTRATOR, true, &HandleReloadAllQuestCommand, "" }, { "scripts", SEC_ADMINISTRATOR, true, &HandleReloadAllScriptsCommand, "" }, { "spell", SEC_ADMINISTRATOR, true, &HandleReloadAllSpellCommand, "" }, - { "", SEC_ADMINISTRATOR, true, &HandleReloadAllCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_ADMINISTRATOR, true, &HandleReloadAllCommand, "" } }; static std::vector<ChatCommand> reloadCommandTable = { @@ -57,7 +56,7 @@ public: { "access_requirement", SEC_ADMINISTRATOR, true, &HandleReloadAccessRequirementCommand, "" }, { "achievement_criteria_data", SEC_ADMINISTRATOR, true, &HandleReloadAchievementCriteriaDataCommand, "" }, { "achievement_reward", SEC_ADMINISTRATOR, true, &HandleReloadAchievementRewardCommand, "" }, - { "all", SEC_ADMINISTRATOR, true, NULL, "", reloadAllCommandTable }, + { "all", SEC_ADMINISTRATOR, true, nullptr, "", reloadAllCommandTable }, { "areatrigger_involvedrelation", SEC_ADMINISTRATOR, true, &HandleReloadQuestAreaTriggersCommand, "" }, { "areatrigger_tavern", SEC_ADMINISTRATOR, true, &HandleReloadAreaTriggerTavernCommand, "" }, { "areatrigger_teleport", SEC_ADMINISTRATOR, true, &HandleReloadAreaTriggerTeleportCommand, "" }, @@ -139,13 +138,11 @@ public: { "waypoint_scripts", SEC_ADMINISTRATOR, true, &HandleReloadWpScriptsCommand, "" }, { "waypoint_data", SEC_ADMINISTRATOR, true, &HandleReloadWpCommand, "" }, { "vehicle_accessory", SEC_ADMINISTRATOR, true, &HandleReloadVehicleAccessoryCommand, "" }, - { "vehicle_template_accessory", SEC_ADMINISTRATOR, true, &HandleReloadVehicleTemplateAccessoryCommand, "" }, - { NULL, 0, false, NULL, "" } + { "vehicle_template_accessory", SEC_ADMINISTRATOR, true, &HandleReloadVehicleTemplateAccessoryCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "reload", SEC_ADMINISTRATOR, true, NULL, "", reloadCommandTable }, - { NULL, 0, false, NULL, "" } + { "reload", SEC_ADMINISTRATOR, true, nullptr, "", reloadCommandTable } }; return commandTable; } diff --git a/src/scripts/Commands/cs_reset.cpp b/src/scripts/Commands/cs_reset.cpp index dab643fd95..d05ace9dd3 100644 --- a/src/scripts/Commands/cs_reset.cpp +++ b/src/scripts/Commands/cs_reset.cpp @@ -34,13 +34,11 @@ public: { "spells", SEC_ADMINISTRATOR, true, &HandleResetSpellsCommand, "" }, { "stats", SEC_ADMINISTRATOR, true, &HandleResetStatsCommand, "" }, { "talents", SEC_ADMINISTRATOR, true, &HandleResetTalentsCommand, "" }, - { "all", SEC_ADMINISTRATOR, true, &HandleResetAllCommand, "" }, - { NULL, 0, false, NULL, "" } + { "all", SEC_ADMINISTRATOR, true, &HandleResetAllCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, - { NULL, 0, false, NULL, "" } + { "reset", SEC_ADMINISTRATOR, true, nullptr, "", resetCommandTable } }; return commandTable; } diff --git a/src/scripts/Commands/cs_server.cpp b/src/scripts/Commands/cs_server.cpp index 3501c6c2b2..dac175f171 100644 --- a/src/scripts/Commands/cs_server.cpp +++ b/src/scripts/Commands/cs_server.cpp @@ -30,29 +30,25 @@ public: static std::vector<ChatCommand> serverIdleRestartCommandTable = { { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" }, - { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleRestartCommand, "" }, - { NULL, 0, false, NULL, "" } + { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleRestartCommand, "" } }; static std::vector<ChatCommand> serverIdleShutdownCommandTable = { { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" }, - { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleShutDownCommand, "" }, - { NULL, 0, false, NULL, "" } + { "" , SEC_ADMINISTRATOR, true, &HandleServerIdleShutDownCommand, "" } }; static std::vector<ChatCommand> serverRestartCommandTable = { { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" }, - { "" , SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "" }, - { NULL, 0, false, NULL, "" } + { "" , SEC_ADMINISTRATOR, true, &HandleServerRestartCommand, "" } }; static std::vector<ChatCommand> serverShutdownCommandTable = { { "cancel", SEC_ADMINISTRATOR, true, &HandleServerShutDownCancelCommand, "" }, - { "" , SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "" }, - { NULL, 0, false, NULL, "" } + { "" , SEC_ADMINISTRATOR, true, &HandleServerShutDownCommand, "" } }; static std::vector<ChatCommand> serverSetCommandTable = @@ -61,29 +57,26 @@ public: { "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "" }, { "logfilelevel", SEC_CONSOLE, true, &HandleServerSetLogFileLevelCommand, "" }, { "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "" }, - { "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "" }, - { NULL, 0, false, NULL, "" } + { "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "" } }; static std::vector<ChatCommand> serverCommandTable = { { "corpses", SEC_GAMEMASTER, true, &HandleServerCorpsesCommand, "" }, { "exit", SEC_CONSOLE, true, &HandleServerExitCommand, "" }, - { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, - { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable }, + { "idlerestart", SEC_ADMINISTRATOR, true, nullptr, "", serverIdleRestartCommandTable }, + { "idleshutdown", SEC_ADMINISTRATOR, true, nullptr, "", serverIdleShutdownCommandTable }, { "info", SEC_PLAYER, true, &HandleServerInfoCommand, "" }, { "motd", SEC_PLAYER, true, &HandleServerMotdCommand, "" }, - { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, - { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, - { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, - { "togglequerylog", SEC_CONSOLE, true, &HandleServerToggleQueryLogging, "" }, - { NULL, 0, false, NULL, "" } + { "restart", SEC_ADMINISTRATOR, true, nullptr, "", serverRestartCommandTable }, + { "shutdown", SEC_ADMINISTRATOR, true, nullptr, "", serverShutdownCommandTable }, + { "set", SEC_ADMINISTRATOR, true, nullptr, "", serverSetCommandTable }, + { "togglequerylog", SEC_CONSOLE, true, &HandleServerToggleQueryLogging, "" } }; static std::vector<ChatCommand> commandTable = { - { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, - { NULL, 0, false, NULL, "" } + { "server", SEC_ADMINISTRATOR, true, nullptr, "", serverCommandTable } }; return commandTable; } @@ -146,7 +139,7 @@ public: return false; char* timeStr = strtok((char*) args, " "); - char* exitCodeStr = strtok(NULL, ""); + char* exitCodeStr = strtok(nullptr, ""); int32 time = atoi(timeStr); @@ -182,7 +175,7 @@ public: return false; char* timeStr = strtok((char*) args, " "); - char* exitCodeStr = strtok(NULL, ""); + char* exitCodeStr = strtok(nullptr, ""); int32 time = atoi(timeStr); @@ -218,7 +211,7 @@ public: return false; char* timeStr = strtok((char*) args, " "); - char* exitCodeStr = strtok(NULL, ""); + char* exitCodeStr = strtok(nullptr, ""); int32 time = atoi(timeStr); @@ -253,7 +246,7 @@ public: return false; char* timeStr = strtok((char*) args, " "); - char* exitCodeStr = strtok(NULL, ""); + char* exitCodeStr = strtok(nullptr, ""); int32 time = atoi(timeStr); diff --git a/src/scripts/Commands/cs_spectator.cpp b/src/scripts/Commands/cs_spectator.cpp index 0073cc2f1b..e65e5cee50 100644 --- a/src/scripts/Commands/cs_spectator.cpp +++ b/src/scripts/Commands/cs_spectator.cpp @@ -25,13 +25,11 @@ public: { "spectate", SEC_CONSOLE, false, &ArenaSpectator::HandleSpectatorSpectateCommand, "" }, { "watch", SEC_CONSOLE, false, &ArenaSpectator::HandleSpectatorWatchCommand, "" }, { "leave", SEC_CONSOLE, false, &HandleSpectatorLeaveCommand, "" }, - { "", SEC_CONSOLE, false, &HandleSpectatorCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_CONSOLE, false, &HandleSpectatorCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "spect", SEC_CONSOLE, false, NULL, "", spectatorCommandTable }, - { NULL, 0, false, NULL, "" } + { "spect", SEC_CONSOLE, false, nullptr, "", spectatorCommandTable } }; return commandTable; } diff --git a/src/scripts/Commands/cs_tele.cpp b/src/scripts/Commands/cs_tele.cpp index 05bb351c06..0dd3d9ab3a 100644 --- a/src/scripts/Commands/cs_tele.cpp +++ b/src/scripts/Commands/cs_tele.cpp @@ -32,13 +32,11 @@ public: { "del", SEC_ADMINISTRATOR, true, &HandleTeleDelCommand, "" }, { "name", SEC_GAMEMASTER, true, &HandleTeleNameCommand, "" }, { "group", SEC_GAMEMASTER, false, &HandleTeleGroupCommand, "" }, - { "", SEC_GAMEMASTER, false, &HandleTeleCommand, "" }, - { NULL, 0, false, NULL, "" } + { "", SEC_GAMEMASTER, false, &HandleTeleCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "tele", SEC_GAMEMASTER, false, NULL, "", teleCommandTable }, - { NULL, 0, false, NULL, "" } + { "tele", SEC_GAMEMASTER, false, nullptr, "", teleCommandTable } }; return commandTable; } @@ -187,7 +185,7 @@ public: else { // check offline security - if (handler->HasLowerSecurity(NULL, target_guid)) + if (handler->HasLowerSecurity(nullptr, target_guid)) return false; std::string nameLink = handler->playerLink(target_name); @@ -245,7 +243,7 @@ public: return false; } - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next()) { Player* player = itr->GetSource(); diff --git a/src/scripts/Commands/cs_ticket.cpp b/src/scripts/Commands/cs_ticket.cpp index a92f0d6549..5382bcebef 100644 --- a/src/scripts/Commands/cs_ticket.cpp +++ b/src/scripts/Commands/cs_ticket.cpp @@ -30,8 +30,7 @@ public: static std::vector<ChatCommand> ticketResponseCommandTable = { { "append", SEC_GAMEMASTER, true, &HandleGMTicketResponseAppendCommand, "" }, - { "appendln", SEC_GAMEMASTER, true, &HandleGMTicketResponseAppendLnCommand, "" }, - { NULL, 0, false, NULL, "" } + { "appendln", SEC_GAMEMASTER, true, &HandleGMTicketResponseAppendLnCommand, "" } }; static std::vector<ChatCommand> ticketCommandTable = { @@ -46,17 +45,15 @@ public: { "list", SEC_GAMEMASTER, true, &HandleGMTicketListCommand, "" }, { "onlinelist", SEC_GAMEMASTER, true, &HandleGMTicketListOnlineCommand, "" }, { "reset", SEC_ADMINISTRATOR, true, &HandleGMTicketResetCommand, "" }, - { "response", SEC_GAMEMASTER, true, NULL, "", ticketResponseCommandTable }, + { "response", SEC_GAMEMASTER, true, nullptr, "", ticketResponseCommandTable }, { "togglesystem", SEC_ADMINISTRATOR, true, &HandleToggleGMTicketSystem, "" }, { "unassign", SEC_GAMEMASTER, true, &HandleGMTicketUnAssignCommand, "" }, { "viewid", SEC_GAMEMASTER, true, &HandleGMTicketGetByIdCommand, "" }, - { "viewname", SEC_GAMEMASTER, true, &HandleGMTicketGetByNameCommand, "" }, - { NULL, 0, false, NULL, "" } + { "viewname", SEC_GAMEMASTER, true, &HandleGMTicketGetByNameCommand, "" } }; static std::vector<ChatCommand> commandTable = { - { "ticket", SEC_GAMEMASTER, false, NULL, "", ticketCommandTable }, - { NULL, 0, false, NULL, "" } + { "ticket", SEC_GAMEMASTER, false, nullptr, "", ticketCommandTable } }; return commandTable; } @@ -69,7 +66,7 @@ public: char* ticketIdStr = strtok((char*)args, " "); uint32 ticketId = atoi(ticketIdStr); - char* targetStr = strtok(NULL, " "); + char* targetStr = strtok(nullptr, " "); if (!targetStr) return false; @@ -105,7 +102,7 @@ public: // If assigned to different player other than current, leave //! Console can override though - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str()); @@ -113,12 +110,12 @@ public: } // Assign ticket - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel)); ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*handler, NULL, target.c_str(), NULL, NULL); + std::string msg = ticket->FormatMessageString(*handler, nullptr, target.c_str(), nullptr, nullptr); handler->SendGlobalGMSysMessage(msg.c_str()); return true; } @@ -138,7 +135,7 @@ public: // Ticket should be assigned to the player who tries to close it. // Console can override though - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId()); @@ -148,7 +145,7 @@ public: sTicketMgr->ResolveAndCloseTicket(ticket->GetId(), player ? player->GetGUID() : -1); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL); + std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", nullptr, nullptr, nullptr); handler->SendGlobalGMSysMessage(msg.c_str()); // Inform player, who submitted this ticket, that it is closed @@ -170,7 +167,7 @@ public: char* ticketIdStr = strtok((char*)args, " "); uint32 ticketId = atoi(ticketIdStr); - char* comment = strtok(NULL, "\n"); + char* comment = strtok(nullptr, "\n"); if (!comment) return false; @@ -183,19 +180,19 @@ public: // Cannot comment ticket assigned to someone else //! Console excluded - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); return true; } - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SetComment(comment); ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL); + std::string msg = ticket->FormatMessageString(*handler, nullptr, ticket->GetAssignedToName().c_str(), nullptr, nullptr); msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName().c_str() : "Console", comment); handler->SendGlobalGMSysMessage(msg.c_str()); @@ -224,7 +221,7 @@ public: } // Check if handler is not assignee in which case return - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { @@ -232,7 +229,7 @@ public: return true; } - char* response = strtok(NULL, "\n"); + char* response = strtok(nullptr, "\n"); if (response) ticket->AppendResponse(response); @@ -242,14 +239,14 @@ public: ChatHandler(player->GetSession()).SendSysMessage(LANG_TICKET_COMPLETED); } - Player* gm = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* gm = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SetCompleted(); ticket->SetResolvedBy(gm ? gm->GetGUID() : -1); ticket->SaveToDB(trans); - std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, NULL); + std::string msg = ticket->FormatMessageString(*handler, nullptr, nullptr, nullptr, nullptr); msg += handler->PGetParseString(LANG_COMMAND_TICKETCOMPLETED, gm ? gm->GetName().c_str() : "Console"); handler->SendGlobalGMSysMessage(msg.c_str()); sTicketMgr->UpdateLastChange(); @@ -275,7 +272,7 @@ public: return true; } - std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console"); + std::string msg = ticket->FormatMessageString(*handler, nullptr, nullptr, nullptr, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console"); handler->SendGlobalGMSysMessage(msg.c_str()); sTicketMgr->RemoveTicket(ticket->GetId()); @@ -397,13 +394,13 @@ public: } std::string assignedTo = ticket->GetAssignedToName(); // copy assignedto name because we need it after the ticket has been unnassigned - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SetUnassigned(); ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*handler, NULL, assignedTo.c_str(), - handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL); + std::string msg = ticket->FormatMessageString(*handler, nullptr, assignedTo.c_str(), + handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", nullptr); handler->SendGlobalGMSysMessage(msg.c_str()); return true; @@ -422,7 +419,7 @@ public: return true; } - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SetViewed(); ticket->SaveToDB(trans); @@ -461,7 +458,7 @@ public: return true; } - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->SetViewed(); ticket->SaveToDB(trans); @@ -477,7 +474,7 @@ public: char* ticketIdStr = strtok((char*)args, " "); uint32 ticketId = atoi(ticketIdStr); - char* response = strtok(NULL, "\n"); + char* response = strtok(nullptr, "\n"); if (!response) return false; @@ -490,14 +487,14 @@ public: // Cannot add response to ticket, assigned to someone else //! Console excluded - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); return true; } - SQLTransaction trans = SQLTransaction(NULL); + SQLTransaction trans = SQLTransaction(nullptr); ticket->AppendResponse(response); if (newLine) ticket->AppendResponse("\n"); diff --git a/src/scripts/Commands/cs_titles.cpp b/src/scripts/Commands/cs_titles.cpp index 89ebe8c571..d5ef8d67c4 100644 --- a/src/scripts/Commands/cs_titles.cpp +++ b/src/scripts/Commands/cs_titles.cpp @@ -26,21 +26,18 @@ public: { static std::vector<ChatCommand> titlesSetCommandTable = { - { "mask", SEC_GAMEMASTER, false, &HandleTitlesSetMaskCommand, "" }, - { NULL, 0, false, NULL, "" } + { "mask", SEC_GAMEMASTER, false, &HandleTitlesSetMaskCommand, "" } }; static std::vector<ChatCommand> titlesCommandTable = { { "add", SEC_GAMEMASTER, false, &HandleTitlesAddCommand, "" }, { "current", SEC_GAMEMASTER, false, &HandleTitlesCurrentCommand, "" }, { "remove", SEC_GAMEMASTER, false, &HandleTitlesRemoveCommand, "" }, - { "set", SEC_GAMEMASTER, false, NULL, "", titlesSetCommandTable }, - { NULL, 0, false, NULL, "" } + { "set", SEC_GAMEMASTER, false, nullptr, "", titlesSetCommandTable } }; static std::vector<ChatCommand> commandTable = { - { "titles", SEC_GAMEMASTER, false, NULL, "", titlesCommandTable }, - { NULL, 0, false, NULL, "" } + { "titles", SEC_GAMEMASTER, false, nullptr, "", titlesCommandTable } }; return commandTable; } 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(); |