Project modernization (#630)

* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
This commit is contained in:
ModMaker101
2026-03-07 21:56:03 -05:00
committed by GitHub
parent 1be5faaea7
commit a9be52c41a
1373 changed files with 19903 additions and 19449 deletions

View File

@@ -6,7 +6,6 @@
#include "..\..\ClientConnection.h"
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
#define CHECKBOXES_TIMER_ID 0
#define CHECKBOXES_TIMER_TIME 100
@@ -17,21 +16,21 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void
m_bShouldNavBack = false;
InGamePlayerOptionsInitData *initData = (InGamePlayerOptionsInitData *)_initData;
InGamePlayerOptionsInitData *initData = static_cast<InGamePlayerOptionsInitData *>(_initData);
m_networkSmallId = initData->networkSmallId;
m_playerPrivileges = initData->playerPrivileges;
INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad );
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
if(editingPlayer != NULL)
if(editingPlayer != nullptr)
{
m_labelGamertag.init(editingPlayer->GetDisplayName());
}
bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer);
m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer);
if( m_editingSelf || trustPlayers || editingPlayer->IsHost())
{
@@ -241,7 +240,7 @@ void UIScene_InGamePlayerOptionsMenu::handleReload()
bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer);
m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer);
if( m_editingSelf || trustPlayers || editingPlayer->IsHost())
{
@@ -372,7 +371,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
else
{
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
if(!trustPlayers && (editingPlayer != NULL && !editingPlayer->IsHost() ) )
if(!trustPlayers && (editingPlayer != nullptr && !editingPlayer->IsHost() ) )
{
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotMine,!m_checkboxes[eControl_BuildAndMine].IsChecked());
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotBuild,!m_checkboxes[eControl_BuildAndMine].IsChecked());
@@ -405,7 +404,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
if(player->connection)
{
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) );
player->connection->send(std::make_shared<PlayerInfoPacket>(m_networkSmallId, -1, m_playerPrivileges));
}
}
navigateBack();
@@ -428,7 +427,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat
void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId)
{
switch((int)controlId)
switch(static_cast<int>(controlId))
{
case eControl_Kick:
{
@@ -446,7 +445,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId)
int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
BYTE smallId = *(BYTE *)pParam;
BYTE smallId = *static_cast<BYTE *>(pParam);
delete pParam;
if(result==C4JStorage::EMessage_ResultAccept)
@@ -455,7 +454,7 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
if(localPlayer->connection)
{
localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
localPlayer->connection->send(std::make_shared<KickPlayerPacket>(smallId));
}
// Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game.
@@ -470,12 +469,12 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4
void UIScene_InGamePlayerOptionsMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving)
{
app.DebugPrintf("UIScene_InGamePlayerOptionsMenu::OnPlayerChanged");
UIScene_InGamePlayerOptionsMenu *scene = (UIScene_InGamePlayerOptionsMenu *)callbackParam;
UIScene_InGamePlayerOptionsMenu *scene = static_cast<UIScene_InGamePlayerOptionsMenu *>(callbackParam);
UIScene_InGameInfoMenu *infoScene = (UIScene_InGameInfoMenu *)scene->getBackScene();
if(infoScene != NULL) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving);
UIScene_InGameInfoMenu *infoScene = static_cast<UIScene_InGameInfoMenu *>(scene->getBackScene());
if(infoScene != nullptr) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving);
if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId)
if(leaving && pPlayer != nullptr && pPlayer->GetSmallId() == scene->m_networkSmallId)
{
scene->m_bShouldNavBack = true;
}
@@ -497,7 +496,7 @@ void UIScene_InGamePlayerOptionsMenu::resetCheatCheckboxes()
void UIScene_InGamePlayerOptionsMenu::handleCheckboxToggled(F64 controlId, bool selected)
{
switch((int)controlId)
switch(static_cast<int>(controlId))
{
case eControl_Op:
// flag that the moderator state has changed