diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-21 13:22:01 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-21 13:54:24 +0100 |
commit | c262f0a60de06dee8cc7210bf207575a73232445 (patch) | |
tree | 9821db2b81af8ae5410571709d3bc1279ac81ace /crawl-ref/source/los_def.cc | |
parent | b9101bc3717daffdf0e898fa701cccd4b64765ce (diff) | |
download | crawl-ref-c262f0a60de06dee8cc7210bf207575a73232445.tar.gz crawl-ref-c262f0a60de06dee8cc7210bf207575a73232445.zip |
Hack player::los for arena.
This should fix recent arena display problems.
Also fix los_def::in_bounds to translate coordinates.
Diffstat (limited to 'crawl-ref/source/los_def.cc')
-rw-r--r-- | crawl-ref/source/los_def.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/crawl-ref/source/los_def.cc b/crawl-ref/source/los_def.cc index 3e2a3eae2e..a84399115d 100644 --- a/crawl-ref/source/los_def.cc +++ b/crawl-ref/source/los_def.cc @@ -10,19 +10,19 @@ #include "coord-circle.h" los_def::los_def() - : show(0), opc(opc_default.clone()), bds(BDS_DEFAULT) + : show(0), opc(opc_default.clone()), bds(BDS_DEFAULT), arena(false) { } los_def::los_def(const coord_def& c, const opacity_func &o, const circle_def &b) - : show(0), center(c), opc(o.clone()), bds(b) + : show(0), center(c), opc(o.clone()), bds(b), arena(false) { } los_def::los_def(const los_def& los) : show(los.show), center(los.center), - opc(los.opc->clone()), bds(los.bds) + opc(los.opc->clone()), bds(los.bds), arena(los.arena) { } @@ -30,6 +30,7 @@ los_def& los_def::operator=(const los_def& los) { init(los.center, *los.opc, los.bds); show = los.show; + arena = los.arena; return (*this); } @@ -40,6 +41,14 @@ void los_def::init(const coord_def &c, const opacity_func &o, set_center(c); set_opacity(o); set_bounds(b); + arena = false; +} + +void los_def::init_arena(const coord_def& c) +{ + center = c; + arena = true; + set_bounds(circle_def(LOS_MAX_RADIUS, C_SQUARE)); } los_def::~los_def() @@ -75,11 +84,13 @@ circle_def los_def::get_bounds() const bool los_def::in_bounds(const coord_def& p) const { - return (bds.contains(p)); + return (bds.contains(p - center)); } bool los_def::see_cell(const coord_def& p) const { + if (arena) + return (in_bounds(p)); const coord_def sp = p - center; return (sp.rdist() <= LOS_MAX_RANGE && show(sp)); } |