summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/los.h
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-25 17:54:10 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-10-26 16:43:04 +0100
commit4cead2d3ab94322f080e143e9786b76f953ac85e (patch)
tree07c287e82e323b8373bccbdf1fdf57664f2eeefb /crawl-ref/source/los.h
parentcc1219315e2533f36b5e1f131fffa77041b919e6 (diff)
downloadcrawl-ref-4cead2d3ab94322f080e143e9786b76f953ac85e.tar.gz
crawl-ref-4cead2d3ab94322f080e143e9786b76f953ac85e.zip
Rewrite los_def to handle function parameters sensibly.
Previously, it was holding on to pointers to objects it didn't own, causing various bugs. los_def now copies the opacity_func and bounds_func parameters. Making them copyable required introducing opacity_func::clone(). Also implement los_def copy constructor and copy assignment operator. Finally, update travel exclusions and monster patrolling to these changes.
Diffstat (limited to 'crawl-ref/source/los.h')
-rw-r--r--crawl-ref/source/los.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/crawl-ref/source/los.h b/crawl-ref/source/los.h
index 943a5674d6..eec4d13909 100644
--- a/crawl-ref/source/los.h
+++ b/crawl-ref/source/los.h
@@ -44,18 +44,25 @@ void losight(env_show_grid& sh, const los_param& param);
class los_def
{
env_show_grid show;
- coord_def const * center;
+ coord_def center;
opacity_func const * opc;
- const bounds_func * bds;
+ bounds_func const * bds;
public:
los_def();
los_def(const coord_def& c, const opacity_func &o = opc_default,
const bounds_func &b = bds_default);
- void init(const coord_def& c, const opacity_func &o = opc_default,
- const bounds_func &b = bds_default);
- void update();
+ los_def(const los_def& l);
+ ~los_def();
+ los_def& operator=(const los_def& l);
+ void init(const coord_def& center, const opacity_func& o,
+ const bounds_func& b);
void set_center(const coord_def& center);
+ void set_opacity(const opacity_func& o);
+ void set_bounds(const bounds_func& b);
+
+ void update();
+ bool in_bounds(const coord_def& p) const;
bool see_cell(const coord_def& p) const;
};