diff options
author | Ian C <ianc@noddybox.co.uk> | 2011-05-04 14:01:50 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2011-05-04 14:01:50 +0000 |
commit | 0fb78b557b22fdd5be560bad68ffc3075881f1e3 (patch) | |
tree | 5c39675628a398b93f4944ef93f29c854feb4263 | |
parent | 1deeb2c5b0a33fa4b26158d4b2f5701556fb1d59 (diff) |
May have actually broken the hashing -- trying to fix by increasing the bit
size to match the map type.
-rw-r--r-- | dbox.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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); } |