src/hcode/include/spath.h

Go to the documentation of this file.
00001 
00002 /*
00003  * $Id: spath.h,v 1.1 2005/06/13 20:50:53 murrayma Exp $
00004  *
00005  * Last modified: Sat Jun  6 20:57:26 1998 fingon
00006  *
00007  */
00008 
00009 #ifndef SPATH_H
00010 #define SPATH_H
00011 
00012 #define HEX_BASED
00013 #undef APPROXIMATE_ASTAR
00014 
00015 /* note the cols should be 2 more than the screen size because if we
00016  * have a point at the extremes and we check to see if we can go in
00017  * all directions, we don't need a special case to check these. (same
00018  * for rows) */
00019 
00020 typedef struct {
00021     int *coords;
00022     int coordcount;
00023     int iterations;
00024     int score;
00025 } SPATHRESULT;
00026 
00027 void FreePath(SPATHRESULT * res);
00028 SPATHRESULT *CalculatePath(int x1, int y1, int x2, int y2, int errper);
00029 
00030 
00031 #ifdef _SPATH_C
00032 
00033 
00034 #ifdef HEX_BASED
00035 #define NBCOUNT 6
00036 #else
00037 #define NBCOUNT 8
00038 #endif
00039 
00040 typedef struct NODETYPE {
00041     int x, y;
00042     int f, h, g;
00043     int NodeNum;
00044     struct NODETYPE *Parent;
00045     struct NODETYPE *Child[NBCOUNT];    /* a node may have upto NBC children. */
00046     struct NODETYPE *next;      /* for filing purposes */
00047 } NODE;
00048 
00049 
00050 #define TileNum(x,y) ((x) + ((y) << 16))
00051 
00052 /**************************************************************************/
00053 
00054 /*                                 STACK                                  */
00055 
00056 /**************************************************************************/
00057 typedef struct STACKTYPE {
00058     NODE *Node;
00059     struct STACKTYPE *Next;
00060 } MYSTACK;
00061 
00062 #endif
00063 #include "p.spath.h"
00064 
00065 #endif                          /* SPATH_H */

Generated on Mon May 28 04:25:24 2007 for BattletechMUX by  doxygen 1.4.7