00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __MOVEMENTCACHE_H__
00022 #define __MOVEMENTCACHE_H__
00023
00024 class voxel_c;
00025 class problem_c;
00026 class gridType_c;
00027
00044 class movementCache_c {
00045
00046 private:
00047
00051 typedef struct moEntry {
00052
00053 int dx;
00054 int dy;
00055 int dz;
00056
00057 unsigned int s1;
00058 unsigned int s2;
00059
00060
00061
00062
00063
00064
00065 unsigned short t1;
00066 unsigned short t2;
00067
00069 unsigned int * move;
00070
00072 struct moEntry * next;
00073
00074 } moEntry;
00075
00077 moEntry ** moHash;
00078
00079 unsigned int moTableSize;
00080 unsigned int moEntries;
00081
00087 const voxel_c *** shapes;
00088
00090 unsigned int * pieces;
00091
00093 unsigned int num_shapes;
00094
00096 unsigned int num_transformations;
00097
00098 void moRehash(void);
00099
00101 virtual unsigned int* moCalcValues(const voxel_c * sh1, const voxel_c * sh2, int dx, int dy, int dz) = 0;
00102
00104 const gridType_c * gt;
00105
00107 const voxel_c * getTransformedShape(unsigned int s, unsigned char t);
00108
00109 public:
00110
00114 movementCache_c(const problem_c * puz);
00115
00116 virtual ~movementCache_c(void);
00117
00125 void getMoValue(int dx, int dy, int dz, unsigned char t1, unsigned char t2, unsigned int p1, unsigned int p2, unsigned int * movements);
00126
00131 virtual unsigned int numDirections(void) = 0;
00132
00134 virtual void getDirection(unsigned int dir, int * x, int * y, int * z) = 0;
00135
00136 private:
00137
00138
00139 movementCache_c(const movementCache_c&);
00140 void operator=(const movementCache_c&);
00141 };
00142
00143 #endif