map.c
changeset 8 b41a580b3abe
parent 6 bfbca2c0fc70
child 10 9148590f009d
--- 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;
+}