diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-10-07 03:10:11 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-11-18 17:07:45 +0100 |
commit | 48e72cc661381bd349d40948c10be236902eaab5 (patch) | |
tree | 37858f78938800fd3765f28242573e88c01c769c /crawl-ref/source/los_def.cc | |
parent | b9bc67f4cf6b17b4e8dd5d7d538e6a3b5552649c (diff) | |
download | crawl-ref-48e72cc661381bd349d40948c10be236902eaab5.tar.gz crawl-ref-48e72cc661381bd349d40948c10be236902eaab5.zip |
Get rid of several C_SQUARE uses.
An absolute majority of CPU use in about every test is wasted by
radius_iterator and circle_def, which implement both Chebyshev and normal
metrics as calls deep inside tight loops. Untangling them is a massive
work, so I'm chipping at it by a little from time to time.
Diffstat (limited to 'crawl-ref/source/los_def.cc')
-rw-r--r-- | crawl-ref/source/los_def.cc | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/crawl-ref/source/los_def.cc b/crawl-ref/source/los_def.cc index c30234265a..1a20e9753d 100644 --- a/crawl-ref/source/los_def.cc +++ b/crawl-ref/source/los_def.cc @@ -11,19 +11,19 @@ #include "coord-circle.h" los_def::los_def() - : show(0), opc(opc_default.clone()), bds(BDS_DEFAULT), arena(false) + : show(0), opc(opc_default.clone()), bds(BDS_DEFAULT) { } 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), arena(false) + : show(0), center(c), opc(o.clone()), bds(b) { } los_def::los_def(const los_def& los) : show(los.show), center(los.center), - opc(los.opc->clone()), bds(los.bds), arena(los.arena) + opc(los.opc->clone()), bds(los.bds) { } @@ -31,7 +31,6 @@ los_def& los_def::operator=(const los_def& los) { init(los.center, *los.opc, los.bds); show = los.show; - arena = los.arena; return *this; } @@ -42,14 +41,6 @@ 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_RADIUS, C_SQUARE)); } los_def::~los_def() @@ -95,8 +86,6 @@ bool los_def::in_bounds(const coord_def& p) const 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)); } |