Apply review requests

This commit is contained in:
Gymnasiast 2021-03-31 19:15:33 +02:00
parent b3bbdcbfd5
commit b627dbd3a4
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
4 changed files with 5 additions and 15 deletions

View File

@ -304,7 +304,7 @@ std::unique_ptr<IStream> ObjectAsset::GetStream() const
ObjectEntryDescriptor::ObjectEntryDescriptor(const ObjectRepositoryItem& ori)
{
if (ori.Identifier != "")
if (!ori.Identifier.empty())
{
Generation = ObjectGeneration::JSON;
Identifier = std::string(ori.Identifier);

View File

@ -63,12 +63,7 @@ void TerrainEdgeObject::ReadJson(IReadObjectContext* context, json_t& root)
TerrainEdgeObject* TerrainEdgeObject::GetById(ObjectEntryIndex entryIndex)
{
TerrainEdgeObject* result = nullptr;
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
auto obj = objMgr.GetLoadedObject(ObjectType::TerrainSurface, entryIndex);
if (obj != nullptr)
{
result = static_cast<TerrainEdgeObject*>(obj);
}
return result;
return obj != nullptr ? static_cast<TerrainEdgeObject*>(obj) : nullptr;
}

View File

@ -150,12 +150,7 @@ uint32_t TerrainSurfaceObject::GetImageId(
TerrainSurfaceObject* TerrainSurfaceObject::GetById(ObjectEntryIndex entryIndex)
{
TerrainSurfaceObject* result = nullptr;
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
auto obj = objMgr.GetLoadedObject(ObjectType::TerrainSurface, entryIndex);
if (obj != nullptr)
{
result = static_cast<TerrainSurfaceObject*>(obj);
}
return result;
return obj != nullptr ? static_cast<TerrainSurfaceObject*>(obj) : nullptr;
}

View File

@ -145,10 +145,10 @@ void mapgen_generate(mapgen_settings* settings)
const auto selectedEdge = TerrainEdgeObject::GetById(settings->wall);
std::string edgeTexture = selectedFloor != nullptr ? std::string(selectedEdge->GetIdentifier()) : "";
if (floorTexture == "")
if (floorTexture.empty())
floorTexture = BaseTerrain[util_rand() % std::size(BaseTerrain)];
if (edgeTexture == "")
if (edgeTexture.empty())
{
// Base edge type on surface type
if (floorTexture == "rct2.surface.dirt")