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:
@@ -109,7 +109,7 @@ bool StructureFeature::isIntersection(int cellX, int cellZ)
|
||||
bool StructureFeature::isInsideFeature(int cellX, int cellY, int cellZ)
|
||||
{
|
||||
restoreSavedData(level);
|
||||
return getStructureAt(cellX, cellY, cellZ) != NULL;
|
||||
return getStructureAt(cellX, cellY, cellZ) != nullptr;
|
||||
}
|
||||
|
||||
StructureStart *StructureFeature::getStructureAt(int cellX, int cellY, int cellZ)
|
||||
@@ -142,7 +142,7 @@ StructureStart *StructureFeature::getStructureAt(int cellX, int cellY, int cellZ
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool StructureFeature::isInsideBoundingFeature(int cellX, int cellY, int cellZ)
|
||||
@@ -178,7 +178,7 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i
|
||||
addFeature(level, cellX >> 4, cellZ >> 4, 0, 0, byteArray());
|
||||
|
||||
double minDistance = DBL_MAX;
|
||||
TilePos *selected = NULL;
|
||||
TilePos *selected = nullptr;
|
||||
|
||||
for(auto& it : cachedStructures)
|
||||
{
|
||||
@@ -203,14 +203,14 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i
|
||||
}
|
||||
}
|
||||
}
|
||||
if (selected != NULL)
|
||||
if (selected != nullptr)
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
else
|
||||
{
|
||||
vector<TilePos> *guesstimatedFeaturePositions = getGuesstimatedFeaturePositions();
|
||||
if (guesstimatedFeaturePositions != NULL)
|
||||
if (guesstimatedFeaturePositions != nullptr)
|
||||
{
|
||||
TilePos *pSelectedPos = new TilePos(0,0,0);
|
||||
|
||||
@@ -233,22 +233,22 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i
|
||||
return pSelectedPos;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vector<TilePos> *StructureFeature::getGuesstimatedFeaturePositions()
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void StructureFeature::restoreSavedData(Level *level)
|
||||
{
|
||||
#ifdef ENABLE_STRUCTURE_SAVING
|
||||
if (savedData == NULL)
|
||||
if (savedData == nullptr)
|
||||
{
|
||||
savedData = dynamic_pointer_cast<StructureFeatureSavedData>( level->getSavedData(typeid(StructureFeatureSavedData), getFeatureName()) );
|
||||
|
||||
if (savedData == NULL)
|
||||
if (savedData == nullptr)
|
||||
{
|
||||
savedData = shared_ptr<StructureFeatureSavedData>( new StructureFeatureSavedData(getFeatureName()) );
|
||||
level->setSavedData(getFeatureName(), savedData);
|
||||
|
||||
Reference in New Issue
Block a user