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
This commit is contained in:
@@ -17,7 +17,7 @@ StemTile::StemTile(int id, Tile *fruit) : Bush(id)
|
||||
float ss = 0.125f;
|
||||
this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss);
|
||||
|
||||
iconAngled = NULL;
|
||||
iconAngled = nullptr;
|
||||
}
|
||||
|
||||
bool StemTile::mayPlaceOn(int tile)
|
||||
@@ -34,7 +34,7 @@ void StemTile::tick(Level *level, int x, int y, int z, Random *random)
|
||||
float growthSpeed = getGrowthSpeed(level, x, y, z);
|
||||
|
||||
// 4J Stu - Brought forward change from 1.2.3 to make fruit more likely to grow
|
||||
if (random->nextInt((int) (25 / growthSpeed) + 1) == 0)
|
||||
if (random->nextInt(static_cast<int>(25 / growthSpeed) + 1) == 0)
|
||||
{
|
||||
int age = level->getData(x, y, z);
|
||||
if (age < 7)
|
||||
@@ -149,10 +149,10 @@ void StemTile::updateDefaultShape()
|
||||
|
||||
void StemTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity) // 4J added forceData, forceEntity param
|
||||
{
|
||||
ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape);
|
||||
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(Tile::tlsIdxShape));
|
||||
tls->yy1 = (level->getData(x, y, z) * 2 + 2) / 16.0f;
|
||||
float ss = 0.125f;
|
||||
setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, (float) tls->yy1, 0.5f + ss);
|
||||
setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, static_cast<float>(tls->yy1), 0.5f + ss);
|
||||
}
|
||||
|
||||
int StemTile::getRenderShape()
|
||||
@@ -184,12 +184,12 @@ void StemTile::spawnResources(Level *level, int x, int y, int z, int data, float
|
||||
return;
|
||||
}
|
||||
|
||||
Item *seed = NULL;
|
||||
Item *seed = nullptr;
|
||||
if (fruit == Tile::pumpkin) seed = Item::seeds_pumpkin;
|
||||
if (fruit == Tile::melon) seed = Item::seeds_melon;
|
||||
if (seed != NULL)
|
||||
if (seed != nullptr)
|
||||
{
|
||||
popResource(level, x, y, z, shared_ptr<ItemInstance>(new ItemInstance(seed)));
|
||||
popResource(level, x, y, z, std::make_shared<ItemInstance>(seed));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user