View Single Post
Old May 23, 2013, 10:09   #1
PowerWyrm
Prophet
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,857
PowerWyrm is on a distinguished road
[3.5-dev] Monster opening/bashing refactoring

Monster opening:

Code:
if (cave_iscloseddoor(cave, ny, nx) || cave_issecretdoor(cave, ny, nx))
{
    cave_open_door(c, ny, nx);
}
else if (cave_islockeddoor(cave, ny, nx))
{
    ...

    /* Handle viewable doors */
    if (player_has_los_bold(ny, nx))
         do_view = TRUE;
}
First problem: cave_iscloseddoor() defined in cave.c includes locked doors, so the "else" part is dead code; I think cave_iscloseddoor() should only define "closed non locked" doors so monsters don't open locked doors without a lock power check (I think there are similar problems elsewhere in the code where the wrong check is made).

Second problem: refreshing display (do_view) should be called when the door is opened, not when a monster only "fiddles" with a lock; so the corresponding code should be put in the "if" part, not the "else" part.


Monster bashing:

Code:
else if (rf_has(m_ptr->race->flags, RF_BASH_DOOR))
{
    bash door...
}
This means that monsters having both OPEN_DOOR and BASH_DOOR will always try to open a door instead of bashing it, making BASH_DOOR obsolete. Before the refactoring, monsters failing to unlock a door would try to bash it.
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!
PowerWyrm is offline   Reply With Quote