diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2010-01-26 22:53:47 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2010-01-26 23:05:33 +0100 |
commit | 98003eee41c183876eb5971700aa29f7a7b128bd (patch) | |
tree | 4167b3d8a13355324864c837619fe1a23fc4ed40 /crawl-ref/source/actor-los.cc | |
parent | 3b4e8ee7e2e1408b86834e0f8b109a1fcee402f0 (diff) | |
download | crawl-ref-98003eee41c183876eb5971700aa29f7a7b128bd.tar.gz crawl-ref-98003eee41c183876eb5971700aa29f7a7b128bd.zip |
Hack monster LOS to reduce updates.
It's now only updated if the monster has moved or is in view of
the player. That means it will not necessarily be accurate if
terrain or clouds are LOS-affecting monsters change/move.
I'm not sure that this is much better than just not updating
LOS for sleeping monsters -- depends on to what extent monsters
just stay in place.
Previously, crawl spent a significant amount of time with the
monster LOS updates.
Other options:
- Calculate monster LOS on-demand (unlikely to help much)
- Reduce monster LOS range away from the player
(this might require some changes to LOS code to actually save
time)
- Track LOS globally: for each cell, which other cells are visible?
An estimated 200 kB of data.
This would then only be updated if terrain/clouds/LOS-affecting
monsters changed.
Diffstat (limited to 'crawl-ref/source/actor-los.cc')
-rw-r--r-- | crawl-ref/source/actor-los.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crawl-ref/source/actor-los.cc b/crawl-ref/source/actor-los.cc index 35c93a8c9d..f5242ba541 100644 --- a/crawl-ref/source/actor-los.cc +++ b/crawl-ref/source/actor-los.cc @@ -18,7 +18,11 @@ bool actor::see_cell(const coord_def &p) const void actor::update_los() { - los.update(); + if (changed_los_center || observable()) + { + los.update(); + changed_los_center = false; + } } bool actor::can_see(const actor *target) const |