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 a9be52c41a.
This commit is contained in:
Loki Rautio
2026-03-07 21:12:22 -06:00
parent a9be52c41a
commit 087b7e7abf
1373 changed files with 19449 additions and 19903 deletions

View File

@@ -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 + "<22>" + server->players->getPlayerCount() + "<22>" + 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;