--- a/os.c Sun May 07 16:31:04 2006 +0200
+++ b/os.c Sun May 07 19:31:05 2006 +0200
@@ -15,6 +15,8 @@
int max_depth_period = 0;
struct Map * actual_map = NULL;
+static FILE *info_handle;
+
void ReadMap(struct Map *M, char *FileName)
{
@@ -109,8 +111,8 @@
for (j = 0; j<Temp.SizeY; j++)
{
for (i=0; i<Temp.SizeX; i++)
- fprintf(stderr,"%c", Temp.Cells[j][i]);
- fprintf(stderr,"\n");
+ fprintf(info_handle,"%c", Temp.Cells[j][i]);
+ fprintf(info_handle,"\n");
}
#if 0
@@ -123,24 +125,24 @@
}
#endif
- fprintf(stderr,"Man is at (%i,%i)\n", Temp.Man.x, Temp.Man.y);
- fprintf(stderr,"Platforms: %i, BoxesInPlatform: %i\n", Temp.NumPlatforms,
+ fprintf(info_handle,"Man is at (%i,%i)\n", Temp.Man.x, Temp.Man.y);
+ fprintf(info_handle,"Platforms: %i, BoxesInPlatform: %i\n", Temp.NumPlatforms,
Temp.NumBoxesInPlatform);
}
void PrintMove(const struct BoxMove b)
{
- fprintf(stderr,"Box: %i, Direction: {%i,%i}\n", b.box, b.dir.x, b.dir.y);
+ fprintf(info_handle,"Box: %i, Direction: {%i,%i}\n", b.box, b.dir.x, b.dir.y);
}
void show_percent_and_map()
{
- fprintf(stderr, "Percent: %2.12f, depth: %i-%i\n", percent_to_show,
+ fprintf(info_handle, "Percent: %2.12f, depth: %i-%i\n", percent_to_show,
min_depth_period, max_depth_period);
if(actual_map != NULL)
ShowMap(actual_map);
- fflush(stderr);
+ fflush(info_handle);
min_depth_period = MAX_STEPS;
max_depth_period = 0;
}
@@ -168,6 +170,7 @@
void init_os()
{
+ info_handle = stdout;
#ifndef DEBUG
program_alarm();
#endif