summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/losparam.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2010-02-22 11:08:18 +0100
committerRobert Vollmert <rvollmert@gmx.net>2010-02-22 13:13:21 +0100
commit7cead1f03d9108d65b9d95142cd61d224bc2aaf4 (patch)
tree138a716a49f3ae59eaaefecfbf343bd90f8493fa /crawl-ref/source/losparam.cc
parentbda0835a957666d92efeb06a95a5b06270f880f9 (diff)
downloadcrawl-ref-7cead1f03d9108d65b9d95142cd61d224bc2aaf4.tar.gz
crawl-ref-7cead1f03d9108d65b9d95142cd61d224bc2aaf4.zip
Revert "Make trees and plants block opacity_no_trans."
This reverts commit a9af525338b34c8a527270bdb5f31574f1e333f8. opacity_no_trans was used for too many things, so this change had undesired side-effects. Will need to make pathfinding independent of opacity_no_trans instead. Fixes issues #778, #836.
Diffstat (limited to 'crawl-ref/source/losparam.cc')
-rw-r--r--crawl-ref/source/losparam.cc29
1 files changed, 6 insertions, 23 deletions
diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc
index 53823ce28e..ff53d43543 100644
--- a/crawl-ref/source/losparam.cc
+++ b/crawl-ref/source/losparam.cc
@@ -38,35 +38,18 @@ opacity_type opacity_fullyopaque::operator()(const coord_def& p) const
return OPC_CLEAR;
}
-static bool mons_block_no_trans(const monsters* mons)
-{
- if (mons == NULL)
- return false;
-
- switch (mons->id())
- {
- case MONS_BUSH:
- case MONS_PLANT:
- case MONS_OKLOB_PLANT:
- case MONS_FUNGUS:
- return true;
- default:
- return false;
- }
-}
-
-// Make transparent obstacles block in addition to normal LOS.
-// This is used for example for monster pathfinding, so things
-// that should be walked around should be opaque.
+// Make transparent walls block in addition to normal LOS.
opacity_type opacity_no_trans::operator()(const coord_def& p) const
{
dungeon_feature_type f = env.grid(p);
- if (feat_is_opaque(f) || feat_is_wall(f) || f == DNGN_TREES)
- return OPC_OPAQUE;
- else if (mons_block_no_trans(monster_at(p)))
+ if (feat_is_opaque(f) || feat_is_wall(f))
return OPC_OPAQUE;
else if (is_opaque_cloud(env.cgrid(p)))
return OPC_HALF;
+ else if (f == DNGN_TREES)
+ return OPC_HALF;
+ else if (monster_at(p) && monster_at(p)->type == MONS_BUSH)
+ return OPC_HALF;
else
return OPC_CLEAR;
}