path2.c
来自「国外游戏开发者杂志1997年第六期配套代码」· C语言 代码 · 共 19 行
C
19 行
#include "..\\include\\move.h"
#define __GLOBAL__
#include "..\\include\\globals.h"
#include "..\\include\\prototyp.h"
#define HEURISTIC(x,y,xd,yd) \
(5*((long)(sqrt((x-xd)*(x-xd)+(y-yd)*(y-yd)))))
extern long total_open[],total_iterations[],total_closed[],total_sort[];
extern long direction_cost[];
long current_search_id=0;
unsigned short *fast_path(unit_type *u,long xd,long yd,long *size,long search_mask) {
//This is a version of A* which uses the searchspace for storing its
//nodes. The big advantage is that one iteration takes O(1) instead of
//O(n). For n iterations this then comes to O(n) instead of O(n
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?