mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-29 23:15:56 -04:00
and more performance tweaks
This commit is contained in:
@@ -1299,7 +1299,7 @@ void ChatServer::destroyRoom(const std::string & roomName)
|
||||
if (pos != roomName.npos)
|
||||
{
|
||||
std::string tmpRoomName = roomName.substr(0, pos);
|
||||
char lastChar = tmpRoomName[strlen(tmpRoomName.c_str()) - 1];
|
||||
char lastChar = tmpRoomName[tmpRoomName.length() - 1];
|
||||
if (lastChar >= '0' && lastChar <= '9')
|
||||
{
|
||||
ChatServer::destroyRoom(tmpRoomName);
|
||||
|
||||
@@ -146,9 +146,9 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
// deliver IM to character
|
||||
ChatInstantMessageToCharacter chat(cri);
|
||||
ChatAvatarId characterName = chat.getCharacterName();
|
||||
if(characterName.gameCode == "")
|
||||
if(characterName.gameCode.empty())
|
||||
characterName.gameCode = "SWG";
|
||||
if(characterName.cluster == "")
|
||||
if(characterName.cluster.empty())
|
||||
characterName.cluster = ConfigChatServer::getClusterName();
|
||||
|
||||
ChatAvatarId fromName;
|
||||
@@ -185,9 +185,9 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
// deliver IM to character
|
||||
ChatInstantMessageToCharacter chat(cri);
|
||||
ChatAvatarId characterName = chat.getCharacterName();
|
||||
if(characterName.gameCode == "")
|
||||
if(characterName.gameCode.empty())
|
||||
characterName.gameCode = "SWG";
|
||||
if(characterName.cluster == "")
|
||||
if(characterName.cluster.empty())
|
||||
characterName.cluster = ConfigChatServer::getClusterName();
|
||||
|
||||
ChatServer::sendInstantMessage(*i, chat.getSequence(), characterName, chat.getMessage(), chat.getOutOfBand());
|
||||
@@ -205,9 +205,9 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
//printf("ConnectionServerConnection -- ChatPersistentMessageToServer\n");
|
||||
ChatPersistentMessageToServer chat(cri);
|
||||
ChatAvatarId characterName = chat.getToCharacterName();
|
||||
if(characterName.gameCode == "")
|
||||
if(characterName.gameCode.empty())
|
||||
characterName.gameCode = "SWG";
|
||||
if(characterName.cluster == "")
|
||||
if(characterName.cluster.empty())
|
||||
characterName.cluster = ConfigChatServer::getClusterName();
|
||||
|
||||
ChatServer::sendPersistentMessage((*i), chat.getSequence(), characterName, chat.getSubject(), chat.getMessage(), chat.getOutOfBand());
|
||||
@@ -283,9 +283,9 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
//printf("ConnectionServerConnection -- ChatREmoveModeratorFromRoom\n");
|
||||
ChatRemoveModeratorFromRoom chat(cri);
|
||||
ChatAvatarId characterName = chat.getAvatarId();
|
||||
if(characterName.gameCode == "")
|
||||
if(characterName.gameCode.empty())
|
||||
characterName.gameCode = "SWG";
|
||||
if(characterName.cluster == "")
|
||||
if(characterName.cluster.empty())
|
||||
characterName.cluster = ConfigChatServer::getClusterName();
|
||||
ChatServer::removeModeratorFromRoom(chat.getSequenceId(), (*i), characterName, chat.getRoomName());
|
||||
}
|
||||
@@ -316,9 +316,9 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
//printf("ConnectionServerConnection -- ChatInviteAvatarToRoom\n");
|
||||
ChatInviteAvatarToRoom chat(cri);
|
||||
ChatAvatarId characterName = chat.getAvatarId();
|
||||
if(characterName.gameCode == "")
|
||||
if(characterName.gameCode.empty())
|
||||
characterName.gameCode = "SWG";
|
||||
if(characterName.cluster == "")
|
||||
if(characterName.cluster.empty())
|
||||
characterName.cluster = ConfigChatServer::getClusterName();
|
||||
ChatServer::invite((*i), characterName, chat.getRoomName());
|
||||
}
|
||||
@@ -328,9 +328,9 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
//printf("ConnectionServerConnection -- ChatUninviteAvatarToRoom\n");
|
||||
ChatUninviteFromRoom chat(cri);
|
||||
ChatAvatarId characterName = chat.getAvatar();
|
||||
if(characterName.gameCode == "")
|
||||
if(characterName.gameCode.empty())
|
||||
characterName.gameCode = "SWG";
|
||||
if(characterName.cluster == "")
|
||||
if(characterName.cluster.empty())
|
||||
characterName.cluster = ConfigChatServer::getClusterName();
|
||||
ChatServer::uninvite((*i), chat.getSequence(), characterName, chat.getRoomName());
|
||||
}
|
||||
@@ -340,9 +340,9 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
//printf("ConnectionServerConnection -- ChatBanAvatarFromRoom\n");
|
||||
ChatBanAvatarFromRoom chat(cri);
|
||||
ChatAvatarId characterName = chat.getAvatarId();
|
||||
if(characterName.gameCode == "")
|
||||
if(characterName.gameCode.empty())
|
||||
characterName.gameCode = "SWG";
|
||||
if(characterName.cluster == "")
|
||||
if(characterName.cluster.empty())
|
||||
characterName.cluster = ConfigChatServer::getClusterName();
|
||||
ChatServer::banFromRoom(chat.getSequence(), (*i), characterName, chat.getRoomName());
|
||||
}
|
||||
@@ -352,9 +352,9 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
//printf("ConnectionServerConnection -- ChatUnbanAvatarFromRoom\n");
|
||||
ChatUnbanAvatarFromRoom chat(cri);
|
||||
ChatAvatarId characterName = chat.getAvatarId();
|
||||
if(characterName.gameCode == "")
|
||||
if(characterName.gameCode.empty())
|
||||
characterName.gameCode = "SWG";
|
||||
if(characterName.cluster == "")
|
||||
if(characterName.cluster.empty())
|
||||
characterName.cluster = ConfigChatServer::getClusterName();
|
||||
ChatServer::unbanFromRoom(chat.getSequence(), (*i), characterName, chat.getRoomName());
|
||||
}
|
||||
|
||||
@@ -905,7 +905,7 @@ std::string VChatInterface::parseWorldName(std::string const & input)
|
||||
std::string::size_type findIndex = input.find(worldCode);
|
||||
if(findIndex != std::string::npos)
|
||||
{
|
||||
findIndex += strlen(worldCode.c_str());
|
||||
findIndex += worldCode.length());
|
||||
output = input.substr(findIndex);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace AuctionMarketNamespace
|
||||
{
|
||||
HexString += buffer;
|
||||
}
|
||||
z++;
|
||||
++z;
|
||||
}
|
||||
|
||||
DEBUG_REPORT_LOG(ConfigCommodityServer::getShowAllDebugInfo(), ("[Commodities Server ][HEX OOB IN] : %s \n", HexString.c_str()));
|
||||
@@ -3002,7 +3002,7 @@ void AuctionMarket::DestroyVendorMarket(const DestroyVendorMarketMessage &messag
|
||||
std::vector<std::map<NetworkId, Auction *>::iterator> destroyedAuctions;
|
||||
std::map<NetworkId, Auction *>::iterator item;
|
||||
// get all the auctions for this location and get an iterator from the real auctions map
|
||||
for( std::map<NetworkId, Auction*>::iterator j = (*i).second->GetAuctions().begin(); j != (*i).second->GetAuctions().end(); j++ )
|
||||
for( std::map<NetworkId, Auction*>::iterator j = (*i).second->GetAuctions().begin(); j != (*i).second->GetAuctions().end(); ++j )
|
||||
{
|
||||
item = m_auctions.find((*j).first);
|
||||
if( item != m_auctions.end() )
|
||||
@@ -3012,7 +3012,7 @@ void AuctionMarket::DestroyVendorMarket(const DestroyVendorMarketMessage &messag
|
||||
}
|
||||
|
||||
// do it again for all vendor offers
|
||||
for( std::map<NetworkId, Auction*>::iterator k = (*i).second->GetVendorOffers().begin(); k != (*i).second->GetVendorOffers().end(); k++ )
|
||||
for( std::map<NetworkId, Auction*>::iterator k = (*i).second->GetVendorOffers().begin(); k != (*i).second->GetVendorOffers().end(); ++k )
|
||||
{
|
||||
item = m_auctions.find((*k).first);
|
||||
if( item != m_auctions.end() )
|
||||
@@ -3077,7 +3077,7 @@ void AuctionMarket::DeleteAuctionLocation(const DeleteAuctionLocationMessage &me
|
||||
std::vector<std::map<NetworkId, Auction *>::iterator> destroyedAuctions;
|
||||
std::map<NetworkId, Auction *>::iterator item;
|
||||
// get all the auctions for this location and get an iterator from the real auctions map
|
||||
for( std::map<NetworkId, Auction*>::iterator j = (*i).second->GetAuctions().begin(); j != (*i).second->GetAuctions().end(); j++ )
|
||||
for( std::map<NetworkId, Auction*>::iterator j = (*i).second->GetAuctions().begin(); j != (*i).second->GetAuctions().end(); ++j )
|
||||
{
|
||||
item = m_auctions.find((*j).first);
|
||||
if( item != m_auctions.end() )
|
||||
@@ -3087,7 +3087,7 @@ void AuctionMarket::DeleteAuctionLocation(const DeleteAuctionLocationMessage &me
|
||||
}
|
||||
|
||||
// do it again for all vendor offers
|
||||
for( std::map<NetworkId, Auction*>::iterator k = (*i).second->GetVendorOffers().begin(); k != (*i).second->GetVendorOffers().end(); k++ )
|
||||
for( std::map<NetworkId, Auction*>::iterator k = (*i).second->GetVendorOffers().begin(); k != (*i).second->GetVendorOffers().end(); ++k )
|
||||
{
|
||||
item = m_auctions.find((*k).first);
|
||||
if( item != m_auctions.end() )
|
||||
@@ -3473,7 +3473,7 @@ bool AuctionMarket::FixVendorLocation( const std::string &loc )
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -4341,7 +4341,7 @@ void static decodeOOB(const std::string & UTF8String, Unicode::String & UniStrin
|
||||
UniString.push_back(unicharvalue);
|
||||
tempstring.clear();
|
||||
}
|
||||
c++;
|
||||
++c;
|
||||
}
|
||||
if (tempstring.length() != 0)
|
||||
{
|
||||
|
||||
@@ -176,7 +176,7 @@ void CSToolConnection::onReceive( const Archive::ByteStream & message )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sInputBuffer = "";
|
||||
m_sInputBuffer.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace TaskManagerNameSpace
|
||||
std::vector<QueuedSpawnRequest> s_delayedSpawnRequests;
|
||||
struct OutstandingSpawnRequestAck
|
||||
{
|
||||
OutstandingSpawnRequestAck(const std::string n, const Archive::ByteStream & a, int t) :
|
||||
OutstandingSpawnRequestAck(const std::string &n, const Archive::ByteStream & a, int t) :
|
||||
nodeLabel(n), request(a), transactionId(t)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -273,9 +273,9 @@ namespace DB
|
||||
template<int S>
|
||||
void BindableString<S>::setValue(const std::string &buffer)
|
||||
{
|
||||
FATAL(strlen(buffer.c_str())>S,("Attempt to save a std::string \"%s\"that is too long to the database.", buffer.c_str()));
|
||||
FATAL(buffer.length())>S,("Attempt to save a std::string \"%s\"that is too long to the database.", buffer.c_str()));
|
||||
strncpy(m_value, buffer.c_str(), S+1);
|
||||
indicator=strlen(buffer.c_str());
|
||||
indicator=buffer.length();
|
||||
}
|
||||
|
||||
template<int S>
|
||||
|
||||
Reference in New Issue
Block a user