mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-31 00:15:55 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -37,7 +37,7 @@ int main(int argc, char ** argv)
|
||||
|
||||
SetupSharedFile::install(false);
|
||||
SetupSharedNetworkMessages::install();
|
||||
SetupSharedRandom::install(time(NULL));
|
||||
SetupSharedRandom::install(time(nullptr));
|
||||
|
||||
//setup the server
|
||||
NetworkHandler::install();
|
||||
|
||||
@@ -82,7 +82,7 @@ m_canCreateRegularCharacter(false),
|
||||
m_canCreateJediCharacter(false),
|
||||
m_hasRequestedCharacterCreate(false),
|
||||
m_hasCreatedCharacter(false),
|
||||
m_pendingCharacterCreate(NULL),
|
||||
m_pendingCharacterCreate(nullptr),
|
||||
m_canSkipTutorial(false),
|
||||
m_characterId(NetworkId::cms_invalid),
|
||||
m_characterName(),
|
||||
@@ -144,7 +144,7 @@ ClientConnection::~ClientConnection()
|
||||
{
|
||||
hasBeenKicked = m_client->hasBeenKicked();
|
||||
delete m_client;
|
||||
m_client = NULL;
|
||||
m_client = nullptr;
|
||||
}
|
||||
|
||||
// tell Session to stop recording play time for the character
|
||||
@@ -177,7 +177,7 @@ ClientConnection::~ClientConnection()
|
||||
m_pendingChatQueryRoomRequests.clear();
|
||||
|
||||
delete m_pendingCharacterCreate;
|
||||
m_pendingCharacterCreate = NULL;
|
||||
m_pendingCharacterCreate = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ std::string ClientConnection::getPlayTimeDuration() const
|
||||
int playTimeDuration = 0;
|
||||
|
||||
if (m_startPlayTime > 0)
|
||||
playTimeDuration = static_cast<int>(::time(NULL) - m_startPlayTime);
|
||||
playTimeDuration = static_cast<int>(::time(nullptr) - m_startPlayTime);
|
||||
|
||||
return CalendarTime::convertSecondsToHMS(static_cast<unsigned int>(playTimeDuration));
|
||||
}
|
||||
@@ -214,7 +214,7 @@ std::string ClientConnection::getActivePlayTimeDuration() const
|
||||
int activePlayTimeDuration = static_cast<int>(m_activePlayTimeDuration);
|
||||
|
||||
if (m_lastActiveTime > 0)
|
||||
activePlayTimeDuration += static_cast<int>(::time(NULL) - m_lastActiveTime);
|
||||
activePlayTimeDuration += static_cast<int>(::time(nullptr) - m_lastActiveTime);
|
||||
|
||||
return CalendarTime::convertSecondsToHMS(static_cast<unsigned int>(activePlayTimeDuration));
|
||||
}
|
||||
@@ -226,7 +226,7 @@ std::string ClientConnection::getCurrentActivePlayTimeDuration() const
|
||||
int activePlayTimeDuration = 0;
|
||||
|
||||
if (m_lastActiveTime > 0)
|
||||
activePlayTimeDuration = static_cast<int>(::time(NULL) - m_lastActiveTime);
|
||||
activePlayTimeDuration = static_cast<int>(::time(nullptr) - m_lastActiveTime);
|
||||
|
||||
return CalendarTime::convertSecondsToHMS(static_cast<unsigned int>(activePlayTimeDuration));
|
||||
}
|
||||
@@ -400,7 +400,7 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg)
|
||||
std::hash<std::string> h;
|
||||
m_suid = h(m_accountName.c_str());
|
||||
}
|
||||
onValidateClient(m_suid, m_accountName, m_isSecure, NULL, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints());
|
||||
onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -452,7 +452,7 @@ void ClientConnection::onIdValidated(bool canLogin, bool canCreateRegularCharact
|
||||
}
|
||||
|
||||
delete m_pendingCharacterCreate;
|
||||
m_pendingCharacterCreate = NULL;
|
||||
m_pendingCharacterCreate = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -683,7 +683,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message)
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectionServer::dropClient(this, "m_client is null while receiving a message!");
|
||||
ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!");
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
@@ -796,7 +796,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message)
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectionServer::dropClient(this, "m_client is null while receiving a message!");
|
||||
ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!");
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
@@ -839,7 +839,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message)
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectionServer::dropClient(this, "m_client is null while receiving a message!");
|
||||
ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!");
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
@@ -865,7 +865,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message)
|
||||
|
||||
//DEBUG_REPORT_LOG(true, ("CONSRV::CS - suid: %i\n", getSUID()));
|
||||
|
||||
if (customerServiceConnection != NULL)
|
||||
if (customerServiceConnection != nullptr)
|
||||
{
|
||||
static std::vector<NetworkId> v;
|
||||
v.clear();
|
||||
@@ -935,7 +935,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message)
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectionServer::dropClient(this, "m_client is null while receiving a message!");
|
||||
ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!");
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
@@ -951,7 +951,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message)
|
||||
if (m_lastActiveTime > 0)
|
||||
{
|
||||
// record the amount of active time
|
||||
m_activePlayTimeDuration += static_cast<unsigned long>(::time(NULL) - m_lastActiveTime);
|
||||
m_activePlayTimeDuration += static_cast<unsigned long>(::time(nullptr) - m_lastActiveTime);
|
||||
|
||||
// tell Session to stop recording play time for the character
|
||||
if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime())
|
||||
@@ -988,7 +988,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message)
|
||||
if (m_lastActiveTime == 0)
|
||||
{
|
||||
// record the time client went active
|
||||
m_lastActiveTime = ::time(NULL);
|
||||
m_lastActiveTime = ::time(nullptr);
|
||||
|
||||
// tell Session to start recording play time for the character
|
||||
if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime())
|
||||
@@ -1616,7 +1616,7 @@ void ClientConnection::onValidateClient (uint32 suid, const std::string & userna
|
||||
}
|
||||
|
||||
// tell client the server-side game and subscription feature bits and which ConnectionServer we are and the current server Epoch time
|
||||
GenericValueTypeMessage<std::pair<std::pair<unsigned long, unsigned long>, std::pair<int, int32> > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast<int32>(::time(NULL)))));
|
||||
GenericValueTypeMessage<std::pair<std::pair<unsigned long, unsigned long>, std::pair<int, int32> > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast<int32>(::time(nullptr)))));
|
||||
send(msgFeatureBits, true);
|
||||
|
||||
std::string const gameFeaturesDescription = ClientGameFeature::getDescription(gameFeatures);
|
||||
|
||||
@@ -163,7 +163,7 @@ const CustomerServiceConnection * ConnectionServer::getCustomerServiceConnection
|
||||
{
|
||||
return (*(instance().customerServiceServers.begin()));
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -366,7 +366,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi
|
||||
//send the game server a message about this client.
|
||||
static const std::string loginTrace("TRACE_LOGIN");
|
||||
LOG(loginTrace, ("NewClient(%d, %s, %s)", cconn->getSUID(), oid.getValueString().c_str(), cconn->getAccountName().c_str()));
|
||||
NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), NULL, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport );
|
||||
NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), nullptr, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport );
|
||||
gconn->send(m, true);
|
||||
//@todo move this to ClientConnection.cpp
|
||||
}
|
||||
@@ -375,7 +375,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi
|
||||
|
||||
void ConnectionServer::dropClient(ClientConnection * conn, const std::string& description)
|
||||
{
|
||||
DEBUG_FATAL(!conn, ("Cannot call dropClient with NULL connection"));
|
||||
DEBUG_FATAL(!conn, ("Cannot call dropClient with nullptr connection"));
|
||||
if (!conn) //lint !e774 // boolean within 'if' always evaluates to False //suppresed because this is only relevant in DEBUG builds
|
||||
return;
|
||||
|
||||
@@ -466,7 +466,7 @@ GameConnection* ConnectionServer::getGameConnection(const std::string &sceneName
|
||||
return (*i).second;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -477,15 +477,15 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId
|
||||
|
||||
const Service * const servicePrivate = getClientServicePrivate();
|
||||
const Service * const servicePublic = getClientServicePublic();
|
||||
FATAL(servicePrivate == NULL && servicePublic == NULL, ("No client service is active!"));
|
||||
FATAL(servicePrivate == nullptr && servicePublic == nullptr, ("No client service is active!"));
|
||||
|
||||
const Service * const g = getGameService();
|
||||
FATAL(g == NULL, ("No game service is active!"));
|
||||
FATAL(g == nullptr, ("No game service is active!"));
|
||||
const Service * const c = getChatService();
|
||||
const Service * const cs = getCustomerService();
|
||||
const uint16 pingPort = getPingPort ();
|
||||
|
||||
if((servicePrivate != NULL || servicePublic != NULL) && g != NULL) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning
|
||||
if((servicePrivate != nullptr || servicePublic != nullptr) && g != nullptr) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning
|
||||
{
|
||||
uint16 chatPort = 0;
|
||||
uint16 csPort = 0;
|
||||
@@ -739,7 +739,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c
|
||||
std::set<Client *>::const_iterator i;
|
||||
for(i = clients.begin(); i != clients.end(); ++ i)
|
||||
{
|
||||
(*i)->setChatConnection(NULL);
|
||||
(*i)->setChatConnection(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -782,7 +782,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c
|
||||
std::set<Client *>::const_iterator i;
|
||||
for(i = clients.begin(); i != clients.end(); ++ i)
|
||||
{
|
||||
(*i)->setCustomerServiceConnection(NULL);
|
||||
(*i)->setCustomerServiceConnection(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -960,7 +960,7 @@ void ConnectionServer::remove()
|
||||
|
||||
// explicitly delete all connections that were setup from setupConnections rather than letting
|
||||
// Connection::remove do it. There are connections that require a valid s_connectionServer which is deleted
|
||||
// and set to NULL.
|
||||
// and set to nullptr.
|
||||
s_connectionServer->unsetupConnections();
|
||||
|
||||
SetupSharedLog::remove();
|
||||
@@ -1316,7 +1316,7 @@ GameConnection* ConnectionServer::getGameConnection(uint32 gameServerId)
|
||||
if (i != cs.gameServerMap.end())
|
||||
return (*i).second;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -1327,7 +1327,7 @@ GameConnection* ConnectionServer::getAnyGameConnection()
|
||||
if (!cs.gameServerMap.empty())
|
||||
return cs.gameServerMap.begin()->second;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
@@ -157,7 +157,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message)
|
||||
ca.getStartYaw(),
|
||||
ca.getTemplateName(),
|
||||
ca.getTimeSeconds(),
|
||||
static_cast<int32>(::time(NULL)),
|
||||
static_cast<int32>(::time(nullptr)),
|
||||
ConfigConnectionServer::getDisableWorldSnapshot());
|
||||
client->getClientConnection()->send(startScene, true);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message)
|
||||
// record the time when play started for the character
|
||||
if (client->getClientConnection()->getStartPlayTime() == 0)
|
||||
{
|
||||
client->getClientConnection()->setStartPlayTime(::time(NULL));
|
||||
client->getClientConnection()->setStartPlayTime(::time(nullptr));
|
||||
}
|
||||
|
||||
// update the play time info on the game server
|
||||
|
||||
@@ -246,9 +246,9 @@ void PseudoClientConnection::receiveMessage(const Archive::ByteStream & message)
|
||||
characterId = m_transferCharacterData.getDestinationCharacterId();
|
||||
}
|
||||
std::vector<std::pair<NetworkId, std::string> > static const emptyStringVector;
|
||||
NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, NULL, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true);
|
||||
NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, nullptr, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true);
|
||||
m_gameConnection->send(m, true);
|
||||
LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, NULL, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId));
|
||||
LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, nullptr, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId));
|
||||
}
|
||||
}
|
||||
else if(msg.isType("TransferLoginCharacterToSourceServer"))
|
||||
|
||||
@@ -303,10 +303,10 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber,
|
||||
if (i != ms_getFeaturesTrackingNumberMap.end())
|
||||
{
|
||||
bool reuseMessage = false;
|
||||
AccountFeatureIdRequest const * accountFeatureIdRequest = NULL;
|
||||
AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = NULL;
|
||||
AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = NULL;
|
||||
ClaimRewardsMessage * claimRewardsMessage = NULL;
|
||||
AccountFeatureIdRequest const * accountFeatureIdRequest = nullptr;
|
||||
AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = nullptr;
|
||||
AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = nullptr;
|
||||
ClaimRewardsMessage * claimRewardsMessage = nullptr;
|
||||
|
||||
if (i->second->isType("AccountFeatureIdRequest"))
|
||||
accountFeatureIdRequest = dynamic_cast<AccountFeatureIdRequest const *>(i->second);
|
||||
@@ -319,7 +319,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber,
|
||||
|
||||
if (result == RESULT_SUCCESS)
|
||||
{
|
||||
ClientConnection * clientConnection = NULL;
|
||||
ClientConnection * clientConnection = nullptr;
|
||||
if (accountFeatureIdRequest)
|
||||
clientConnection = ConnectionServer::getClientConnection(accountFeatureIdRequest->getTargetStationId());
|
||||
else if (adjustAccountFeatureIdRequest)
|
||||
@@ -391,7 +391,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber,
|
||||
else
|
||||
{
|
||||
// if account already has the feature, adjust it, otherwise add the feature
|
||||
LoginAPI::Feature const * existingFeature = NULL;
|
||||
LoginAPI::Feature const * existingFeature = nullptr;
|
||||
|
||||
for (unsigned k = 0; k < featureCount; ++k)
|
||||
{
|
||||
@@ -444,7 +444,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber,
|
||||
}
|
||||
else
|
||||
{
|
||||
LoginAPI::Feature const * newlyAddedFeature = NULL;
|
||||
LoginAPI::Feature const * newlyAddedFeature = nullptr;
|
||||
|
||||
for (unsigned k = 0; k < featureCount; ++k)
|
||||
{
|
||||
@@ -506,7 +506,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber,
|
||||
else
|
||||
{
|
||||
// see if account already has the required feature
|
||||
LoginAPI::Feature const * existingFeature = NULL;
|
||||
LoginAPI::Feature const * existingFeature = nullptr;
|
||||
|
||||
for (unsigned k = 0; k < featureCount; ++k)
|
||||
{
|
||||
@@ -904,7 +904,7 @@ void SessionApiClient::validateClient (ClientConnection* client, const std::stri
|
||||
|
||||
void SessionApiClient::startPlay(const ClientConnection& client)
|
||||
{
|
||||
IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), NULL));
|
||||
IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), nullptr));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user