From 0fb78b557b22fdd5be560bad68ffc3075881f1e3 Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 4 May 2011 14:01:50 +0000 Subject: May have actually broken the hashing -- trying to fix by increasing the bit size to match the map type. --- dbox.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dbox.c b/dbox.c index 7f162a5..af18ccd 100644 --- a/dbox.c +++ b/dbox.c @@ -53,7 +53,7 @@ static const char ident[]="$Id$"; /* ---------------------------------------- TYPES */ typedef unsigned long long map_t; -typedef unsigned long hash_t; +typedef map_t hash_t; typedef char route_t[MAX_ROUTE+1]; typedef enum {SPACE_GL=' ', @@ -616,11 +616,11 @@ static map_t *CreateMap(const level_t *p_level, const state_t *p_state) } -static hash_t ROL(hash_t p_val, int p_bits) +static hash_t ROL(map_t p_val, int p_bits) { while(p_bits--) { - p_val = (p_val >> 31) | (p_val << 1); + p_val = (p_val >> 63) | (p_val << 1); } return p_val; @@ -639,7 +639,7 @@ static hash_t CreateHash(const level_t *p_level, const state_t *p_state) hash = p_state->player.x * p_state->player.y; - for(f = 0; f < p_level->no_boxes; f++) + for(f = 0; f < p_level->height; f++) { hash ^= ROL(m[f], f); } -- cgit v1.2.3