mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-10-04 19:13:06 -04:00
newer standards prefer nullptr over NULL - this is most of them but there are others too
This commit is contained in:
@@ -61,7 +61,7 @@ int main(int argc, char ** argv)
|
||||
Unicode::UnicodeNarrowStringVector localeVector;
|
||||
localeVector.push_back(defaultLocale);
|
||||
|
||||
LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, NULL, displayBadStringIds);
|
||||
LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, nullptr, displayBadStringIds);
|
||||
ExitChain::add(LocalizationManager::remove, "LocalizationManager::remove");
|
||||
|
||||
DataTableManager::install();
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace AuctionNamespace
|
||||
if (iterAttr != searchableAttributeString->end())
|
||||
{
|
||||
applicableSearchCondition = true;
|
||||
return (NULL != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required)
|
||||
return (nullptr != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace AuctionNamespace
|
||||
if (iterAttr != searchableAttributeString->end())
|
||||
{
|
||||
applicableSearchCondition = true;
|
||||
return (NULL == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required)
|
||||
return (nullptr == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,10 +293,10 @@ m_userDescription(userDescription),
|
||||
m_oobLength(oobLength),
|
||||
m_oobData(oobData),
|
||||
m_attributes(),
|
||||
m_searchableAttributeInt(NULL),
|
||||
m_searchableAttributeFloat(NULL),
|
||||
m_searchableAttributeString(NULL),
|
||||
m_highBid(NULL),
|
||||
m_searchableAttributeInt(nullptr),
|
||||
m_searchableAttributeFloat(nullptr),
|
||||
m_searchableAttributeString(nullptr),
|
||||
m_highBid(nullptr),
|
||||
m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)),
|
||||
m_sold(false),
|
||||
m_active(true),
|
||||
@@ -395,10 +395,10 @@ m_userDescription(userDescription),
|
||||
m_oobLength(oobLength),
|
||||
m_oobData(oobData),
|
||||
m_attributes(),
|
||||
m_searchableAttributeInt(NULL),
|
||||
m_searchableAttributeFloat(NULL),
|
||||
m_searchableAttributeString(NULL),
|
||||
m_highBid(NULL),
|
||||
m_searchableAttributeInt(nullptr),
|
||||
m_searchableAttributeFloat(nullptr),
|
||||
m_searchableAttributeString(nullptr),
|
||||
m_highBid(nullptr),
|
||||
m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)),
|
||||
m_sold(isSold),
|
||||
m_active(isActive),
|
||||
@@ -488,7 +488,7 @@ void Auction::Initialization()
|
||||
#ifdef _DEBUG
|
||||
for (int i = 0; i < static_cast<int>(AuctionQueryHeadersMessage::SCC_LAST); ++i)
|
||||
{
|
||||
s_searchConditionComparisonFn[i] = NULL;
|
||||
s_searchConditionComparisonFn[i] = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -502,7 +502,7 @@ void Auction::Initialization()
|
||||
#ifdef _DEBUG
|
||||
for (int j = 0; j < static_cast<int>(AuctionQueryHeadersMessage::SCC_LAST); ++j)
|
||||
{
|
||||
DEBUG_FATAL((s_searchConditionComparisonFn[j] == NULL), ("s_searchConditionComparisonFn array is NULL at index (%d)", j));
|
||||
DEBUG_FATAL((s_searchConditionComparisonFn[j] == nullptr), ("s_searchConditionComparisonFn array is nullptr at index (%d)", j));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -659,7 +659,7 @@ const AuctionBid *Auction::GetPreviousBid() const
|
||||
{
|
||||
if (m_bids.size() <= 1)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -677,9 +677,9 @@ const AuctionBid *Auction::GetPreviousBid() const
|
||||
*/
|
||||
int Auction::GetActualBid(AuctionBid *bid)
|
||||
{
|
||||
assert(bid != NULL);
|
||||
assert(bid != nullptr);
|
||||
int bidNeeded = std::max(m_minBid, bid->GetBid());
|
||||
if (m_highBid != NULL)
|
||||
if (m_highBid != nullptr)
|
||||
{
|
||||
bidNeeded = m_highBid->GetBid();
|
||||
if (*bid > *m_highBid)
|
||||
@@ -765,7 +765,7 @@ AuctionResultCode Auction::AddBid(
|
||||
|
||||
AuctionBid *auctionBid = new AuctionBid(bidderId, bid, maxProxyBid);
|
||||
int newBidForHighBidder = GetActualBid(auctionBid);
|
||||
if (m_highBid != NULL)
|
||||
if (m_highBid != nullptr)
|
||||
{
|
||||
if (*auctionBid <= *m_highBid)
|
||||
{
|
||||
@@ -810,7 +810,7 @@ const AuctionBid *Auction::GetPlayerBid(const NetworkId & playerId) const
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -826,7 +826,7 @@ bool Auction::Update(int gameTime)
|
||||
//immediate sale
|
||||
DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Expiring immediate sale - Auction is active and sold.\n"));
|
||||
|
||||
if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL))
|
||||
if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr))
|
||||
{
|
||||
Expire(true, false, m_trackId);
|
||||
m_trackId = -1;
|
||||
@@ -840,14 +840,14 @@ bool Auction::Update(int gameTime)
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Auction expiring based on timer.\n"));
|
||||
|
||||
if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL))
|
||||
if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr))
|
||||
{
|
||||
Expire(m_highBid != NULL, true, m_trackId);
|
||||
Expire(m_highBid != nullptr, true, m_trackId);
|
||||
m_trackId = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Expire(m_highBid != NULL, true);
|
||||
Expire(m_highBid != nullptr, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -862,7 +862,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id)
|
||||
|
||||
m_auctionTimer = 0;
|
||||
m_active = false;
|
||||
if (sold && m_highBid != NULL)
|
||||
if (sold && m_highBid != nullptr)
|
||||
{
|
||||
m_sold = true;
|
||||
}
|
||||
@@ -934,7 +934,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id)
|
||||
m_location.SetVendorFirstTimerExpiredAuctionDate(time(0));
|
||||
}
|
||||
|
||||
DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and null high bid obj .\n"));
|
||||
DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and nullptr high bid obj .\n"));
|
||||
AuctionMarket::getInstance().OnAuctionExpired(
|
||||
GetCreatorId(), m_sold, m_flags,
|
||||
NetworkId::cms_invalid, 0, m_item->GetItemId(), 0,
|
||||
@@ -1107,8 +1107,8 @@ void Auction::BuildSearchableAttributeList()
|
||||
std::map<std::string, std::string> const & saAlias = CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(m_item->GetCategory());
|
||||
|
||||
// for factory crates, also include the attributes of the item inside the crate
|
||||
std::map<std::string, CommoditiesAdvancedSearchAttribute::SearchAttribute const *> const * saItemInsideFactoryCrate = NULL;
|
||||
std::map<std::string, std::string> const * saAliasItemInsideFactoryCrate = NULL;
|
||||
std::map<std::string, CommoditiesAdvancedSearchAttribute::SearchAttribute const *> const * saItemInsideFactoryCrate = nullptr;
|
||||
std::map<std::string, std::string> const * saAliasItemInsideFactoryCrate = nullptr;
|
||||
int gotItemInsideFactoryCrate = 0;
|
||||
|
||||
if (m_item->GetCategory() == SharedObjectTemplate::GOT_misc_factory_crate)
|
||||
@@ -1134,10 +1134,10 @@ void Auction::BuildSearchableAttributeList()
|
||||
saAliasItemInsideFactoryCrate = &(CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(gotItemInsideFactoryCrate));
|
||||
|
||||
if (saItemInsideFactoryCrate->empty())
|
||||
saItemInsideFactoryCrate = NULL;
|
||||
saItemInsideFactoryCrate = nullptr;
|
||||
|
||||
if (saAliasItemInsideFactoryCrate->empty())
|
||||
saAliasItemInsideFactoryCrate = NULL;
|
||||
saAliasItemInsideFactoryCrate = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ AuctionLocation::~AuctionLocation()
|
||||
|
||||
bool AuctionLocation::AddAuction(Auction *auction)
|
||||
{
|
||||
assert(auction != NULL);
|
||||
assert(auction != nullptr);
|
||||
if (IsVendorMarket() &&
|
||||
(!auction->IsActive() || !IsOwner(auction->GetCreatorId())))
|
||||
{
|
||||
@@ -189,7 +189,7 @@ void AuctionLocation::CancelVendorSale(Auction *auction)
|
||||
|
||||
bool AuctionLocation::RemoveAuction(Auction *auction)
|
||||
{
|
||||
assert(auction != NULL);
|
||||
assert(auction != nullptr);
|
||||
return RemoveAuction(auction->GetItem().GetItemId());
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ Auction *AuctionLocation::GetAuction(const NetworkId & itemId)
|
||||
return((*i).second);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace AuctionMarketNamespace
|
||||
Auction const * const auction,
|
||||
int const type,
|
||||
int const entranceCharge,
|
||||
AuctionBid const * const playerBid = NULL
|
||||
AuctionBid const * const playerBid = nullptr
|
||||
)
|
||||
{
|
||||
AuctionDataHeader *header = new AuctionDataHeader;
|
||||
@@ -301,7 +301,7 @@ namespace AuctionMarketNamespace
|
||||
std::map<std::string, int> attributeValue;
|
||||
};
|
||||
|
||||
GetItemAttributeDataRequest * getItemAttributeDataRequest = NULL;
|
||||
GetItemAttributeDataRequest * getItemAttributeDataRequest = nullptr;
|
||||
|
||||
void processItemAttributeData(std::map<NetworkId, Auction *> const & auctions);
|
||||
|
||||
@@ -394,8 +394,8 @@ void AuctionMarketNamespace::processItemAttributeData(std::map<NetworkId, Auctio
|
||||
|
||||
if (proceed)
|
||||
{
|
||||
std::map<std::string, CommoditiesAdvancedSearchAttribute::SearchAttribute const *> const * skipAttribute = NULL;
|
||||
std::map<std::string, std::string> const * skipAttributeAlias = NULL;
|
||||
std::map<std::string, CommoditiesAdvancedSearchAttribute::SearchAttribute const *> const * skipAttribute = nullptr;
|
||||
std::map<std::string, std::string> const * skipAttributeAlias = nullptr;
|
||||
if (getItemAttributeDataRequest->ignoreSearchableAttribute)
|
||||
{
|
||||
std::map<std::string, CommoditiesAdvancedSearchAttribute::SearchAttribute const *> const & sa = CommoditiesAdvancedSearchAttribute::getSearchAttributeForGameObjectType(iterAuction->second->GetItem().GetCategory());
|
||||
@@ -590,7 +590,7 @@ void AuctionMarketNamespace::processItemAttributeData(std::map<NetworkId, Auctio
|
||||
}
|
||||
|
||||
delete getItemAttributeDataRequest;
|
||||
getItemAttributeDataRequest = NULL;
|
||||
getItemAttributeDataRequest = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -862,7 +862,7 @@ void AuctionMarket::RemoveAuctionLocationFromPriorityQueue(const AuctionLocation
|
||||
|
||||
void AuctionMarket::AddAuction(Auction *auction)
|
||||
{
|
||||
assert(auction != NULL);
|
||||
assert(auction != nullptr);
|
||||
|
||||
AuctionLocation &location = auction->GetLocation();
|
||||
if (!location.IsOwner(auction->GetItem().GetOwnerId()))
|
||||
@@ -1979,7 +1979,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message)
|
||||
DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : ResponseId : %d.\n", message.GetResponseId()));
|
||||
DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : TrackId : %d.\n", message.GetTrackId()));
|
||||
|
||||
Auction *auction = NULL;
|
||||
Auction *auction = nullptr;
|
||||
AuctionResultCode result = ARC_Success;
|
||||
std::map<NetworkId, Auction *>::iterator iter = m_auctions.find(
|
||||
message.GetAuctionId());
|
||||
@@ -1994,7 +1994,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message)
|
||||
{
|
||||
result = ARC_NotItemOwner;
|
||||
}
|
||||
else if (auction->GetHighBid() == NULL)
|
||||
else if (auction->GetHighBid() == nullptr)
|
||||
{
|
||||
result = ARC_NoBids;
|
||||
}
|
||||
@@ -2525,19 +2525,19 @@ void AuctionMarket::QueryAuctionHeaders(
|
||||
int debugNumberLocationsMatched = 0;
|
||||
int debugNumberAuctionsTested = 0;
|
||||
|
||||
std::map<NetworkId, Auction *> *auctionsPtr = NULL;
|
||||
std::map<NetworkId, Auction *> *auctionsPtr = nullptr;
|
||||
int entranceCharge = 0;
|
||||
AuctionLocation *locationPtr = NULL;
|
||||
Auction *auctionPtr = NULL;
|
||||
AuctionLocation *locationPtr = nullptr;
|
||||
Auction *auctionPtr = nullptr;
|
||||
std::map<NetworkId, Auction *>::const_iterator auctionIterator;
|
||||
AuctionDataHeader *header = NULL;
|
||||
AuctionDataHeader *header = nullptr;
|
||||
bool checkItemTemplate;
|
||||
while (locationIter != locationIterEnd)
|
||||
{
|
||||
++debugNumberLocationsTested;
|
||||
|
||||
checkItemTemplate = false;
|
||||
auctionsPtr = NULL;
|
||||
auctionsPtr = nullptr;
|
||||
entranceCharge = 0;
|
||||
locationPtr = (*locationIter).second;
|
||||
|
||||
@@ -2606,7 +2606,7 @@ void AuctionMarket::QueryAuctionHeaders(
|
||||
|
||||
auctionPtr = (*auctionIterator).second;
|
||||
const AuctionItem &item = auctionPtr->GetItem();
|
||||
header = NULL;
|
||||
header = nullptr;
|
||||
|
||||
// Check to see if the item template matches
|
||||
if (searchForResourceContainer && (itemTemplateId != 0))
|
||||
@@ -4977,7 +4977,7 @@ void AuctionMarket::getAuctionLocationPriorityQueue(int requestingGameServerId,
|
||||
{
|
||||
std::string output;
|
||||
char buffer[2048];
|
||||
int const timeNow = static_cast<int>(::time(NULL));
|
||||
int const timeNow = static_cast<int>(::time(nullptr));
|
||||
for (std::set<std::pair<int, NetworkId> >::const_iterator iterPQ = m_priorityQueueAuctionLocation.begin(); iterPQ != m_priorityQueueAuctionLocation.end(); ++iterPQ)
|
||||
{
|
||||
if (count <= 0)
|
||||
|
||||
@@ -191,7 +191,7 @@ void CommodityServer::run()
|
||||
s_commodityServerMetricsData = new CommodityServerMetricsData;
|
||||
MetricsManager::install(s_commodityServerMetricsData, false, "CommoditiesServer", "", 0);
|
||||
|
||||
time_t timePrevious = ::time(NULL);
|
||||
time_t timePrevious = ::time(nullptr);
|
||||
time_t timeCurrent = timePrevious;
|
||||
|
||||
while (true)
|
||||
@@ -202,7 +202,7 @@ void CommodityServer::run()
|
||||
break;
|
||||
NetworkHandler::update();
|
||||
|
||||
timeCurrent = ::time(NULL);
|
||||
timeCurrent = ::time(nullptr);
|
||||
MetricsManager::update(static_cast<float>((timeCurrent - timePrevious) * 1000));
|
||||
timePrevious = timeCurrent;
|
||||
|
||||
@@ -229,18 +229,18 @@ void CommodityServer::run()
|
||||
// this is not a high priority thing, so wait until
|
||||
// the cluster has started and "stabilized" before
|
||||
// doing this; 3 hours should be adequate
|
||||
time_t timeToRequestExcludedType = ::time(NULL) + 10800;
|
||||
time_t timeToRequestExcludedType = ::time(nullptr) + 10800;
|
||||
|
||||
// one time request from the game server (any game server)
|
||||
// to receive the resource tree hierarchy to support
|
||||
// searching for resource container
|
||||
time_t timeToRequestResourceTree = ::time(NULL);
|
||||
time_t timeToRequestResourceTree = ::time(nullptr);
|
||||
|
||||
while(true)
|
||||
{
|
||||
NetworkHandler::update();
|
||||
|
||||
timeCurrent = ::time(NULL);
|
||||
timeCurrent = ::time(nullptr);
|
||||
MetricsManager::update(static_cast<float>((timeCurrent - timePrevious) * 1000));
|
||||
timePrevious = timeCurrent;
|
||||
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ void CommodityServerMetricsData::updateData()
|
||||
buffer[sizeof(buffer)-1] = '\0';
|
||||
}
|
||||
|
||||
m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, NULL, false, false);
|
||||
m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, nullptr, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user