diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-07 07:51:48 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-07 07:51:48 +0000 |
commit | b58fbcfafc44bc2810863a3722bee2e6a8f7d22d (patch) | |
tree | 22a1199ad8ca845bfad04590d9dc5e9891ae8960 /crawl-ref/source/dungeon.h | |
parent | cf61c793d3d3783b2b5a39a8cf01b857806411b2 (diff) | |
download | crawl-ref-b58fbcfafc44bc2810863a3722bee2e6a8f7d22d.tar.gz crawl-ref-b58fbcfafc44bc2810863a3722bee2e6a8f7d22d.zip |
*Breaks save compatibility* - changed monster flags to long, added "god" field for future fun.
dungeon.cc cleanup and rework to support floating vaults.
Updated levcomp to support the float orientation.
coord_def now has a constructor.
USE_RIVERS and USE_NEW_UNRANDS are no longer conditional.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@585 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dungeon.h')
-rw-r--r-- | crawl-ref/source/dungeon.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h index 4252b8f6cc..66b73d26ad 100644 --- a/crawl-ref/source/dungeon.h +++ b/crawl-ref/source/dungeon.h @@ -66,4 +66,54 @@ void place_spec_shop(int level_number, unsigned char shop_x, unsigned char shop_y, unsigned char force_s_type, bool representative = false ); +class dgn_region; +typedef std::vector<dgn_region> dgn_region_list; + +struct dgn_region +{ + // pos is top-left corner. + coord_def pos, size; + + dgn_region(int left, int top, int width, int height) + : pos(left, top), size(width, height) + { + } + + dgn_region() : pos(-1, -1), size() + { + } + + coord_def end() const + { + return pos + size - coord_def(1, 1); + } + + coord_def random_edge_point() const; + + static dgn_region absolute(int left, int top, int right, int bottom) + { + return dgn_region(left, top, right - left + 1, bottom - top + 1); + } + + static bool between(int val, int low, int high) + { + return (val >= low && val <= high); + } + + bool contains(const coord_def &p) const + { + return (p.x >= pos.x && p.x < pos.x + size.x + && p.y >= pos.y && p.y < pos.y + size.y); + } + + bool fully_contains(const coord_def &p) const + { + return (p.x > pos.x && p.x < pos.x + size.x - 1 + && p.y >= pos.y && p.y < pos.y + size.y - 1); + } + + bool overlaps(const dgn_region &other) const; + bool overlaps_any(const dgn_region_list &others) const; +}; + #endif |