The code compiles with pedantic without warnings.
authorviric@llimona
Sat, 06 May 2006 10:08:41 +0200
changeset 8 b41a580b3abe
parent 7 834620831e7a
child 9 622136ed6c62
The code compiles with pedantic without warnings.
The map functions are better isolated.
algorithm.c
general.h
map.c
os.c
--- a/algorithm.c	Sat May 06 10:08:11 2006 +0200
+++ b/algorithm.c	Sat May 06 10:08:41 2006 +0200
@@ -424,30 +424,6 @@
 	m->Box[move.box] = newpos;
 }
 
-static int is_new_map(struct Map maps[], int depth)
-{
-	struct Map *m;
-	int i;
-
-	m = &maps[depth];
-
-	for(i=0; i<max_depth; i++)
-	{
-		/* No l'hem de comparar amb ell mateix */
-		if (i == depth)
-			continue;
-
-		if (m->NumBoxesInPlatform != maps[i].NumBoxesInPlatform)
-			continue;
-		else
-		{
-			if (!are_boxes_equal(m->Box, maps[i].Box, m->NumBoxes))
-				continue;
-		}
-		return FALSE;
-	}
-	return TRUE;
-}
 
 
 static int search_depth(struct Map maps[], int depth,
--- a/general.h	Sat May 06 10:08:11 2006 +0200
+++ b/general.h	Sat May 06 10:08:41 2006 +0200
@@ -8,7 +8,7 @@
 #define CORNER '-'
 #define MANCANMOVE '+'
 
-//#define DEBUG
+/* #define DEBUG */
 
 enum
 {
@@ -24,7 +24,7 @@
 enum logic
 {
 	TRUE=1,
-	FALSE=0,
+	FALSE=0
 };
 
 struct Position
@@ -72,8 +72,7 @@
 /* Prototypes for map managing */
 
 void CopyMap (struct Map *Mdest, const struct Map *Morig);
-int are_boxes_equal(const struct Position b1[], const struct Position b2[],
-	int n);
+int is_new_map(struct Map maps[], int depth);
 
 /* Prototypes for unix i/o, processes */
 void ReadMap(struct Map *M, char *FileName);
--- a/map.c	Sat May 06 10:08:11 2006 +0200
+++ b/map.c	Sat May 06 10:08:41 2006 +0200
@@ -8,7 +8,7 @@
 	memcpy((void *) Mdest, (void *) Morig, sizeof (struct Map));
 }
 
-int are_boxes_equal(const struct Position b1[], const struct Position b2[],
+static int are_boxes_equal(const struct Position b1[], const struct Position b2[],
 	int n)
 {
 	int i;
@@ -28,3 +28,28 @@
 	return TRUE;
 }
 
+int is_new_map(struct Map maps[], int depth)
+{
+	struct Map *m;
+	int i;
+	extern int max_depth;
+
+	m = &maps[depth];
+
+	for(i=0; i<max_depth; i++)
+	{
+		/* No l'hem de comparar amb ell mateix */
+		if (i == depth)
+			continue;
+
+		if (m->NumBoxesInPlatform != maps[i].NumBoxesInPlatform)
+			continue;
+		else
+		{
+			if (!are_boxes_equal(m->Box, maps[i].Box, m->NumBoxes))
+				continue;
+		}
+		return FALSE;
+	}
+	return TRUE;
+}
--- a/os.c	Sat May 06 10:08:11 2006 +0200
+++ b/os.c	Sat May 06 10:08:41 2006 +0200
@@ -114,7 +114,7 @@
 	}
 
 #if 0
-	// Print Where the man can move
+	/* Print Where the man can move */
 	for (j = 0; j<Temp.SizeY; j++)
 	{
 		for (i=0; i<Temp.SizeX; i++)