1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-17 10:21:11 +00:00

Avoid implicit cast to bool for pointers

This commit is contained in:
elsid 2023-08-18 19:05:52 +02:00
parent bda29819cf
commit 9cebe78a51
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

View File

@ -19,8 +19,8 @@ namespace MWRender
osg::ref_ptr<ESMTerrain::LandObject> LandManager::getLand(ESM::ExteriorCellLocation cellIndex) osg::ref_ptr<ESMTerrain::LandObject> LandManager::getLand(ESM::ExteriorCellLocation cellIndex)
{ {
osg::ref_ptr<osg::Object> obj = mCache->getRefFromObjectCache(cellIndex); const osg::ref_ptr<osg::Object> obj = mCache->getRefFromObjectCache(cellIndex);
if (obj) if (obj != nullptr)
return static_cast<ESMTerrain::LandObject*>(obj.get()); return static_cast<ESMTerrain::LandObject*>(obj.get());
else else
{ {
@ -29,7 +29,7 @@ namespace MWRender
if (ESM::isEsm4Ext(cellIndex.mWorldspace)) if (ESM::isEsm4Ext(cellIndex.mWorldspace))
{ {
const ESM4::Land* land = world.getStore().get<ESM4::Land>().search(cellIndex); const ESM4::Land* land = world.getStore().get<ESM4::Land>().search(cellIndex);
if (!land) if (land == nullptr)
return nullptr; return nullptr;
osg::ref_ptr<ESMTerrain::LandObject> landObj(new ESMTerrain::LandObject(*land, mLoadFlags)); osg::ref_ptr<ESMTerrain::LandObject> landObj(new ESMTerrain::LandObject(*land, mLoadFlags));
mCache->addEntryToObjectCache(cellIndex, landObj.get()); mCache->addEntryToObjectCache(cellIndex, landObj.get());
@ -38,7 +38,7 @@ namespace MWRender
else else
{ {
const ESM::Land* land = world.getStore().get<ESM::Land>().search(cellIndex.mX, cellIndex.mY); const ESM::Land* land = world.getStore().get<ESM::Land>().search(cellIndex.mX, cellIndex.mY);
if (!land) if (land == nullptr)
return nullptr; return nullptr;
osg::ref_ptr<ESMTerrain::LandObject> landObj(new ESMTerrain::LandObject(*land, mLoadFlags)); osg::ref_ptr<ESMTerrain::LandObject> landObj(new ESMTerrain::LandObject(*land, mLoadFlags));
mCache->addEntryToObjectCache(cellIndex, landObj.get()); mCache->addEntryToObjectCache(cellIndex, landObj.get());