aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/StatsScreen.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/StatsScreen.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/StatsScreen.cpp')
-rw-r--r--Minecraft.Client/StatsScreen.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/Minecraft.Client/StatsScreen.cpp b/Minecraft.Client/StatsScreen.cpp
index 01d041f0..c618a30f 100644
--- a/Minecraft.Client/StatsScreen.cpp
+++ b/Minecraft.Client/StatsScreen.cpp
@@ -10,15 +10,15 @@
#include "..\Minecraft.World\net.minecraft.world.item.h"
const float StatsScreen::SLOT_TEX_SIZE = 128.0f;
-ItemRenderer *StatsScreen::itemRenderer = NULL;
+ItemRenderer *StatsScreen::itemRenderer = nullptr;
StatsScreen::StatsScreen(Screen *lastScreen, StatsCounter *stats)
{
// 4J - added initialisers
itemRenderer = new ItemRenderer();
- statsList = NULL;
- itemStatsList = NULL;
- blockStatsList = NULL;
+ statsList = nullptr;
+ itemStatsList = nullptr;
+ blockStatsList = nullptr;
this->lastScreen = lastScreen;
this->stats = stats;
}
@@ -107,7 +107,7 @@ StatsScreen::GeneralStatisticsList::GeneralStatisticsList(StatsScreen *ss) : Scr
int StatsScreen::GeneralStatisticsList::getNumberOfItems()
{
- return (int)Stats::generalStats->size();
+ return static_cast<int>(Stats::generalStats->size());
}
void StatsScreen::GeneralStatisticsList::selectItem(int item, bool doubleClick)
@@ -293,7 +293,7 @@ void StatsScreen::StatisticsList::clickedHeader(int headerMouseX, int headerMous
int StatsScreen::StatisticsList::getNumberOfItems()
{
- return (int)statItemList.size();
+ return static_cast<int>(statItemList.size());
}
ItemStat *StatsScreen::StatisticsList::getSlotStat(int slot)
@@ -303,7 +303,7 @@ ItemStat *StatsScreen::StatisticsList::getSlotStat(int slot)
void StatsScreen::StatisticsList::renderStat(ItemStat *stat, int x, int y, bool shaded)
{
- if (stat != NULL)
+ if (stat != nullptr)
{
wstring msg = stat->format(parent->stats->getTotalValue(stat));
parent->drawString(parent->font, msg, x - parent->font->width(msg), y + SLOT_TEXT_OFFSET, shaded ? 0xffffff : 0x909090);
@@ -373,7 +373,7 @@ void StatsScreen::StatisticsList::renderMousehoverTooltip(ItemStat *stat, int x,
{
// 4J Stu - Unused
#if 0
- if (stat == NULL)
+ if (stat == nullptr)
{
return;
}
@@ -429,11 +429,11 @@ StatsScreen::ItemStatisticsList::ItemStatisticsList(StatsScreen *ss) : StatsScre
{
addToList = true;
}
- else if (Stats::itemBroke[id] != NULL && parent->stats->getTotalValue(Stats::itemBroke[id]) > 0)
+ else if (Stats::itemBroke[id] != nullptr && parent->stats->getTotalValue(Stats::itemBroke[id]) > 0)
{
addToList = true;
}
- else if (Stats::itemCrafted[id] != NULL && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0)
+ else if (Stats::itemCrafted[id] != nullptr && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0)
{
addToList = true;
}
@@ -556,11 +556,11 @@ StatsScreen::BlockStatisticsList::BlockStatisticsList(StatsScreen *ss) : Statist
{
addToList = true;
}
- else if (Stats::itemUsed[id] != NULL && parent->stats->getTotalValue(Stats::itemUsed[id]) > 0)
+ else if (Stats::itemUsed[id] != nullptr && parent->stats->getTotalValue(Stats::itemUsed[id]) > 0)
{
addToList = true;
}
- else if (Stats::itemCrafted[id] != NULL && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0)
+ else if (Stats::itemCrafted[id] != nullptr && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0)
{
addToList = true;
}