aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Biome.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.World/Biome.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.World/Biome.cpp')
-rw-r--r--Minecraft.World/Biome.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp
index 169db77e..66265765 100644
--- a/Minecraft.World/Biome.cpp
+++ b/Minecraft.World/Biome.cpp
@@ -13,34 +13,34 @@
//public static final Biome[] biomes = new Biome[256];
Biome *Biome::biomes[256];
-Biome *Biome::ocean = NULL;
-Biome *Biome::plains = NULL;
-Biome *Biome::desert = NULL;
+Biome *Biome::ocean = nullptr;
+Biome *Biome::plains = nullptr;
+Biome *Biome::desert = nullptr;
-Biome *Biome::extremeHills = NULL;
-Biome *Biome::forest = NULL;
-Biome *Biome::taiga = NULL;
+Biome *Biome::extremeHills = nullptr;
+Biome *Biome::forest = nullptr;
+Biome *Biome::taiga = nullptr;
-Biome *Biome::swampland = NULL;
-Biome *Biome::river = NULL;
+Biome *Biome::swampland = nullptr;
+Biome *Biome::river = nullptr;
-Biome *Biome::hell = NULL;
-Biome *Biome::sky = NULL;
+Biome *Biome::hell = nullptr;
+Biome *Biome::sky = nullptr;
-Biome *Biome::frozenOcean = NULL;
-Biome *Biome::frozenRiver = NULL;
-Biome *Biome::iceFlats = NULL;
-Biome *Biome::iceMountains = NULL;
-Biome *Biome::mushroomIsland = NULL;
-Biome *Biome::mushroomIslandShore = NULL;
-Biome *Biome::beaches = NULL;
-Biome *Biome::desertHills = NULL;
-Biome *Biome::forestHills = NULL;
-Biome *Biome::taigaHills = NULL;
-Biome *Biome::smallerExtremeHills = NULL;
+Biome *Biome::frozenOcean = nullptr;
+Biome *Biome::frozenRiver = nullptr;
+Biome *Biome::iceFlats = nullptr;
+Biome *Biome::iceMountains = nullptr;
+Biome *Biome::mushroomIsland = nullptr;
+Biome *Biome::mushroomIslandShore = nullptr;
+Biome *Biome::beaches = nullptr;
+Biome *Biome::desertHills = nullptr;
+Biome *Biome::forestHills = nullptr;
+Biome *Biome::taigaHills = nullptr;
+Biome *Biome::smallerExtremeHills = nullptr;
-Biome *Biome::jungle = NULL;
-Biome *Biome::jungleHills = NULL;
+Biome *Biome::jungle = nullptr;
+Biome *Biome::jungleHills = nullptr;
void Biome::staticCtor()
@@ -86,8 +86,8 @@ Biome::Biome(int id) : id(id)
color = 0;
// snowCovered = false; // 4J - this isn't set by the java game any more so removing to save confusion
- topMaterial = (byte) Tile::grass_Id;
- material = (byte) Tile::dirt_Id;
+ topMaterial = static_cast<byte>(Tile::grass_Id);
+ material = static_cast<byte>(Tile::dirt_Id);
leafColor = 0x4EE031;
_hasRain = true;
depth = 0.1f;
@@ -95,7 +95,7 @@ Biome::Biome(int id) : id(id)
temperature = 0.5f;
downfall = 0.5f;
//waterColor = 0xffffff; // 4J Stu - Not used
- decorator = NULL;
+ decorator = nullptr;
m_grassColor = eMinecraftColour_NOT_SET;
m_foliageColor = eMinecraftColour_NOT_SET;
@@ -132,7 +132,7 @@ Biome::Biome(int id) : id(id)
Biome::~Biome()
{
- if(decorator != NULL) delete decorator;
+ if(decorator != nullptr) delete decorator;
}
BiomeDecorator *Biome::createDecorator()
@@ -228,7 +228,7 @@ vector<Biome::MobSpawnerData *> *Biome::getMobs(MobCategory *category)
if (category == MobCategory::creature_wolf) return &friendlies_wolf;
if (category == MobCategory::creature_mushroomcow) return &friendlies_mushroomcow;
if (category == MobCategory::ambient) return &ambientFriendlies;
- return NULL;
+ return nullptr;
}
bool Biome::hasSnow()
@@ -261,12 +261,12 @@ float Biome::getCreatureProbability()
int Biome::getDownfallInt()
{
- return (int) (downfall * 65536);
+ return static_cast<int>(downfall * 65536);
}
int Biome::getTemperatureInt()
{
- return (int) (temperature * 65536);
+ return static_cast<int>(temperature * 65536);
}
// 4J - brought forward from 1.2.3