From 5e06df6286f30de54027f115c08c94e986bfe73c Mon Sep 17 00:00:00 2001 From: Jan Laupetin Date: Sun, 9 Nov 2025 23:30:43 +0100 Subject: [PATCH] chore: use std::format instead of string concat --- src/ObjLoading/Game/T6/BSP/BSPCreator.cpp | 3 ++- src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp | 14 ++++++++------ .../Game/T6/BSP/Linker/GfxWorldLinker.cpp | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp b/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp index 0ad40e89..98aff9bf 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp +++ b/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp @@ -2,6 +2,7 @@ #include "BSPUtil.h" +#include #include using namespace BSP; @@ -262,7 +263,7 @@ namespace BSP auto bsp = std::make_unique(); bsp->name = mapName; - bsp->bspName = "maps/mp/" + mapName + ".d3dbsp"; + bsp->bspName = std::format("maps/mp/{}.d3dbsp", mapName); loadWorldData(*gfxScene, *bsp, true); loadWorldData(*colScene, *bsp, false); diff --git a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp index 50318c08..52c4cd36 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp @@ -7,6 +7,8 @@ #include "MapEntsLinker.h" #include "SkinnedVertsLinker.h" +#include + using namespace T6; namespace BSP @@ -25,18 +27,18 @@ namespace BSP bool BSPLinker::addDefaultRequiredAssets(const BSPData& bsp) const { - if (m_context.LoadDependency("maps/mp/" + bsp.name + ".gsc") == nullptr) + if (m_context.LoadDependency(std::format("maps/mp/{}.gsc", bsp.name)) == nullptr) return false; - if (m_context.LoadDependency("maps/mp/" + bsp.name + "_amb.gsc") == nullptr) + if (m_context.LoadDependency(std::format("maps/mp/{}_amb.gsc", bsp.name)) == nullptr) return false; - if (m_context.LoadDependency("maps/mp/" + bsp.name + "_fx.gsc") == nullptr) + if (m_context.LoadDependency(std::format("maps/mp/{}_fx.gsc", bsp.name)) == nullptr) return false; - if (m_context.LoadDependency("clientscripts/mp/" + bsp.name + ".csc") == nullptr) + if (m_context.LoadDependency(std::format("clientscripts/mp/{}.csc", bsp.name)) == nullptr) return false; - if (m_context.LoadDependency("clientscripts/mp/" + bsp.name + "_amb.csc") == nullptr) + if (m_context.LoadDependency(std::format("clientscripts/mp/{}_amb.csc", bsp.name)) == nullptr) return false; - if (m_context.LoadDependency("clientscripts/mp/" + bsp.name + "_fx.csc") == nullptr) + if (m_context.LoadDependency(std::format("clientscripts/mp/{}_fx.csc", bsp.name)) == nullptr) return false; addEmptyFootstepTableAsset("default_1st_person"); diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp index ca9d2eed..70bfc43e 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp @@ -5,6 +5,7 @@ #include "Utils/Pack.h" #include +#include using namespace T6; @@ -648,7 +649,7 @@ namespace BSP void GfxWorldLinker::loadSkyBox(const BSPData& projInfo, GfxWorld& gfxWorld) const { - const std::string skyBoxName = "skybox_" + projInfo.name; + const auto skyBoxName = std::format("skybox_{}", projInfo.name); gfxWorld.skyBoxModel = m_memory.Dup(skyBoxName.c_str()); if (m_context.LoadDependency(skyBoxName) == nullptr)