projects
/
victrix-abyssi
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
92414c8
)
Added bounds check function to Level
author
Martin Read
<martin@blackswordsonics.com>
Tue, 18 Feb 2014 22:48:19 +0000
(22:48 +0000)
committer
Martin Read
<martin@blackswordsonics.com>
Tue, 18 Feb 2014 22:48:19 +0000
(22:48 +0000)
* map.hh: Level now has a bounds checking function in_bounds which verifies
the acceptability of a Coord.
map.hh
patch
|
blob
|
history
diff --git
a/map.hh
b/map.hh
index
28dfaee
..
6942c9c
100644
(file)
--- a/
map.hh
+++ b/
map.hh
@@
-217,6
+217,12
@@
public:
}
}
Coord random_point(int margin) const;
+ bool in_bounds(Coord c) const
+ {
+ c += origin_off;
+ return !((c.y < 0) || (c.x < 0) || (c.y >= (chunks_high << CHUNK_SHIFT)) ||
+ (c.x >= (chunks_wide << CHUNK_SHIFT)));
+ }
};
extern Level lvl;