From 55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b Mon Sep 17 00:00:00 2001 From: void_17 <61356189+void2012@users.noreply.github.com> Date: Fri, 6 Mar 2026 02:11:18 +0700 Subject: Remove AUTO_VAR macro and _toString function (#592) --- Minecraft.Client/ServerConnection.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'Minecraft.Client/ServerConnection.cpp') diff --git a/Minecraft.Client/ServerConnection.cpp b/Minecraft.Client/ServerConnection.cpp index 21d77f22..07616aa4 100644 --- a/Minecraft.Client/ServerConnection.cpp +++ b/Minecraft.Client/ServerConnection.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "Options.h" #include "ServerConnection.h" + +#include #include "PendingConnection.h" #include "PlayerConnection.h" #include "ServerPlayer.h" @@ -26,8 +28,8 @@ ServerConnection::~ServerConnection() // 4J - added to handle incoming connections, to replace thread that original used to have void ServerConnection::NewIncomingSocket(Socket *socket) { - shared_ptr unconnectedClient = shared_ptr(new PendingConnection(server, socket, L"Connection #" + _toString(connectionCounter++))); - handleConnection(unconnectedClient); + shared_ptr unconnectedClient = std::make_shared(server, socket, L"Connection #" + std::to_wstring(connectionCounter++)); + handleConnection(unconnectedClient); } void ServerConnection::addPlayerConnection(shared_ptr uc) @@ -112,8 +114,8 @@ void ServerConnection::tick() bool ServerConnection::addPendingTextureRequest(const wstring &textureName) { - AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); - if( it == m_pendingTextureRequests.end() ) + auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName); + if( it == m_pendingTextureRequests.end() ) { m_pendingTextureRequests.push_back(textureName); return true; @@ -127,14 +129,13 @@ bool ServerConnection::addPendingTextureRequest(const wstring &textureName) void ServerConnection::handleTextureReceived(const wstring &textureName) { - AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); - if( it != m_pendingTextureRequests.end() ) + auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName); + if( it != m_pendingTextureRequests.end() ) { m_pendingTextureRequests.erase(it); } - for (unsigned int i = 0; i < players.size(); i++) + for (auto& player : players) { - shared_ptr player = players[i]; if (!player->done) { player->handleTextureReceived(textureName); @@ -144,14 +145,13 @@ void ServerConnection::handleTextureReceived(const wstring &textureName) void ServerConnection::handleTextureAndGeometryReceived(const wstring &textureName) { - AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName)); - if( it != m_pendingTextureRequests.end() ) + auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName); + if( it != m_pendingTextureRequests.end() ) { m_pendingTextureRequests.erase(it); } - for (unsigned int i = 0; i < players.size(); i++) + for (auto& player : players) { - shared_ptr player = players[i]; if (!player->done) { player->handleTextureAndGeometryReceived(textureName); @@ -172,7 +172,7 @@ void ServerConnection::handleServerSettingsChanged(shared_ptrdata); pMinecraft->levels[i]->difficulty = packet->data; } - } + } } // else if(packet->action==ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS)// options // { @@ -190,11 +190,11 @@ void ServerConnection::handleServerSettingsChanged(shared_ptroptions->SetGamertagSetting(false); // } -// +// // for (unsigned int i = 0; i < players.size(); i++) // { // shared_ptr playerconnection = players[i]; -// playerconnection->setShowOnMaps(pMinecraft->options->GetGamertagSetting()); +// playerconnection->setShowOnMaps(pMinecraft->options->GetGamertagSetting()); // } // } } -- cgit v1.2.3