summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/coord.h
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-30 15:59:29 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-10-30 21:32:06 +0100
commitc72f09adfa6f776ff5cabd0b8e4b4e0a2e752703 (patch)
tree4d8df78d7c26029a1849bb20caf13b98756d0196 /crawl-ref/source/coord.h
parent764ee1d67a579678d69aa690e92e263fee2b02e3 (diff)
downloadcrawl-ref-c72f09adfa6f776ff5cabd0b8e4b4e0a2e752703.tar.gz
crawl-ref-c72f09adfa6f776ff5cabd0b8e4b4e0a2e752703.zip
Splitting up stuff.cc.
New: colour.cc, coord.cc, coordit.cc, random.cc, rng.cc.
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