Refact GameData, add better error handling for SM verboseness.

This commit is contained in:
KyleSanderson
2014-01-11 12:47:05 -07:00
parent 36607e7dda
commit 25209a093b
2 changed files with 15 additions and 9 deletions
+1 -1
View File
@@ -68,7 +68,7 @@
//#define SMEXT_ENABLE_GAMEHELPERS //#define SMEXT_ENABLE_GAMEHELPERS
//#define SMEXT_ENABLE_TIMERSYS //#define SMEXT_ENABLE_TIMERSYS
//#define SMEXT_ENABLE_THREADER //#define SMEXT_ENABLE_THREADER
//#define SMEXT_ENABLE_LIBSYS #define SMEXT_ENABLE_LIBSYS
//#define SMEXT_ENABLE_MENUS //#define SMEXT_ENABLE_MENUS
//#define SMEXT_ENABLE_ADTFACTORY //#define SMEXT_ENABLE_ADTFACTORY
//#define SMEXT_ENABLE_PLUGINSYS //#define SMEXT_ENABLE_PLUGINSYS
+14 -8
View File
@@ -20,26 +20,32 @@
SteamWorksGameData::SteamWorksGameData() SteamWorksGameData::SteamWorksGameData()
{ {
char buffer[1]; char buffer[PLATFORM_MAX_PATH];
pGameConf = NULL; this->pGameConf = NULL;
gameconfs->LoadGameConfigFile("steamworks", &pGameConf, buffer, sizeof(buffer));
/* LoadGameConfigFile will verbosely error out, we need to check this since it's optional. */
smutils->BuildPath(Path_SM, buffer, sizeof(buffer), "gamedata/steamworks.txt");
if (libsys->PathExists(buffer) && libsys->IsPathFile(buffer))
{
gameconfs->LoadGameConfigFile("steamworks", &this->pGameConf, buffer, sizeof(buffer));
}
} }
SteamWorksGameData::~SteamWorksGameData() SteamWorksGameData::~SteamWorksGameData()
{ {
if (pGameConf != NULL) if (this->pGameConf != NULL)
{ {
gameconfs->CloseGameConfigFile(pGameConf); gameconfs->CloseGameConfigFile(this->pGameConf);
pGameConf = NULL; this->pGameConf = NULL;
} }
} }
bool SteamWorksGameData::HasGameData(void) const bool SteamWorksGameData::HasGameData(void) const
{ {
return (pGameConf != NULL); return (this->pGameConf != NULL);
} }
IGameConfig *SteamWorksGameData::GetGameData(void) const IGameConfig *SteamWorksGameData::GetGameData(void) const
{ {
return pGameConf; return this->pGameConf;
} }