Corrected some bugs. Now the algorithm should work for 1-level dependencies.
authorviric@llimona
Sun, 07 May 2006 16:28:04 +0200
changeset 17 7c1e68c17c0e
parent 16 fe078fb2e8b4
child 18 443554b46d2b
Corrected some bugs. Now the algorithm should work for 1-level dependencies.
(that's how it seems)
algorithm.c
general.h
--- a/algorithm.c	Sun May 07 15:28:39 2006 +0200
+++ b/algorithm.c	Sun May 07 16:28:04 2006 +0200
@@ -399,7 +399,7 @@
 		is_not_set_free = TRUE;
 		for(d=0; d<4; d++)
 		{
-			if(m->box_deps[i].dep_dir[d] > 0)
+			if(m->box_deps[i].dep_dir[d] >= 0)
 			{
 				if (!dep.box[i][m->box_deps[i].dep_dir[d]])
 				{
@@ -466,7 +466,7 @@
 	for(i=0; i<new_free.n; i++)
 	{
 		free.box[i] = new_free.box[i];
-		free.box_is_free[i] = TRUE;
+		free.box_is_free[new_free.box[i]] = TRUE;
 	}
 
 	/* KACXO-loop  */
--- a/general.h	Sun May 07 15:28:39 2006 +0200
+++ b/general.h	Sun May 07 16:28:04 2006 +0200
@@ -54,7 +54,7 @@
 struct Map
 {
 	char Cells[MAX_Y][MAX_X]; /* Stores WALLs and PLATFORMs */
-	char cells_boxes[MAX_Y][MAX_X]; /* Stores the box number in that cell */
+	int cells_boxes[MAX_Y][MAX_X]; /* Stores the box number in that cell */
 					/* -1 is NO BOX there */
 	char man_moves[MAX_Y][MAX_X]; /* Stores boxes, walls, MANCANMOVEs */
 /*	int boxes[MAX_Y][MAX_X]; */