summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dgn-proclayouts.h
diff options
context:
space:
mode:
authorBrendan Hickey <brendan@bhickey.net>2012-09-13 08:52:24 -0700
committerBrendan Hickey <brendan@bhickey.net>2012-12-30 19:06:12 -0800
commit653d2261a17b481d03bff741c0eadf65257e2ad4 (patch)
tree82e0bedf791582b45f3834a432aab2694ce5e724 /crawl-ref/source/dgn-proclayouts.h
parentc3c62dc86dcbaf4d851d81f23506767dbc2c38ee (diff)
downloadcrawl-ref-653d2261a17b481d03bff741c0eadf65257e2ad4.tar.gz
crawl-ref-653d2261a17b481d03bff741c0eadf65257e2ad4.zip
Worley Layout with Changepoints
A WorleyLayout that selects between two other layouts. It calculates the lower bound on when the feature can change so that the whole dungeon doesn't get recomputed on every turn.
Diffstat (limited to 'crawl-ref/source/dgn-proclayouts.h')
-rw-r--r--crawl-ref/source/dgn-proclayouts.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/crawl-ref/source/dgn-proclayouts.h b/crawl-ref/source/dgn-proclayouts.h
index f762d0c16a..fa0b85c6bf 100644
--- a/crawl-ref/source/dgn-proclayouts.h
+++ b/crawl-ref/source/dgn-proclayouts.h
@@ -37,7 +37,7 @@ class ProceduralSample
class ProceduralLayout
{
public:
- virtual ProceduralSample operator()(const coord_def &p, const uint32_t offset = 0) = 0;
+ virtual ProceduralSample operator()(const coord_def &p, const uint32_t offset = 0) const = 0;
};
class ColumnLayout : public ProceduralLayout
@@ -52,9 +52,21 @@ class ColumnLayout : public ProceduralLayout
_row_space = (rs < 0 ? cs : rs);
}
- ProceduralSample operator()(const coord_def &p, const uint32_t offset = 0);
+ ProceduralSample operator()(const coord_def &p, const uint32_t offset = 0) const;
private:
int _col_width, _col_space, _row_width, _row_space;
};
+class WorleyLayout : public ProceduralLayout
+{
+ public:
+ WorleyLayout(uint32_t _seed,
+ const ProceduralLayout &_a,
+ const ProceduralLayout &_b) : seed(_seed), a(_a), b(_b) {}
+ ProceduralSample operator()(const coord_def &p, const uint32_t offset = 0) const;
+ private:
+ const uint32_t seed;
+ const ProceduralLayout &a, &b;
+};
+
#endif /* PROC_LAYOUTS_H */