mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-23 11:53:52 +00:00
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
This commit is contained in:
parent
88798b501d
commit
28614b922f
1373 changed files with 20086 additions and 19527 deletions
|
|
@ -46,11 +46,11 @@ void TileEntity::setId(tileEntityCreateFn createFn, eINSTANCEOF clas, wstring id
|
|||
|
||||
TileEntity::TileEntity()
|
||||
{
|
||||
level = NULL;
|
||||
level = nullptr;
|
||||
x = y = z = 0;
|
||||
remove = false;
|
||||
data = -1;
|
||||
tile = NULL;
|
||||
tile = nullptr;
|
||||
renderRemoveStage = e_RenderRemoveStageKeep;
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ void TileEntity::setLevel(Level *level)
|
|||
|
||||
bool TileEntity::hasLevel()
|
||||
{
|
||||
return level != NULL;
|
||||
return level != nullptr;
|
||||
}
|
||||
|
||||
void TileEntity::load(CompoundTag *tag)
|
||||
|
|
@ -101,7 +101,7 @@ shared_ptr<TileEntity> TileEntity::loadStatic(CompoundTag *tag)
|
|||
auto it = idCreateMap.find(tag->getString(L"id"));
|
||||
if (it != idCreateMap.end())
|
||||
entity = shared_ptr<TileEntity>(it->second());
|
||||
if (entity != NULL)
|
||||
if (entity != nullptr)
|
||||
{
|
||||
entity->load(tag);
|
||||
}
|
||||
|
|
@ -129,11 +129,11 @@ void TileEntity::setData(int data, int updateFlags)
|
|||
|
||||
void TileEntity::setChanged()
|
||||
{
|
||||
if (level != NULL)
|
||||
if (level != nullptr)
|
||||
{
|
||||
data = level->getData(x, y, z);
|
||||
level->tileEntityChanged(x, y, z, shared_from_this());
|
||||
if (getTile() != NULL) level->updateNeighbourForOutputSignal(x, y, z, getTile()->id);
|
||||
if (getTile() != nullptr) level->updateNeighbourForOutputSignal(x, y, z, getTile()->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ double TileEntity::getViewDistance()
|
|||
|
||||
Tile *TileEntity::getTile()
|
||||
{
|
||||
if( tile == NULL ) tile = Tile::tiles[level->getTile(x, y, z)];
|
||||
if( tile == nullptr ) tile = Tile::tiles[level->getTile(x, y, z)];
|
||||
return tile;
|
||||
}
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ bool TileEntity::triggerEvent(int b0, int b1)
|
|||
|
||||
void TileEntity::clearCache()
|
||||
{
|
||||
tile = NULL;
|
||||
tile = nullptr;
|
||||
data = -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue