aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PendingConnection.cpp
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
commit087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch)
tree69454763e73ca764af4e682d3573080b13138a0e /Minecraft.Client/PendingConnection.cpp
parenta9be52c41a02d207233199e98898fe7483d7e817 (diff)
Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817.
Diffstat (limited to 'Minecraft.Client/PendingConnection.cpp')
-rw-r--r--Minecraft.Client/PendingConnection.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Minecraft.Client/PendingConnection.cpp b/Minecraft.Client/PendingConnection.cpp
index 36e37520..29ab7c28 100644
--- a/Minecraft.Client/PendingConnection.cpp
+++ b/Minecraft.Client/PendingConnection.cpp
@@ -45,7 +45,7 @@ PendingConnection::~PendingConnection()
void PendingConnection::tick()
{
- if (acceptedLogin != nullptr)
+ if (acceptedLogin != NULL)
{
this->handleAcceptedLogin(acceptedLogin);
acceptedLogin = nullptr;
@@ -65,7 +65,7 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason)
// try { // 4J - removed try/catch
// logger.info("Disconnecting " + getName() + ": " + reason);
app.DebugPrintf("Pending connection disconnect: %d\n", reason );
- connection->send(std::make_shared<DisconnectPacket>(reason));
+ connection->send( shared_ptr<DisconnectPacket>( new DisconnectPacket(reason) ) );
connection->sendAndQuit();
done = true;
// } catch (Exception e) {
@@ -121,7 +121,7 @@ void PendingConnection::sendPreLoginResponse()
// Need to use the online XUID otherwise friend checks will fail on the client
ugcXuids[ugcXuidCount] = player->connection->m_onlineXUID;
- if( player->connection->getNetworkPlayer() != nullptr && player->connection->getNetworkPlayer()->IsHost() ) hostIndex = ugcXuidCount;
+ if( player->connection->getNetworkPlayer() != NULL && player->connection->getNetworkPlayer()->IsHost() ) hostIndex = ugcXuidCount;
++ugcXuidCount;
}
@@ -136,9 +136,9 @@ void PendingConnection::sendPreLoginResponse()
else
#endif
{
- DWORD cappedCount = (ugcXuidCount > 255u) ? 255u : ugcXuidCount;
+ DWORD cappedCount = (ugcXuidCount > 255u) ? 255u : static_cast<DWORD>(ugcXuidCount);
BYTE cappedHostIndex = (hostIndex >= 255u) ? 254 : static_cast<BYTE>(hostIndex);
- connection->send(std::make_shared<PreLoginPacket>(L"-", ugcXuids, cappedCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion, szUniqueMapName, app.GetGameHostOption(eGameHostOption_All), cappedHostIndex, server->m_texturePackId));
+ connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(L"-", ugcXuids, cappedCount, ugcFriendsOnlyBits, server->m_ugcPlayersVersion,szUniqueMapName,app.GetGameHostOption(eGameHostOption_All),cappedHostIndex, server->m_texturePackId) ) );
}
}
@@ -201,7 +201,7 @@ void PendingConnection::handleLogin(shared_ptr<LoginPacket> packet)
vector<shared_ptr<ServerPlayer> >& pl = server->getPlayers()->players;
for (const auto& i : pl)
{
- if (i != nullptr && i->name == name)
+ if (i != NULL && i->name == name)
{
nameTaken = true;
break;
@@ -264,10 +264,10 @@ void PendingConnection::handleAcceptedLogin(shared_ptr<LoginPacket> packet)
if(playerXuid == INVALID_XUID) playerXuid = packet->m_onlineXuid;
shared_ptr<ServerPlayer> playerEntity = server->getPlayers()->getPlayerForLogin(this, name, playerXuid,packet->m_onlineXuid);
- if (playerEntity != nullptr)
+ if (playerEntity != NULL)
{
server->getPlayers()->placeNewPlayer(connection, playerEntity, packet);
- connection = nullptr; // We've moved responsibility for this over to the new PlayerConnection, nullptr so we don't delete our reference to it here in our dtor
+ connection = NULL; // We've moved responsibility for this over to the new PlayerConnection, NULL so we don't delete our reference to it here in our dtor
}
done = true;
@@ -284,7 +284,7 @@ void PendingConnection::handleGetInfo(shared_ptr<GetInfoPacket> packet)
//try {
//String message = server->motd + "�" + server->players->getPlayerCount() + "�" + server->players->getMaxPlayers();
//connection->send(new DisconnectPacket(message));
- connection->send(std::make_shared<DisconnectPacket>(DisconnectPacket::eDisconnect_ServerFull));
+ connection->send(shared_ptr<DisconnectPacket>(new DisconnectPacket(DisconnectPacket::eDisconnect_ServerFull) ) );
connection->sendAndQuit();
server->connection->removeSpamProtection(connection->getSocket());
done = true;