From b58fbcfafc44bc2810863a3722bee2e6a8f7d22d Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 7 Dec 2006 07:51:48 +0000 Subject: *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 --- crawl-ref/source/dungeon.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'crawl-ref/source/dungeon.h') 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_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 -- cgit v1.2.3-54-g00ecf