diff options
author | Yehonal <yehonal.azeroth@gmail.com> | 2016-08-20 09:49:37 +0200 |
---|---|---|
committer | Yehonal <yehonal.azeroth@gmail.com> | 2016-08-20 09:49:37 +0200 |
commit | 1b1767e9f4c20d1e20541968de98d00814f63247 (patch) | |
tree | ee95040cf29644aff151f9aebdf3bfd9e18ae08d /src/scripts/Commands/cs_account.cpp | |
parent | d7fdf7c940317aebcbbeeaf156469e1571e01498 (diff) |
Fix commands and starting to use nullptr instead of NULL
Diffstat (limited to 'src/scripts/Commands/cs_account.cpp')
-rw-r--r-- | src/scripts/Commands/cs_account.cpp | 35 |
1 files changed, 16 insertions, 19 deletions
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)) |