diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-08 19:08:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 18:08:36 -0500 |
| commit | 28614b922fb77149a54da1a87bebfbc98736f296 (patch) | |
| tree | 7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.World/CauldronTile.cpp | |
| parent | 88798b501d0cf6287b6f87acb2592676e3cec58d (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/CauldronTile.cpp')
| -rw-r--r-- | Minecraft.World/CauldronTile.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Minecraft.World/CauldronTile.cpp b/Minecraft.World/CauldronTile.cpp index f7a8d044..c77ebd28 100644 --- a/Minecraft.World/CauldronTile.cpp +++ b/Minecraft.World/CauldronTile.cpp @@ -13,9 +13,9 @@ const wstring CauldronTile::TEXTURE_BOTTOM = L"cauldron_bottom"; CauldronTile::CauldronTile(int id) : Tile(id, Material::metal, isSolidRender()) { - iconInner = NULL; - iconTop = NULL; - iconBottom = NULL; + iconInner = nullptr; + iconTop = nullptr; + iconBottom = nullptr; } Icon *CauldronTile::getTexture(int face, int data) @@ -43,7 +43,7 @@ Icon *CauldronTile::getTexture(const wstring &name) { if (name.compare(TEXTURE_INSIDE) == 0) return Tile::cauldron->iconInner; if (name.compare(TEXTURE_BOTTOM) == 0) return Tile::cauldron->iconBottom; - return NULL; + return nullptr; } void CauldronTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source) @@ -93,7 +93,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr<Player> pla } shared_ptr<ItemInstance> item = player->inventory->getSelected(); - if (item == NULL) + if (item == nullptr) { return true; } @@ -107,7 +107,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr<Player> pla { if (!player->abilities.instabuild) { - player->inventory->setItem(player->inventory->selected, shared_ptr<ItemInstance>(new ItemInstance(Item::bucket_empty))); + player->inventory->setItem(player->inventory->selected, std::make_shared<ItemInstance>(Item::bucket_empty)); } level->setData(x, y, z, 3, Tile::UPDATE_CLIENTS); @@ -119,10 +119,10 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr<Player> pla { if (fillLevel > 0) { - shared_ptr<ItemInstance> potion = shared_ptr<ItemInstance>(new ItemInstance(Item::potion, 1, 0)); + shared_ptr<ItemInstance> potion = std::make_shared<ItemInstance>(Item::potion, 1, 0); if (!player->inventory->add(potion)) { - level->addEntity(shared_ptr<ItemEntity>(new ItemEntity(level, x + 0.5, y + 1.5, z + 0.5, potion))); + level->addEntity(std::make_shared<ItemEntity>(level, x + 0.5, y + 1.5, z + 0.5, potion)); } // 4J Stu - Brought forward change to update inventory when filling bottles with water else if (player->instanceof(eTYPE_SERVERPLAYER)) |
