Corrected some bugs. Now the algorithm should work for 1-level dependencies.
(that's how it seems)
--- 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]; */