diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-07 09:14:53 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-07 09:26:05 +0100 |
commit | 5026a1be87655357367b9ae66db018c08899e572 (patch) | |
tree | 4ffc8668983e69339aecb5424f0e8092f1f2341d | |
parent | dc74095a578a338bb926cfea2db14c2b90c2a633 (diff) | |
download | crawl-ref-5026a1be87655357367b9ae66db018c08899e572.tar.gz crawl-ref-5026a1be87655357367b9ae66db018c08899e572.zip |
Split los_def implementation out into los_def.cc.
-rw-r--r-- | crawl-ref/source/los.cc | 76 | ||||
-rw-r--r-- | crawl-ref/source/los_def.cc | 79 | ||||
-rw-r--r-- | crawl-ref/source/makefile.obj | 1 |
3 files changed, 80 insertions, 76 deletions
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index 7d692ca6be..98b9169d36 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -915,82 +915,6 @@ void losight(env_show_grid& sh, const coord_def& center, } -// class los_def - -los_def::los_def() - : show(0), opc(opc_default.clone()), bds(bds_default.clone()) -{ -} - -los_def::los_def(const coord_def& c, const opacity_func &o, - const bounds_func &b) - : show(0), center(c), opc(o.clone()), bds(b.clone()) -{ -} - -los_def::los_def(const los_def& los) - : show(los.show), center(los.center), - opc(los.opc->clone()), bds(los.bds->clone()) -{ -} - -los_def& los_def::operator=(const los_def& los) -{ - init(los.center, *los.opc, *los.bds); - show = los.show; - return (*this); -} - -void los_def::init(const coord_def &c, const opacity_func &o, - const bounds_func &b) -{ - show.init(0); - set_center(c); - set_opacity(o); - set_bounds(b); -} - -los_def::~los_def() -{ - delete opc; - delete bds; -} - -void los_def::update() -{ - losight(show, center, *opc, *bds); -} - -void los_def::set_center(const coord_def& c) -{ - center = c; -} - -void los_def::set_opacity(const opacity_func &o) -{ - delete opc; - opc = o.clone(); -} - -void los_def::set_bounds(const bounds_func &b) -{ - delete bds; - bds = b.clone(); -} - -bool los_def::in_bounds(const coord_def& p) const -{ - return ((*bds)(p)); -} - -bool los_def::see_cell(const coord_def& p) const -{ - return (::see_cell(show, center, p)); -} - -// end los_def - - void losight_permissive(env_show_grid &sh, const coord_def& center) { for (int x = -ENV_SHOW_OFFSET; x <= ENV_SHOW_OFFSET; ++x) diff --git a/crawl-ref/source/los_def.cc b/crawl-ref/source/los_def.cc new file mode 100644 index 0000000000..08144fe23b --- /dev/null +++ b/crawl-ref/source/los_def.cc @@ -0,0 +1,79 @@ +/* + * File: los_def.cc + * Summary: LOS wrapper class. + */ + +#include "AppHdr.h" + +#include "los.h" + +los_def::los_def() + : show(0), opc(opc_default.clone()), bds(bds_default.clone()) +{ +} + +los_def::los_def(const coord_def& c, const opacity_func &o, + const bounds_func &b) + : show(0), center(c), opc(o.clone()), bds(b.clone()) +{ +} + +los_def::los_def(const los_def& los) + : show(los.show), center(los.center), + opc(los.opc->clone()), bds(los.bds->clone()) +{ +} + +los_def& los_def::operator=(const los_def& los) +{ + init(los.center, *los.opc, *los.bds); + show = los.show; + return (*this); +} + +void los_def::init(const coord_def &c, const opacity_func &o, + const bounds_func &b) +{ + show.init(0); + set_center(c); + set_opacity(o); + set_bounds(b); +} + +los_def::~los_def() +{ + delete opc; + delete bds; +} + +void los_def::update() +{ + losight(show, center, *opc, *bds); +} + +void los_def::set_center(const coord_def& c) +{ + center = c; +} + +void los_def::set_opacity(const opacity_func &o) +{ + delete opc; + opc = o.clone(); +} + +void los_def::set_bounds(const bounds_func &b) +{ + delete bds; + bds = b.clone(); +} + +bool los_def::in_bounds(const coord_def& p) const +{ + return ((*bds)(p)); +} + +bool los_def::see_cell(const coord_def& p) const +{ + return (::see_cell(show, center, p)); +} diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj index d921591669..588ab56676 100644 --- a/crawl-ref/source/makefile.obj +++ b/crawl-ref/source/makefile.obj @@ -81,6 +81,7 @@ l_you.o \ lev-pand.o \ libutil.o \ los.o \ +los_def.o \ losparam.o \ luaterp.o \ macro.o \ |