mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-01 10:53:30 +00:00
CAssetNameMap: Eliminate file-scope string allocations
This commit is contained in:
parent
9925925b6f
commit
7ce0e14e29
@ -1,5 +1,8 @@
|
||||
#include "CAssetNameMap.h"
|
||||
|
||||
constexpr char gkAssetMapPath[] = "resources/gameinfo/AssetNameMap";
|
||||
constexpr char gkAssetMapExt[] = "xml";
|
||||
|
||||
bool CAssetNameMap::LoadAssetNames(TString Path /*= ""*/)
|
||||
{
|
||||
if (Path.IsEmpty())
|
||||
@ -194,11 +197,16 @@ void CAssetNameMap::PostLoadValidate()
|
||||
TString CAssetNameMap::DefaultNameMapPath(EIDLength IDLength)
|
||||
{
|
||||
ASSERT(IDLength != kInvalidIDLength);
|
||||
TString Suffix = (IDLength == EIDLength::k32Bit ? "32" : "64");
|
||||
return gDataDir + gkAssetMapPath + Suffix + "." + gkAssetMapExt;
|
||||
const char* const Suffix = (IDLength == EIDLength::k32Bit ? "32" : "64");
|
||||
return gDataDir + gkAssetMapPath + Suffix + '.' + gkAssetMapExt;
|
||||
}
|
||||
|
||||
TString CAssetNameMap::DefaultNameMapPath(EGame Game)
|
||||
{
|
||||
return DefaultNameMapPath( CAssetID::GameIDLength(Game) );
|
||||
}
|
||||
|
||||
TString CAssetNameMap::GetExtension()
|
||||
{
|
||||
return gkAssetMapExt;
|
||||
}
|
||||
|
@ -8,9 +8,6 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
const TString gkAssetMapPath = "resources/gameinfo/AssetNameMap";
|
||||
const TString gkAssetMapExt = "xml";
|
||||
|
||||
class CAssetNameMap
|
||||
{
|
||||
struct SAssetNameInfo
|
||||
@ -66,8 +63,8 @@ public:
|
||||
static TString DefaultNameMapPath(EIDLength IDLength);
|
||||
static TString DefaultNameMapPath(EGame Game);
|
||||
|
||||
inline bool IsValid() const { return mIsValid; }
|
||||
inline static TString GetExtension() { return gkAssetMapExt; }
|
||||
bool IsValid() const { return mIsValid; }
|
||||
static TString GetExtension();
|
||||
};
|
||||
|
||||
#endif // CASSETNAMEMAP
|
||||
|
Loading…
x
Reference in New Issue
Block a user