summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/coord.h
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/coord.h')
-rw-r--r--crawl-ref/source/coord.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/crawl-ref/source/coord.h b/crawl-ref/source/coord.h
new file mode 100644
index 0000000000..685718ca8e
--- /dev/null
+++ b/crawl-ref/source/coord.h
@@ -0,0 +1,35 @@
+#ifndef COORD_H
+#define COORD_H
+
+bool in_bounds_x(int x);
+bool in_bounds_y(int y);
+bool in_bounds(int x, int y);
+bool map_bounds_x(int x);
+bool map_bounds_y(int y);
+bool map_bounds(int x, int y);
+coord_def random_in_bounds();
+
+inline bool in_bounds(const coord_def &p)
+{
+ return in_bounds(p.x, p.y);
+}
+
+inline bool map_bounds(const coord_def &p)
+{
+ return map_bounds(p.x, p.y);
+}
+
+// Determines if the coordinate is within bounds of an LOS array.
+inline bool show_bounds(const coord_def &p)
+{
+ return (p.x >= 0 && p.x < ENV_SHOW_DIAMETER
+ && p.y >= 0 && p.y < ENV_SHOW_DIAMETER);
+}
+
+int grid_distance( const coord_def& p1, const coord_def& p2 );
+int grid_distance( int x, int y, int x2, int y2 );
+int distance( const coord_def& p1, const coord_def& p2 );
+int distance( int x, int y, int x2, int y2);
+bool adjacent( const coord_def& p1, const coord_def& p2 );
+
+#endif