aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/ServerConnection.cpp
diff options
context:
space:
mode:
authorvoid_17 <heroerror3@gmail.com>2026-03-02 15:58:20 +0700
committervoid_17 <heroerror3@gmail.com>2026-03-02 15:58:20 +0700
commit7074f35e4ba831e358117842b99ee35b87f85ae5 (patch)
tree7d440d23473196af3056bf2ff4c59d9e740a06f5 /Minecraft.Client/ServerConnection.cpp
parentd63f79325f85e014361eb8cf1e41eaebedb1ae71 (diff)
shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
Diffstat (limited to 'Minecraft.Client/ServerConnection.cpp')
-rw-r--r--Minecraft.Client/ServerConnection.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/Minecraft.Client/ServerConnection.cpp b/Minecraft.Client/ServerConnection.cpp
index 9880a8c6..064c7b51 100644
--- a/Minecraft.Client/ServerConnection.cpp
+++ b/Minecraft.Client/ServerConnection.cpp
@@ -26,16 +26,16 @@ ServerConnection::~ServerConnection()
// 4J - added to handle incoming connections, to replace thread that original used to have
void ServerConnection::NewIncomingSocket(Socket *socket)
{
- shared_ptr<PendingConnection> unconnectedClient = shared_ptr<PendingConnection>(new PendingConnection(server, socket, L"Connection #" + _toString<int>(connectionCounter++)));
- handleConnection(unconnectedClient);
+ std::shared_ptr<PendingConnection> unconnectedClient = std::shared_ptr<PendingConnection>(new PendingConnection(server, socket, L"Connection #" + _toString<int>(connectionCounter++)));
+ handleConnection(unconnectedClient);
}
-void ServerConnection::addPlayerConnection(shared_ptr<PlayerConnection> uc)
+void ServerConnection::addPlayerConnection(std::shared_ptr<PlayerConnection> uc)
{
players.push_back(uc);
}
-void ServerConnection::handleConnection(shared_ptr<PendingConnection> uc)
+void ServerConnection::handleConnection(std::shared_ptr<PendingConnection> uc)
{
EnterCriticalSection(&pending_cs);
pending.push_back(uc);
@@ -47,14 +47,14 @@ void ServerConnection::stop()
EnterCriticalSection(&pending_cs);
for (unsigned int i = 0; i < pending.size(); i++)
{
- shared_ptr<PendingConnection> uc = pending[i];
+ std::shared_ptr<PendingConnection> uc = pending[i];
uc->connection->close(DisconnectPacket::eDisconnect_Closed);
}
LeaveCriticalSection(&pending_cs);
for (unsigned int i = 0; i < players.size(); i++)
{
- shared_ptr<PlayerConnection> player = players[i];
+ std::shared_ptr<PlayerConnection> player = players[i];
player->connection->close(DisconnectPacket::eDisconnect_Closed);
}
}
@@ -64,12 +64,12 @@ void ServerConnection::tick()
{
// MGH - changed this so that the the CS lock doesn't cover the tick (was causing a lockup when 2 players tried to join)
EnterCriticalSection(&pending_cs);
- vector< shared_ptr<PendingConnection> > tempPending = pending;
+ vector< std::shared_ptr<PendingConnection> > tempPending = pending;
LeaveCriticalSection(&pending_cs);
for (unsigned int i = 0; i < tempPending.size(); i++)
{
- shared_ptr<PendingConnection> uc = tempPending[i];
+ std::shared_ptr<PendingConnection> uc = tempPending[i];
// try { // 4J - removed try/catch
uc->tick();
// } catch (Exception e) {
@@ -92,8 +92,8 @@ void ServerConnection::tick()
for (unsigned int i = 0; i < players.size(); i++)
{
- shared_ptr<PlayerConnection> player = players[i];
- shared_ptr<ServerPlayer> serverPlayer = player->getPlayer();
+ std::shared_ptr<PlayerConnection> player = players[i];
+ std::shared_ptr<ServerPlayer> serverPlayer = player->getPlayer();
if( serverPlayer )
{
serverPlayer->doChunkSendingTick(false);
@@ -138,7 +138,7 @@ void ServerConnection::handleTextureReceived(const wstring &textureName)
}
for (unsigned int i = 0; i < players.size(); i++)
{
- shared_ptr<PlayerConnection> player = players[i];
+ std::shared_ptr<PlayerConnection> player = players[i];
if (!player->done)
{
player->handleTextureReceived(textureName);
@@ -155,7 +155,7 @@ void ServerConnection::handleTextureAndGeometryReceived(const wstring &textureNa
}
for (unsigned int i = 0; i < players.size(); i++)
{
- shared_ptr<PlayerConnection> player = players[i];
+ std::shared_ptr<PlayerConnection> player = players[i];
if (!player->done)
{
player->handleTextureAndGeometryReceived(textureName);
@@ -163,7 +163,7 @@ void ServerConnection::handleTextureAndGeometryReceived(const wstring &textureNa
}
}
-void ServerConnection::handleServerSettingsChanged(shared_ptr<ServerSettingsChangedPacket> packet)
+void ServerConnection::handleServerSettingsChanged(std::shared_ptr<ServerSettingsChangedPacket> packet)
{
Minecraft *pMinecraft = Minecraft::GetInstance();
@@ -176,7 +176,7 @@ void ServerConnection::handleServerSettingsChanged(shared_ptr<ServerSettingsChan
app.DebugPrintf("ClientConnection::handleServerSettingsChanged - Difficulty = %d",packet->data);
pMinecraft->levels[i]->difficulty = packet->data;
}
- }
+ }
}
// else if(packet->action==ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS)// options
// {
@@ -194,11 +194,11 @@ void ServerConnection::handleServerSettingsChanged(shared_ptr<ServerSettingsChan
// {
// pMinecraft->options->SetGamertagSetting(false);
// }
-//
+//
// for (unsigned int i = 0; i < players.size(); i++)
// {
-// shared_ptr<PlayerConnection> playerconnection = players[i];
-// playerconnection->setShowOnMaps(pMinecraft->options->GetGamertagSetting());
+// std::shared_ptr<PlayerConnection> playerconnection = players[i];
+// playerconnection->setShowOnMaps(pMinecraft->options->GetGamertagSetting());
// }
// }
} \ No newline at end of file