Example #1
0
void FiveGameInit::ReloadGame()
{
	AddCrashometry("reload_game", "true");

	//g_shouldReloadGame = true;
	m_gameLoaded = false;

	g_isNetworkKilled = false;

	ClearVariable("gameKilled");
}
Example #2
0
int CGenerator::Generate()
{
  // init file pointers for output files
  for (int n=0; n<eFileCount; ++n)
  {
    if (!mFileNames[n].empty())
    {
      mOutputFiles[n] = fopen(mFileNames[n].c_str(), "w");
    }
  }

  // write header
  header();

  // write per file headers
  {for (lstSourceFilesCtrType ctr=mlstSourceFiles.begin(); ctr!=mlstSourceFiles.end(); ctr++)
  {
    SetVariable(VAR_HEADERFILE, ctr->c_str());
    headerfile();
  }}
  ClearVariable(VAR_HEADERFILE);

  // :TODO: parser internal, put this into the parser
  // init this to the default, if no alias is set
  SetVariable(CGenerator::VAR_ITEM, mpszItem);
  SetVariable(CGenerator::VAR_ID,   mpszId);
  // :TODO: pass this as param to yyparse
  spGenerator = this;

  int nRetVal = 0;

  // parse files and create the main work
  {for (lstSourceFilesCtrType ctr=mlstSourceFiles.begin(); nRetVal==0 && ctr!=mlstSourceFiles.end(); ctr++)
  {
    SetVariable(VAR_HEADERFILE, ctr->c_str());
    #if YYDEBUG
      yydebug   = 1;
    #endif

    FILE * fParse = fopen(ctr->c_str(), "r");
    if (fParse)
    {
      yyrestart(fParse);
      nRetVal = yyparse();
      fclose(fParse);
    }
    else
    {
      printf("error: could not open file %s\n", ctr->c_str());
      nRetVal = -1;
    }
  }}
  ClearVariable(VAR_HEADERFILE);

  // remove the parsers pointer to the generator
  spGenerator = NULL;

  // write per file footers
  {for (lstSourceFilesCtrType ctr=mlstSourceFiles.begin(); ctr!=mlstSourceFiles.end(); ctr++)
  {
    SetVariable(VAR_HEADERFILE, ctr->c_str());
    footerfile();
  }}
  ClearVariable(VAR_HEADERFILE);

  // write footer
  footer();

  // close files
  for (int n=0; n<eFileCount; ++n)
  {
    if (mOutputFiles[n] != 0)
    {
      fclose(mOutputFiles[n]);
      mOutputFiles[n] = 0;
    }
  }

  return nRetVal;
}