![]() |
Unuk 1.0
|
00001 #ifndef _NODE_H_ 00002 #define _NODE_H_ 00003 #include <memory.h> 00004 00005 #ifndef NULL 00006 #define NULL 0 00007 #endif 00008 00009 #define NL_ADDOPEN 0 00010 #define NL_STARTOPEN 1 00011 #define NL_DELETEOPEN 2 00012 #define NL_ADDCLOSED 3 00013 00014 #define NC_INITIALADD 0 00015 #define NC_OPENADD_UP 1 00016 #define NC_OPENADD 2 00017 #define NC_CLOSEDADD_UP 3 00018 #define NC_CLOSEADD 4 00019 #define NC_NEWADD 5 00020 00021 class Node { 00022 public: 00023 Node(int posx = -1, int posy = -1) : x(posx), y(posy), id(0), numChildren(0) { 00024 parent = next = NULL; 00025 memset(children, 0, sizeof(children)); 00026 } 00027 00028 // Fitness, goal, heuristic. 00029 int f, g, h; 00030 // Position x and y. 00031 int x, y; 00032 int numChildren; // x*m_rows+y 00033 int id; 00034 00035 Node *parent; 00036 Node *next; 00037 // Square tiles. 00038 Node *children[8]; 00039 }; 00040 00041 struct Stack { 00042 Node *data; 00043 Stack *next; 00044 }; 00045 00046 typedef int(*Func) (Node *, Node *, int, void *); 00047 00048 #endif