summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-24 09:02:38 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-24 09:02:38 +0000
commit5e887cdbaca92e5706d363c22fafbe10c0de669b (patch)
treeed48514caa5780a8ee5dcc2dcfd3ccfbaa4eeaba /crawl-ref/source/mon-util.cc
parent0ff119e29e26761c5c24b70dacbee90de6735323 (diff)
downloadcrawl-ref-5e887cdbaca92e5706d363c22fafbe10c0de669b.tar.gz
crawl-ref-5e887cdbaca92e5706d363c22fafbe10c0de669b.zip
[1749272] Fixed view update issues:
- Redraw view when entering a new level before allowing monsters on the level to act. - Monsters are redrawn on the view as and when they move, instead of postponing the view update to the end of turn. - Beam animations and monster redraws force a view update if the view is stale (such as when a beam is shown during travel and travel_delay = -1). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1925 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index aee81286ff..1dc3d462fd 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -259,6 +259,12 @@ unsigned long get_mons_resists(const monsters *mon)
return (resists);
}
+monsters *monster_at(const coord_def &pos)
+{
+ const int mindex = mgrd(pos);
+ return (mindex != NON_MONSTER? &menv[mindex] : NULL);
+}
+
int mons_piety(const monsters *mon)
{
if (mon->god == GOD_NO_GOD)
@@ -4200,6 +4206,25 @@ bool monsters::is_icy() const
return (mons_is_icy(type));
}
+bool monsters::has_action_energy() const
+{
+ return (speed_increment >= 80);
+}
+
+void monsters::check_redraw(const coord_def &old) const
+{
+ const bool see_new = see_grid(pos());
+ const bool see_old = see_grid(old);
+ if ((see_new || see_old) && !view_update())
+ {
+ if (see_new)
+ view_update_at(pos());
+ if (see_old)
+ view_update_at(old);
+ update_screen();
+ }
+}
+
/////////////////////////////////////////////////////////////////////////
// mon_enchant