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 <Common/FileUtil.h>
|
||||
|
||||
constexpr char gkGameInfoDir[] = "resources/gameinfo";
|
||||
constexpr char gkGameInfoExt[] = "xml";
|
||||
|
||||
bool CGameInfo::LoadGameInfo(EGame Game)
|
||||
{
|
||||
Game = RoundGame(Game);
|
||||
|
@ -86,3 +89,8 @@ TString CGameInfo::GetDefaultGameInfoPath(EGame Game)
|
|||
TString GameName = GetGameShortName(Game);
|
||||
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 <map>
|
||||
|
||||
const TString gkGameInfoDir = "resources/gameinfo";
|
||||
const TString gkGameInfoExt = "xml";
|
||||
|
||||
//@todo merge this class into CGameTemplate
|
||||
// they serve similar purposes, no real reason for them to be different classes
|
||||
class CGameInfo
|
||||
|
@ -50,14 +47,14 @@ public:
|
|||
TString GetAreaName(const CAssetID& rkID) const;
|
||||
|
||||
// Accessors
|
||||
inline EGame Game() const { return mGame; }
|
||||
EGame Game() const { return mGame; }
|
||||
|
||||
// Static
|
||||
static CGameInfo* GetGameInfo(EGame Game);
|
||||
static EGame RoundGame(EGame Game);
|
||||
static TString GetDefaultGameInfoPath(EGame Game);
|
||||
|
||||
inline static TString GetExtension() { return gkGameInfoExt; }
|
||||
static TString GetExtension();
|
||||
};
|
||||
|
||||
#endif // CGAMEINFO
|
||||
|
|
Loading…
Reference in New Issue