diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-07 21:56:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 09:56:03 +0700 |
| commit | a9be52c41a02d207233199e98898fe7483d7e817 (patch) | |
| tree | 71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.World/Dimension.cpp | |
| parent | 1be5faaea781402e7de06b263eeca4c688b7712c (diff) | |
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
Diffstat (limited to 'Minecraft.World/Dimension.cpp')
| -rw-r--r-- | Minecraft.World/Dimension.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Minecraft.World/Dimension.cpp b/Minecraft.World/Dimension.cpp index 479edae8..b7a2ea7c 100644 --- a/Minecraft.World/Dimension.cpp +++ b/Minecraft.World/Dimension.cpp @@ -30,7 +30,7 @@ void Dimension::updateLightRamp() float ambientLight = 0.00f; for (int i = 0; i <= Level::MAX_BRIGHTNESS; i++) { - float v = (1 - i / (float) (Level::MAX_BRIGHTNESS)); + float v = (1 - i / static_cast<float>(Level::MAX_BRIGHTNESS)); brightnessRamp[i] = ((1 - v) / (v * 3 + 1)) * (1 - ambientLight) + ambientLight; } } @@ -70,7 +70,7 @@ Dimension::~Dimension() { delete[] brightnessRamp; - if(biomeSource != NULL) + if(biomeSource != nullptr) delete biomeSource; } @@ -115,7 +115,7 @@ bool Dimension::isValidSpawn(int x, int z) const float Dimension::getTimeOfDay(int64_t time, float a) const { - int dayStep = (int) (time % Level::TICKS_PER_DAY); + int dayStep = static_cast<int>(time % Level::TICKS_PER_DAY); float td = (dayStep + a) / Level::TICKS_PER_DAY - 0.25f; if (td < 0) td += 1; if (td > 1) td -= 1; @@ -127,7 +127,7 @@ float Dimension::getTimeOfDay(int64_t time, float a) const int Dimension::getMoonPhase(int64_t time) const { - return ((int) (time / Level::TICKS_PER_DAY)) % 8; + return static_cast<int>(time / Level::TICKS_PER_DAY) % 8; } bool Dimension::isNaturalDimension() @@ -161,7 +161,7 @@ float *Dimension::getSunriseColor(float td, float a) return sunriseCol; } - return NULL; + return nullptr; } Vec3 *Dimension::getFogColor(float td, float a) const @@ -192,12 +192,12 @@ Dimension *Dimension::getNew(int id) if (id == 0) return new NormalDimension(); if (id == 1) return new TheEndDimension(); - return NULL; + return nullptr; } float Dimension::getCloudHeight() { - return (float)Level::genDepth; + return static_cast<float>(Level::genDepth); } bool Dimension::hasGround() @@ -207,7 +207,7 @@ bool Dimension::hasGround() Pos *Dimension::getSpawnPos() { - return NULL; + return nullptr; } int Dimension::getSpawnYPosition() |
