mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-22 21:02:07 +00:00
chore: replace explicit nullptr checks with negation checks
This commit is contained in:
@@ -27,18 +27,18 @@ namespace BSP
|
||||
|
||||
bool BSPLinker::addDefaultRequiredAssets(const BSPData& bsp) const
|
||||
{
|
||||
if (m_context.LoadDependency<AssetScript>(std::format("maps/mp/{}.gsc", bsp.name)) == nullptr)
|
||||
if (!m_context.LoadDependency<AssetScript>(std::format("maps/mp/{}.gsc", bsp.name)))
|
||||
return false;
|
||||
if (m_context.LoadDependency<AssetScript>(std::format("maps/mp/{}_amb.gsc", bsp.name)) == nullptr)
|
||||
if (!m_context.LoadDependency<AssetScript>(std::format("maps/mp/{}_amb.gsc", bsp.name)))
|
||||
return false;
|
||||
if (m_context.LoadDependency<AssetScript>(std::format("maps/mp/{}_fx.gsc", bsp.name)) == nullptr)
|
||||
if (!m_context.LoadDependency<AssetScript>(std::format("maps/mp/{}_fx.gsc", bsp.name)))
|
||||
return false;
|
||||
|
||||
if (m_context.LoadDependency<AssetScript>(std::format("clientscripts/mp/{}.csc", bsp.name)) == nullptr)
|
||||
if (!m_context.LoadDependency<AssetScript>(std::format("clientscripts/mp/{}.csc", bsp.name)))
|
||||
return false;
|
||||
if (m_context.LoadDependency<AssetScript>(std::format("clientscripts/mp/{}_amb.csc", bsp.name)) == nullptr)
|
||||
if (!m_context.LoadDependency<AssetScript>(std::format("clientscripts/mp/{}_amb.csc", bsp.name)))
|
||||
return false;
|
||||
if (m_context.LoadDependency<AssetScript>(std::format("clientscripts/mp/{}_fx.csc", bsp.name)) == nullptr)
|
||||
if (!m_context.LoadDependency<AssetScript>(std::format("clientscripts/mp/{}_fx.csc", bsp.name)))
|
||||
return false;
|
||||
|
||||
addEmptyFootstepTableAsset("default_1st_person");
|
||||
@@ -48,7 +48,7 @@ namespace BSP
|
||||
addEmptyFootstepTableAsset("default_3rd_person_loud");
|
||||
addEmptyFootstepTableAsset("default_ai");
|
||||
|
||||
if (m_context.LoadDependency<AssetRawFile>("animtrees/fxanim_props.atr") == nullptr)
|
||||
if (!m_context.LoadDependency<AssetRawFile>("animtrees/fxanim_props.atr"))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -74,32 +74,32 @@ namespace BSP
|
||||
SkinnedVertsLinker skinnedVertsLinker(m_memory, m_search_path, m_context);
|
||||
|
||||
auto* comWorld = comWorldLinker.linkComWorld(bsp);
|
||||
if (comWorld == nullptr)
|
||||
if (!comWorld)
|
||||
return false;
|
||||
m_context.AddAsset<AssetComWorld>(comWorld->name, comWorld);
|
||||
|
||||
auto* mapEnts = mapEntsLinker.linkMapEnts(bsp);
|
||||
if (mapEnts == nullptr)
|
||||
if (!mapEnts)
|
||||
return false;
|
||||
m_context.AddAsset<AssetMapEnts>(mapEnts->name, mapEnts);
|
||||
|
||||
auto* gameWorldMp = gameWorldMpLinker.linkGameWorldMp(bsp);
|
||||
if (gameWorldMp == nullptr)
|
||||
if (!gameWorldMp)
|
||||
return false;
|
||||
m_context.AddAsset<AssetGameWorldMp>(gameWorldMp->name, gameWorldMp);
|
||||
|
||||
auto* skinnedVerts = skinnedVertsLinker.linkSkinnedVerts(bsp);
|
||||
if (skinnedVerts == nullptr)
|
||||
if (!skinnedVerts)
|
||||
return false;
|
||||
m_context.AddAsset<AssetSkinnedVerts>(skinnedVerts->name, skinnedVerts);
|
||||
|
||||
auto* gfxWorld = gfxWorldLinker.linkGfxWorld(bsp); // requires mapents asset
|
||||
if (gfxWorld == nullptr)
|
||||
if (!gfxWorld)
|
||||
return false;
|
||||
m_context.AddAsset<AssetGfxWorld>(gfxWorld->name, gfxWorld);
|
||||
|
||||
auto* clipMap = clipMapLinker.linkClipMap(bsp); // requires gfxworld and mapents asset
|
||||
if (clipMap == nullptr)
|
||||
if (!clipMap)
|
||||
return false;
|
||||
m_context.AddAsset<AssetClipMap>(clipMap->name, clipMap);
|
||||
|
||||
|
||||
@@ -87,11 +87,11 @@ namespace BSP
|
||||
surfMaterialName = BSPLinkingConstants::COLOR_ONLY_IMAGE_NAME;
|
||||
|
||||
auto surfMaterialAsset = m_context.LoadDependency<AssetMaterial>(surfMaterialName);
|
||||
if (surfMaterialAsset == nullptr)
|
||||
if (!surfMaterialAsset)
|
||||
{
|
||||
std::string missingImageName = BSPLinkingConstants::MISSING_IMAGE_NAME;
|
||||
surfMaterialAsset = m_context.LoadDependency<AssetMaterial>(missingImageName);
|
||||
if (surfMaterialAsset == nullptr)
|
||||
if (!surfMaterialAsset)
|
||||
{
|
||||
con::error("unable to load the missing image texture {}!", missingImageName);
|
||||
return false;
|
||||
@@ -174,7 +174,7 @@ namespace BSP
|
||||
customMapModel* inModel = &projInfo->models[i];
|
||||
|
||||
auto xModelAsset = m_context.LoadDependency<AssetXModel>(inModel->name);
|
||||
if (xModelAsset == nullptr)
|
||||
if (!xModelAsset)
|
||||
{
|
||||
printf("XModel %s not found!\n", inModel->name.c_str());
|
||||
currModel->model = nullptr;
|
||||
@@ -616,7 +616,7 @@ namespace BSP
|
||||
|
||||
std::string probeImageName = "reflection_probe0";
|
||||
auto probeImageAsset = m_context.LoadDependency<AssetImage>(probeImageName);
|
||||
if (probeImageAsset == nullptr)
|
||||
if (!probeImageAsset)
|
||||
{
|
||||
con::error("ERROR! unable to find reflection probe image {}!", probeImageName);
|
||||
return false;
|
||||
@@ -635,7 +635,7 @@ namespace BSP
|
||||
|
||||
std::string secondaryTexture = "lightmap0_secondary";
|
||||
auto secondaryTextureAsset = m_context.LoadDependency<AssetImage>(secondaryTexture);
|
||||
if (secondaryTextureAsset == nullptr)
|
||||
if (!secondaryTextureAsset)
|
||||
{
|
||||
con::error("ERROR! unable to find lightmap image {}!", secondaryTexture);
|
||||
return false;
|
||||
@@ -652,7 +652,7 @@ namespace BSP
|
||||
const auto skyBoxName = std::format("skybox_{}", projInfo.name);
|
||||
gfxWorld.skyBoxModel = m_memory.Dup(skyBoxName.c_str());
|
||||
|
||||
if (m_context.LoadDependency<AssetXModel>(skyBoxName) == nullptr)
|
||||
if (!m_context.LoadDependency<AssetXModel>(skyBoxName))
|
||||
{
|
||||
con::warn("WARN: Unable to load the skybox xmodel {}!", skyBoxName);
|
||||
}
|
||||
@@ -719,7 +719,7 @@ namespace BSP
|
||||
|
||||
const std::string outdoorImageName = std::string("$outdoor");
|
||||
auto outdoorImageAsset = m_context.LoadDependency<AssetImage>(outdoorImageName);
|
||||
if (outdoorImageAsset == nullptr)
|
||||
if (!outdoorImageAsset)
|
||||
{
|
||||
con::error("ERROR! unable to find outdoor image $outdoor!");
|
||||
return false;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace
|
||||
bool FinalizeZone(AssetCreationContext& context) override
|
||||
{
|
||||
const auto bsp = BSP::createBSPData(m_zone.m_name, m_search_path);
|
||||
if (bsp == nullptr)
|
||||
if (!bsp)
|
||||
return false;
|
||||
|
||||
BSPLinker linker(m_memory, m_search_path, context);
|
||||
|
||||
Reference in New Issue
Block a user