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