aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-08 19:08:36 -0400
committerGitHub <noreply@github.com>2026-03-08 18:08:36 -0500
commit28614b922fb77149a54da1a87bebfbc98736f296 (patch)
tree7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp
parent88798b501d0cf6287b6f87acb2592676e3cec58d (diff)
Modernize project codebase (#906)
* 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 * Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp')
-rw-r--r--Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp b/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp
index e33e24fe..bc721802 100644
--- a/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp
+++ b/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp
@@ -136,7 +136,7 @@ UIScene_HowToPlay::UIScene_HowToPlay(int iPad, void *initData, UILayer *parentLa
// Extract pad and required page from init data. We just put the data into the pointer rather than using it as an address.
size_t uiInitData = ( size_t )( initData );
- EHowToPlayPage eStartPage = ( EHowToPlayPage )( ( uiInitData >> 16 ) & 0xFFF ); // Ignores MSB which is set to 1!
+ EHowToPlayPage eStartPage = static_cast<EHowToPlayPage>((uiInitData >> 16) & 0xFFF); // Ignores MSB which is set to 1!
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, (ETelemetry_HowToPlay_SubMenuId)eStartPage);
@@ -216,10 +216,10 @@ void UIScene_HowToPlay::handleInput(int iPad, int key, bool repeat, bool pressed
if(pressed)
{
// Next page
- int iNextPage = ( int )( m_eCurrPage ) + 1;
+ int iNextPage = static_cast<int>(m_eCurrPage) + 1;
if ( iNextPage != eHowToPlay_NumPages )
{
- StartPage( ( EHowToPlayPage )( iNextPage ) );
+ StartPage( static_cast<EHowToPlayPage>(iNextPage) );
ui.PlayUISFX(eSFX_Press);
}
handled = true;
@@ -229,7 +229,7 @@ void UIScene_HowToPlay::handleInput(int iPad, int key, bool repeat, bool pressed
if(pressed)
{
// Previous page
- int iPrevPage = ( int )( m_eCurrPage ) - 1;
+ int iPrevPage = static_cast<int>(m_eCurrPage) - 1;
// 4J Stu - Add back for future platforms
#if 0
@@ -247,7 +247,7 @@ void UIScene_HowToPlay::handleInput(int iPad, int key, bool repeat, bool pressed
{
if ( iPrevPage >= 0 )
{
- StartPage( ( EHowToPlayPage )( iPrevPage ) );
+ StartPage( static_cast<EHowToPlayPage>(iPrevPage) );
ui.PlayUISFX(eSFX_Press);
}
@@ -300,8 +300,8 @@ void UIScene_HowToPlay::StartPage( EHowToPlayPage ePage )
finalText = startTags + finalText;
vector<wstring> paragraphs;
- int lastIndex = 0;
- for ( int index = finalText.find(L"\r\n", lastIndex, 2);
+ size_t lastIndex = 0;
+ for ( size_t index = finalText.find(L"\r\n", lastIndex, 2);
index != wstring::npos;
index = finalText.find(L"\r\n", lastIndex, 2)
)
@@ -318,7 +318,7 @@ void UIScene_HowToPlay::StartPage( EHowToPlayPage ePage )
IggyStringUTF16 * stringVal = new IggyStringUTF16[paragraphs.size()];
value[0].type = IGGY_DATATYPE_number;
- value[0].number = gs_pageToFlashMapping[(int)ePage];
+ value[0].number = gs_pageToFlashMapping[static_cast<int>(ePage)];
for(unsigned int i = 0; i < paragraphs.size(); ++i)
{