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_TIMERSYS
//#define SMEXT_ENABLE_THREADER
//#define SMEXT_ENABLE_LIBSYS
#define SMEXT_ENABLE_LIBSYS
//#define SMEXT_ENABLE_MENUS
//#define SMEXT_ENABLE_ADTFACTORY
//#define SMEXT_ENABLE_PLUGINSYS
+14 -8
View File
@@ -20,26 +20,32 @@
SteamWorksGameData::SteamWorksGameData()
{
char buffer[1];
pGameConf = NULL;
gameconfs->LoadGameConfigFile("steamworks", &pGameConf, buffer, sizeof(buffer));
char buffer[PLATFORM_MAX_PATH];
this->pGameConf = NULL;
/* 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()
{
if (pGameConf != NULL)
if (this->pGameConf != NULL)
{
gameconfs->CloseGameConfigFile(pGameConf);
pGameConf = NULL;
gameconfs->CloseGameConfigFile(this->pGameConf);
this->pGameConf = NULL;
}
}
bool SteamWorksGameData::HasGameData(void) const
{
return (pGameConf != NULL);
return (this->pGameConf != NULL);
}
IGameConfig *SteamWorksGameData::GetGameData(void) const
{
return pGameConf;
return this->pGameConf;
}