mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
NULL to nullptr
This commit is contained in:
+9
-9
@@ -85,7 +85,7 @@ ChatChannel* ChatChannelList::FindChannel(string Name) {
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ChatChannelList::SendAllChannels(Client *c) {
|
||||
@@ -452,13 +452,13 @@ bool ChatChannel::IsClientInChannel(Client *c) {
|
||||
|
||||
ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c) {
|
||||
|
||||
if(!c) return NULL;
|
||||
if(!c) return nullptr;
|
||||
|
||||
if((ChannelName.length() > 0) && (isdigit(ChannelName[0]))) {
|
||||
|
||||
c->GeneralChannelMessage("The channel name can not begin with a number.");
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
string NormalisedName, Password;
|
||||
@@ -477,7 +477,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c)
|
||||
|
||||
c->GeneralChannelMessage("The channel name or password cannot exceed 64 characters.");
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
_log(UCS__TRACE, "AddClient to channel [%s] with password [%s]", NormalisedName.c_str(), Password.c_str());
|
||||
@@ -493,11 +493,11 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c)
|
||||
|
||||
c->GeneralChannelMessage(Message);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(RequiredChannel->IsClientInChannel(c))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if(RequiredChannel->IsInvitee(c->GetName())) {
|
||||
|
||||
@@ -518,12 +518,12 @@ ChatChannel *ChatChannelList::AddClientToChannel(string ChannelName, Client *c)
|
||||
|
||||
c->GeneralChannelMessage("Incorrect password for channel " + (NormalisedName));
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ChatChannel *ChatChannelList::RemoveClientFromChannel(string inChannelName, Client *c) {
|
||||
|
||||
if(!c) return NULL;
|
||||
if(!c) return nullptr;
|
||||
|
||||
string ChannelName = inChannelName;
|
||||
|
||||
@@ -533,7 +533,7 @@ ChatChannel *ChatChannelList::RemoveClientFromChannel(string inChannelName, Clie
|
||||
ChatChannel *RequiredChannel = FindChannel(ChannelName);
|
||||
|
||||
if(!RequiredChannel)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// RemoveClient will return false if there is no-one left in the channel, and the channel is not permanent and has
|
||||
// no password.
|
||||
|
||||
+16
-16
@@ -69,7 +69,7 @@ void Client::SendUptime() {
|
||||
ms -= m * 60000;
|
||||
uint32 s = ms / 1000;
|
||||
|
||||
char *Buffer = NULL;
|
||||
char *Buffer = nullptr;
|
||||
|
||||
MakeAnyLenString(&Buffer, "UCS has been up for %02id %02ih %02im %02is", d, h, m, s);
|
||||
GeneralChannelMessage(Buffer);
|
||||
@@ -510,7 +510,7 @@ Client::Client(EQStream *eqs) {
|
||||
Revoked = false;
|
||||
|
||||
for(int i = 0; i < MAX_JOINED_CHANNELS ; i++)
|
||||
JoinedChannels[i] = NULL;
|
||||
JoinedChannels[i] = nullptr;
|
||||
|
||||
TotalKarma = 0;
|
||||
AttemptedMessages = 0;
|
||||
@@ -533,13 +533,13 @@ Client::~Client() {
|
||||
if(AccountGrabUpdateTimer)
|
||||
{
|
||||
delete AccountGrabUpdateTimer;
|
||||
AccountGrabUpdateTimer = NULL;
|
||||
AccountGrabUpdateTimer = nullptr;
|
||||
}
|
||||
|
||||
if(GlobalChatLimiterTimer)
|
||||
{
|
||||
delete GlobalChatLimiterTimer;
|
||||
GlobalChatLimiterTimer = NULL;
|
||||
GlobalChatLimiterTimer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -964,7 +964,7 @@ Client *Clientlist::FindCharacter(string CharacterName) {
|
||||
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Client::AddToChannelList(ChatChannel *JoinedChannel) {
|
||||
@@ -972,7 +972,7 @@ void Client::AddToChannelList(ChatChannel *JoinedChannel) {
|
||||
if(!JoinedChannel) return;
|
||||
|
||||
for(int i = 0; i < MAX_JOINED_CHANNELS; i++)
|
||||
if(JoinedChannels[i] == NULL) {
|
||||
if(JoinedChannels[i] == nullptr) {
|
||||
JoinedChannels[i] = JoinedChannel;
|
||||
_log(UCS__TRACE, "Added Channel %s to slot %i for %s", JoinedChannel->GetName().c_str(), i + 1, GetName().c_str());
|
||||
return;
|
||||
@@ -989,7 +989,7 @@ void Client::RemoveFromChannelList(ChatChannel *JoinedChannel) {
|
||||
for(int j = i; j < (MAX_JOINED_CHANNELS - 1); j++)
|
||||
JoinedChannels[j] = JoinedChannels[j + 1];
|
||||
|
||||
JoinedChannels[MAX_JOINED_CHANNELS - 1] = NULL;
|
||||
JoinedChannels[MAX_JOINED_CHANNELS - 1] = nullptr;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1066,7 +1066,7 @@ void Client::JoinChannels(string ChannelNameList) {
|
||||
|
||||
for(int i = 0; i < MAX_JOINED_CHANNELS ; i++) {
|
||||
|
||||
if(JoinedChannels[i] != NULL) {
|
||||
if(JoinedChannels[i] != nullptr) {
|
||||
|
||||
if(ChannelCount) {
|
||||
|
||||
@@ -1155,7 +1155,7 @@ void Client::LeaveChannels(string ChannelNameList) {
|
||||
|
||||
for(int i = 0; i < MAX_JOINED_CHANNELS ; i++) {
|
||||
|
||||
if(JoinedChannels[i] != NULL) {
|
||||
if(JoinedChannels[i] != nullptr) {
|
||||
|
||||
if(ChannelCount) {
|
||||
|
||||
@@ -1213,7 +1213,7 @@ void Client::LeaveAllChannels(bool SendUpdatedChannelList) {
|
||||
|
||||
ChannelList->RemoveClientFromChannel(JoinedChannels[i]->GetName(), this);
|
||||
|
||||
JoinedChannels[i] = NULL;
|
||||
JoinedChannels[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1258,7 +1258,7 @@ void Client::SendChannelList() {
|
||||
|
||||
for(int i = 0; i < MAX_JOINED_CHANNELS ; i++) {
|
||||
|
||||
if(JoinedChannels[i] != NULL) {
|
||||
if(JoinedChannels[i] != nullptr) {
|
||||
|
||||
if(ChannelCount)
|
||||
ChannelMessage = ChannelMessage + ",";
|
||||
@@ -1313,7 +1313,7 @@ void Client::SendChannelMessage(string Message)
|
||||
{
|
||||
if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit))
|
||||
{
|
||||
CharacterEntry *char_ent = NULL;
|
||||
CharacterEntry *char_ent = nullptr;
|
||||
for(int x = 0; x < Characters.size(); ++x)
|
||||
{
|
||||
if(Characters[x].Name.compare(GetName()) == 0)
|
||||
@@ -1426,7 +1426,7 @@ void Client::SendChannelMessageByNumber(string Message) {
|
||||
{
|
||||
if(GetKarma() < RuleI(Chat, KarmaGlobalChatLimit))
|
||||
{
|
||||
CharacterEntry *char_ent = NULL;
|
||||
CharacterEntry *char_ent = nullptr;
|
||||
for(int x = 0; x < Characters.size(); ++x)
|
||||
{
|
||||
if(Characters[x].Name.compare(GetName()) == 0)
|
||||
@@ -2171,7 +2171,7 @@ string Client::ChannelSlotName(int SlotNumber) {
|
||||
if((SlotNumber < 1 ) || (SlotNumber > MAX_JOINED_CHANNELS))
|
||||
return "";
|
||||
|
||||
if(JoinedChannels[SlotNumber - 1] == NULL)
|
||||
if(JoinedChannels[SlotNumber - 1] == nullptr)
|
||||
return "";
|
||||
|
||||
return JoinedChannels[SlotNumber - 1]->GetName();
|
||||
@@ -2261,7 +2261,7 @@ Client *Clientlist::IsCharacterOnline(string CharacterName) {
|
||||
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int Client::GetMailBoxNumber(string CharacterName) {
|
||||
@@ -2281,7 +2281,7 @@ void Client::SendNotification(int MailBoxNumber, string Subject, string From, in
|
||||
|
||||
char Sequence[100];
|
||||
|
||||
sprintf(TimeStamp, "%i", (int)time(NULL));
|
||||
sprintf(TimeStamp, "%i", (int)time(nullptr));
|
||||
|
||||
sprintf(sMessageID, "%i", MessageID);
|
||||
|
||||
|
||||
+4
-4
@@ -583,7 +583,7 @@ bool Database::SendMail(string Recipient, string From, string Subject, string Bo
|
||||
|
||||
uint32 LastMsgID;
|
||||
|
||||
int Now = time(NULL); // time returns a 64 bit int on Windows at least, which vsnprintf doesn't like.
|
||||
int Now = time(nullptr); // time returns a 64 bit int on Windows at least, which vsnprintf doesn't like.
|
||||
|
||||
if(!RunQuery(query, MakeAnyLenString(&query, MailQuery, CharacterID, Now, From.c_str(), EscSubject, EscBody,
|
||||
RecipientsString.c_str(), 1), errbuf, 0, 0, &LastMsgID)) {
|
||||
@@ -661,7 +661,7 @@ void Database::ExpireMail() {
|
||||
// Expire Trash
|
||||
if(RuleI(Mail, ExpireTrash) >= 0) {
|
||||
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=4 and `timestamp` < %i",
|
||||
time(NULL) - RuleI(Mail, ExpireTrash)), errbuf, 0, &AffectedRows)) {
|
||||
time(nullptr) - RuleI(Mail, ExpireTrash)), errbuf, 0, &AffectedRows)) {
|
||||
_log(UCS__INIT, "Expired %i trash messages.", AffectedRows);
|
||||
}
|
||||
else {
|
||||
@@ -672,7 +672,7 @@ void Database::ExpireMail() {
|
||||
// Expire Read
|
||||
if(RuleI(Mail, ExpireRead) >= 0) {
|
||||
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=3 and `timestamp` < %i",
|
||||
time(NULL) - RuleI(Mail, ExpireRead)), errbuf, 0, &AffectedRows)) {
|
||||
time(nullptr) - RuleI(Mail, ExpireRead)), errbuf, 0, &AffectedRows)) {
|
||||
_log(UCS__INIT, "Expired %i read messages.", AffectedRows);
|
||||
}
|
||||
else {
|
||||
@@ -683,7 +683,7 @@ void Database::ExpireMail() {
|
||||
// Expire Unread
|
||||
if(RuleI(Mail, ExpireUnread) >= 0) {
|
||||
if(RunQuery(query, MakeAnyLenString(&query, "delete from `mail` where `status`=1 and `timestamp` < %i",
|
||||
time(NULL) - RuleI(Mail, ExpireUnread)), errbuf, 0, &AffectedRows)) {
|
||||
time(nullptr) - RuleI(Mail, ExpireUnread)), errbuf, 0, &AffectedRows)) {
|
||||
_log(UCS__INIT, "Expired %i unread messages.", AffectedRows);
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
using namespace std;
|
||||
|
||||
//atoi is not uint32 or uint32 safe!!!!
|
||||
#define atoul(str) strtoul(str, NULL, 10)
|
||||
#define atoul(str) strtoul(str, nullptr, 10)
|
||||
|
||||
class Database : public DBcore {
|
||||
public:
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
#include "../common/debug.h"
|
||||
#include "ucsconfig.h"
|
||||
|
||||
ucsconfig *ucsconfig::_chat_config = NULL;
|
||||
ucsconfig *ucsconfig::_chat_config = nullptr;
|
||||
|
||||
string ucsconfig::GetByName(const string &var_name) const {
|
||||
return(EQEmuConfig::GetByName(var_name));
|
||||
|
||||
+2
-2
@@ -36,14 +36,14 @@ public:
|
||||
|
||||
// Produce a const singleton
|
||||
static const ucsconfig *get() {
|
||||
if (_chat_config == NULL)
|
||||
if (_chat_config == nullptr)
|
||||
LoadConfig();
|
||||
return(_chat_config);
|
||||
}
|
||||
|
||||
// Load the config
|
||||
static bool LoadConfig() {
|
||||
if (_chat_config != NULL)
|
||||
if (_chat_config != nullptr)
|
||||
delete _chat_config;
|
||||
_chat_config=new ucsconfig;
|
||||
_config=_chat_config;
|
||||
|
||||
Reference in New Issue
Block a user