]> git.pond.sub.org Git - empserver/blob - include/path.h
6c3d47e96f27e1f245f48331d4eff192085f8d1d
[empserver] / include / path.h
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2017, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                Ken Stevens, Steve McClure, Markus Armbruster
5  *
6  *  Empire is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  *  ---
20  *
21  *  See files README, COPYING and CREDITS in the root of the source
22  *  tree for related information and legal notices.  It is expected
23  *  that future projects/authors will amend these files as needed.
24  *
25  *  ---
26  *
27  *  path.h: Definitions for directions, paths, etc.
28  *
29  *  Known contributors to this file:
30  *     Markus Armbruster, 2005-2014
31  */
32
33 #ifndef PATH_H
34 #define PATH_H
35
36 #include <stddef.h>
37 #include "types.h"
38
39         /* direction indices */
40 #define DIR_STOP        0
41 #define DIR_UR          1
42 #define DIR_R           2
43 #define DIR_DR          3
44 #define DIR_DL          4
45 #define DIR_L           5
46 #define DIR_UL          6
47 #define DIR_VIEW        7
48 #define DIR_MAP         8
49 #define DIR_FIRST       1
50 #define DIR_LAST        6
51
52 #define DIR_BACK(dir) ((dir) >= DIR_FIRST + 3 ? (dir) - 3 : (dir) + 3)
53
54 #define MOB_MOVE        0
55 #define MOB_MARCH       1
56 #define MOB_RAIL        2
57 #define MOB_SAIL        3
58 #define MOB_FLY         4
59
60 /* src/lib/global/dir.c */
61 extern signed char dirindex['z'-'a'+1];
62 extern int diroff[DIR_MAP+1][2];
63 extern char dirch[DIR_MAP+2];
64 extern char *routech[DIR_LAST+1];
65
66 /* src/lib/common/findpath.c */
67 extern void path_find_from(coord, coord, natid, int);
68 extern double path_find_to(coord, coord);
69 extern double path_find(coord, coord, coord, coord, natid, int);
70 extern size_t path_find_route(char *, size_t, coord, coord, coord, coord);
71 #ifdef PATH_FIND_DEBUG
72 extern void path_find_visualize(coord, coord, coord, coord);
73 #endif
74 #ifdef PATH_FIND_STATS
75 extern void path_find_print_stats(void);
76 #else
77 #define path_find_print_stats() ((void)0)
78 #endif
79
80 /* src/lib/subs/paths.c */
81 extern char *getpath(char *, char *, coord, coord, int, int, int);
82 extern double fcost(struct sctstr *, natid);
83 extern double ncost(struct sctstr *, natid);
84 extern double pathtoxy(char *, coord *, coord *,
85                        double (*)(struct sctstr *, natid));
86 extern int chkdir(char, int, int);
87 extern int diridx(char);
88 extern void direrr(char *, char *, char *);
89 extern void pathrange(coord, coord, char *, int, struct range *);
90
91 extern double sector_mcost(struct sctstr *, int);
92 extern double speed_factor(double, int);
93
94 #define MAX_PATH_LEN 1024
95
96 #endif