diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2010-02-07 15:35:16 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2010-02-07 16:08:30 +0100 |
commit | a9af525338b34c8a527270bdb5f31574f1e333f8 (patch) | |
tree | aea0352ff7894471f6a0e64057cf4b46401c5281 /crawl-ref/source/losparam.cc | |
parent | 6be404bd97be777ee24e9f068438b53e06a63f97 (diff) | |
download | crawl-ref-a9af525338b34c8a527270bdb5f31574f1e333f8.tar.gz crawl-ref-a9af525338b34c8a527270bdb5f31574f1e333f8.zip |
Make trees and plants block opacity_no_trans.
opacity_no_trans is used for you.trans_wall_block, which in turn
is used in monster pathfinding. This fixes some pathfinding issues
in the new woody swamp. If the "no_trans" opacity is used for
other purposes, this change may also have negative side-effects.
Diffstat (limited to 'crawl-ref/source/losparam.cc')
-rw-r--r-- | crawl-ref/source/losparam.cc | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc index ff53d43543..53823ce28e 100644 --- a/crawl-ref/source/losparam.cc +++ b/crawl-ref/source/losparam.cc @@ -38,18 +38,35 @@ opacity_type opacity_fullyopaque::operator()(const coord_def& p) const return OPC_CLEAR; } -// Make transparent walls block in addition to normal LOS. +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. 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)) + if (feat_is_opaque(f) || feat_is_wall(f) || f == DNGN_TREES) + return OPC_OPAQUE; + else if (mons_block_no_trans(monster_at(p))) 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; } |