Merge pull request #32 from lioncash/str
CGameInfo: Make file-scope strings non-allocating
This commit is contained in:
commit
4f289193bb
|
@ -2,6 +2,9 @@
|
||||||
#include "CResourceStore.h"
|
#include "CResourceStore.h"
|
||||||
#include <Common/FileUtil.h>
|
#include <Common/FileUtil.h>
|
||||||
|
|
||||||
|
constexpr char gkGameInfoDir[] = "resources/gameinfo";
|
||||||
|
constexpr char gkGameInfoExt[] = "xml";
|
||||||
|
|
||||||
bool CGameInfo::LoadGameInfo(EGame Game)
|
bool CGameInfo::LoadGameInfo(EGame Game)
|
||||||
{
|
{
|
||||||
Game = RoundGame(Game);
|
Game = RoundGame(Game);
|
||||||
|
@ -86,3 +89,8 @@ TString CGameInfo::GetDefaultGameInfoPath(EGame Game)
|
||||||
TString GameName = GetGameShortName(Game);
|
TString GameName = GetGameShortName(Game);
|
||||||
return TString::Format("%s/%s/GameInfo%s.%s", *gDataDir, *gkGameInfoDir, *GameName, *gkGameInfoExt);
|
return TString::Format("%s/%s/GameInfo%s.%s", *gDataDir, *gkGameInfoDir, *GameName, *gkGameInfoExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TString CGameInfo::GetExtension()
|
||||||
|
{
|
||||||
|
return gkGameInfoExt;
|
||||||
|
}
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
#include <Common/Serialization/XML.h>
|
#include <Common/Serialization/XML.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
const TString gkGameInfoDir = "resources/gameinfo";
|
|
||||||
const TString gkGameInfoExt = "xml";
|
|
||||||
|
|
||||||
//@todo merge this class into CGameTemplate
|
//@todo merge this class into CGameTemplate
|
||||||
// they serve similar purposes, no real reason for them to be different classes
|
// they serve similar purposes, no real reason for them to be different classes
|
||||||
class CGameInfo
|
class CGameInfo
|
||||||
|
@ -50,14 +47,14 @@ public:
|
||||||
TString GetAreaName(const CAssetID& rkID) const;
|
TString GetAreaName(const CAssetID& rkID) const;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline EGame Game() const { return mGame; }
|
EGame Game() const { return mGame; }
|
||||||
|
|
||||||
// Static
|
// Static
|
||||||
static CGameInfo* GetGameInfo(EGame Game);
|
static CGameInfo* GetGameInfo(EGame Game);
|
||||||
static EGame RoundGame(EGame Game);
|
static EGame RoundGame(EGame Game);
|
||||||
static TString GetDefaultGameInfoPath(EGame Game);
|
static TString GetDefaultGameInfoPath(EGame Game);
|
||||||
|
|
||||||
inline static TString GetExtension() { return gkGameInfoExt; }
|
static TString GetExtension();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CGAMEINFO
|
#endif // CGAMEINFO
|
||||||
|
|
Loading…
Reference in New Issue