Code cleanup
[crawl.git] / crawl-ref / source / coord.h
blobbe4a8ed7ffa432a19cc37a0d66cac9f7ffd8971c
1 #ifndef COORD_H
2 #define COORD_H
4 bool in_bounds_x(int x);
5 bool in_bounds_y(int y);
6 bool in_bounds(int x, int y);
7 bool map_bounds_x(int x);
8 bool map_bounds_y(int y);
9 bool map_bounds(int x, int y);
10 coord_def random_in_bounds();
12 inline bool in_bounds(const coord_def &p)
14 return in_bounds(p.x, p.y);
17 inline bool map_bounds(const coord_def &p)
19 return map_bounds(p.x, p.y);
22 // Checks that a given point is within the map, excluding 'margin' squares at
23 // the edge of the map.
24 bool map_bounds_with_margin(coord_def p, int margin);
26 // Determines if the coordinate is within bounds of an LOS array.
27 inline bool show_bounds(const coord_def &p)
29 return (p.x >= 0 && p.x < ENV_SHOW_DIAMETER
30 && p.y >= 0 && p.y < ENV_SHOW_DIAMETER);
33 int grid_distance(const coord_def& p1, const coord_def& p2);
34 int distance(const coord_def& p1, const coord_def& p2);
35 bool adjacent(const coord_def& p1, const coord_def& p2);
37 // Conversion between different coordinate systems.
38 // XXX: collect all of these here?
40 coord_def player2grid(const coord_def& pc);
41 coord_def grid2player(const coord_def& pc);
43 #endif