|
SDLGameEngine
|
00001 #ifndef _SGEPATHFINDER_H 00002 #define _SGEPATHFINDER_H 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00012 /* 00013 * Copyright (c) 2007 Heiko Irrgang 00014 * 00015 * The license and distribution terms for this file may be 00016 * found in the file COPYING in this distribution or at 00017 * http://93-interactive.com/cms/products/software/sdl-game-engine/license/ 00018 */ 00019 00033 #define DISABLE_DIAGONAL 0 00034 00038 #define ENABLE_DIAGONAL 1 00039 00046 typedef struct { 00048 int x; 00050 int y; 00052 int startWeight; 00053 int targetWeight; 00054 void *parent; 00055 } SGEPATHFINDERINFO; 00056 00061 typedef struct { 00063 int width; 00065 int height; 00067 unsigned char *map; 00068 SGEARRAY *path; 00069 int useDiagonal; 00070 } SGEPATHFINDER; 00071 00078 SGEPATHFINDER *sgePathFinderNew(int width, int height); 00079 00087 SGEPATHFINDER *sgePathFinderNewDiagonal(int width, int height, int diagonal); 00088 00093 void sgePathFinderDestroy(SGEPATHFINDER *p); 00094 00104 SGEPATHFINDERINFO *sgePathFinderInfoNew(int x, int y, int startWeight, int targetWeight, void *parent); 00105 00110 void sgePathFinderInfoDestroy(SGEPATHFINDERINFO *pi); 00111 00117 inline void sgePathFinderDiagonal(SGEPATHFINDER *p, int diagonal); 00118 00126 void sgePathFinderSet(SGEPATHFINDER *p, int x, int y, int value); 00127 00135 int sgePathFinderGet(SGEPATHFINDER *p, int x, int y); 00136 00149 int sgePathFinderFind(SGEPATHFINDER *p, int startx, int starty, int destx, int desty); 00150 00151 // }@ 00152 00153 #ifdef __cplusplus 00154 } 00155 #endif 00156 00157 #endif