summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/losparam.cc
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-05 12:57:13 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-05 12:57:13 -0600
commit51ded013829b4cd8f73fa7f6313e73d2f7550aa5 (patch)
tree58a2f3973efdd6fb016f3ab7a3a71809d0d888d0 /crawl-ref/source/losparam.cc
parent418a2664a3de915971c847d9fb16e93bc263661e (diff)
downloadcrawl-ref-51ded013829b4cd8f73fa7f6313e73d2f7550aa5.tar.gz
crawl-ref-51ded013829b4cd8f73fa7f6313e73d2f7550aa5.zip
Make many checks for monster (non)existence on squares use monster_at().
Not all are changed yet, as there are several index checks still needed for debugging purposes. Also, make many checks for player/monster (non)existence use actor_at().
Diffstat (limited to 'crawl-ref/source/losparam.cc')
-rw-r--r--crawl-ref/source/losparam.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc
index 27f32b73c2..5417e9d62e 100644
--- a/crawl-ref/source/losparam.cc
+++ b/crawl-ref/source/losparam.cc
@@ -10,11 +10,11 @@
#include "cloud.h"
#include "externs.h"
#include "los.h"
+#include "mon-util.h"
#include "terrain.h"
opacity_type opacity_default::operator()(const coord_def& p) const
{
- int m;
dungeon_feature_type f = env.grid(p);
if (feat_is_opaque(f))
return OPC_OPAQUE;
@@ -22,7 +22,7 @@ opacity_type opacity_default::operator()(const coord_def& p) const
return OPC_HALF;
else if (f == DNGN_TREES)
return OPC_HALF;
- else if ((m = mgrd(p)) != NON_MONSTER && menv[m].type == MONS_BUSH)
+ else if (monster_at(p) && monster_at(p)->type == MONS_BUSH)
return OPC_HALF;
else
return OPC_CLEAR;
@@ -40,7 +40,6 @@ opacity_type opacity_fullyopaque::operator()(const coord_def& p) const
// XXX: Are trees, bushes solid?
opacity_type opacity_solid::operator()(const coord_def& p) const
{
- int m;
dungeon_feature_type f = env.grid(p);
if (feat_is_solid(f))
return OPC_OPAQUE;
@@ -48,7 +47,7 @@ opacity_type opacity_solid::operator()(const coord_def& p) const
return OPC_HALF;
else if (f == DNGN_TREES)
return OPC_HALF;
- else if ((m = mgrd(p)) != NON_MONSTER && menv[m].type == MONS_BUSH)
+ else if (monster_at(p) && monster_at(p)->type == MONS_BUSH)
return OPC_HALF;
else
return OPC_CLEAR;