Monster opening:
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:
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.
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; }
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... }
Comment