Example #1
0
cSpringStatsFactory::~cSpringStatsFactory()
{
	LOG("cSpringStats:");
	LOG("  Joining results...");
	JoinResults();
	LOG("  Total %llu chunks went through", m_CombinedStats.m_TotalChunks);

	// Save statistics:
	LOG("  Saving statistics into files:");
	LOG("    Springs.xls");
	SaveTotals("Springs.xls");
	LOG("    BiomeWaterSprings.xls");
	SaveStatistics(m_CombinedStats.m_WaterSprings, "BiomeWaterSprings.xls");
	LOG("    BiomeLavaSprings.xls");
	SaveStatistics(m_CombinedStats.m_LavaSprings, "BiomeLavaSprings.xls");
}
Example #2
0
void STAT_ChangeLevel(const char *newl)
{
	// record the current level's stats.
	StoreLevelStats();

	level_info_t *thisinfo = level.info;
	level_info_t *nextinfo = NULL;
	
	if (strncmp(newl, "enDSeQ", 6))
	{
		level_info_t *l = FindLevelInfo (newl);
		nextinfo = l->CheckLevelRedirect ();
		if (nextinfo == NULL) nextinfo = l;
	}

	if (savestatistics == 1)
	{
		if ((nextinfo == NULL || (nextinfo->flags2 & LEVEL2_ENDGAME)) && StartEpisode != NULL)
		{
			// we reached the end of this episode
			int wad = 0;
			MapData * map = P_OpenMapData(StartEpisode->mEpisodeMap, false);
			if (map != NULL)
			{
				wad = Wads.GetLumpFile(map->lumpnum);
				delete map;
			}
			const char * name = Wads.GetWadName(wad);
			FString section = ExtractFileBase(name) + "." + StartEpisode->mEpisodeMap;
			section.ToUpper();

			const char *ep_name = StartEpisode->mEpisodeName;
			if (*ep_name == '$') ep_name = GStrings[ep_name+1];
			FStatistics *sl = GetStatisticsList(EpisodeStatistics, section, ep_name);

			int statvals[4] = {0,0,0,0};
			FString infostring;
			int validlevels = LevelData.Size();
			for(unsigned i = 0; i < LevelData.Size(); i++)
			{
				statvals[0] += LevelData[i].killcount;
				statvals[1] += LevelData[i].totalkills;
				statvals[2] += LevelData[i].secretcount;
				statvals[3] += LevelData[i].totalsecrets;
			}

			infostring.Format("%4d/%4d, %3d/%3d, %2d", statvals[0], statvals[1], statvals[2], statvals[3], validlevels);
			FSessionStatistics *es = StatisticsEntry(sl, infostring, AdjustTics(level.totaltime));

			for(unsigned i = 0; i < LevelData.Size(); i++)
			{
				FString lsection = LevelData[i].Levelname;
				lsection.ToUpper();
				infostring.Format("%4d/%4d, %3d/%3d",
					 LevelData[i].killcount, LevelData[i].totalkills, LevelData[i].secretcount, LevelData[i].totalsecrets);

				LevelStatEntry(es, lsection, infostring, LevelData[i].leveltime);
			}
			SaveStatistics(statfile, EpisodeStatistics);
		}
	}
	else if (savestatistics == 2)	// todo: handle single level statistics.
	{
	}
}