summaryrefslogtreecommitdiff
path: root/dbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbox.c')
-rw-r--r--dbox.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/dbox.c b/dbox.c
index b47fcf1..53a905c 100644
--- a/dbox.c
+++ b/dbox.c
@@ -106,7 +106,6 @@ typedef struct
typedef struct cache_t
{
const state_t *state;
- map_t *map;
struct cache_t *next;
} cache_t;
@@ -486,7 +485,6 @@ static void ClearStates(void)
cache_t *p;
p = g_cache[f]->next;
- free(g_cache[f]->map);
free(g_cache[f]);
g_cache[f] = p;
}
@@ -583,13 +581,11 @@ static void DumpCacheDistribution(void)
static int AddNewState(const level_t *p_level, const state_t *p_state)
{
cache_t *p;
- map_t *map;
map_t hash;
hash = p_state->hash % CACHE_SIZE;
p = g_cache[hash];
- map = CreateMap(p_level, p_state);
while(p)
{
@@ -598,16 +594,18 @@ static int AddNewState(const level_t *p_level, const state_t *p_state)
int f;
map_t check;
- check = 0;
+ check = FALSE;
- for(f = 0; f < p_level->height; f++)
+ for(f = 0; f < p_level->no_boxes && !check; f++)
{
- check |= (map[f] ^ p->map[f]);
+ if (!FindPos(p->state->box, p_level->no_boxes, p_state->box[f]))
+ {
+ check = TRUE;
+ }
}
- if (check == 0)
+ if (!check)
{
- free(map);
return FALSE;
}
}
@@ -618,7 +616,6 @@ static int AddNewState(const level_t *p_level, const state_t *p_state)
p = Grab(sizeof *p);
p->state = p_state;
- p->map = map;
p->next = g_cache[hash];
g_cache[hash] = p;