File: writepiles.cpp

package info (click to toggle)
pilercr 1.06%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 844 kB
  • sloc: cpp: 14,339; makefile: 67; sh: 36
file content (30 lines) | stat: -rwxr-xr-x 710 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "pilercr.h"

void WritePiles()
	{
	const char *FileName = ValueOpt("piles");
	if (FileName == 0)
		return;
	FILE *f = OpenStdioFile(FileName, FILEIO_MODE_WriteOnly);

	ProgressStart("Writing piles");
	for (int PileIndex = 0; PileIndex < g_PileCount; ++PileIndex)
		{
		if (PileIndex%100 == 0)
			ProgressStep(PileIndex, g_PileCount);

		PileData &Pile = g_Piles[PileIndex];
		IntVec &HitIndexes = Pile.HitIndexes;
		for_CIntVec(HitIndexes, p)
			{
			int HitIndex = *p;
			const DPHit &Hit = GetHit(HitIndex);
			char Annot[128];
			sprintf(Annot, "Hit(%d) ; Pile(%d)", HitIndex, PileIndex);
			WriteDPHit(f, Hit, false, Annot);
			}
		}
	ProgressDone();

	fclose(f);
	}