Prevent searching or waiting next to a hostile

Generally speaking there's no reason to wait or search next to
a hostile monster, so let's just prevent those actions. You can
still do those commands by prefixing them with the 'm' prefix.
This commit is contained in:
Pasi Kallinen
2020-04-12 17:21:23 +03:00
parent 47fb7e5ee5
commit ac94c44b0b
6 changed files with 21 additions and 3 deletions

View File

@@ -2995,6 +2995,8 @@ int NDECL((*cmd_func));
|| cmd_func == doloot
/* travel: pop up a menu of interesting targets in view */
|| cmd_func == dotravel
/* wait and search: allow even if next to a hostile monster */
|| cmd_func == donull || cmd_func == dosearch
/* wizard mode ^V and ^T */
|| cmd_func == wiz_level_tele || cmd_func == dotelecmd
/* 'm' prefix allowed for some extended commands */

View File

@@ -1782,6 +1782,10 @@ register int aflag; /* intrinsic autosearch vs explicit searching */
int
dosearch()
{
if (!iflags.menu_requested && !g.multi && monster_nearby()) {
Norep("You already found a monster.");
return 0;
}
return dosearch0(0);
}

View File

@@ -1970,6 +1970,11 @@ long timeout UNUSED;
int
donull()
{
if (!iflags.menu_requested && !g.multi && monster_nearby()) {
Norep("Are you waiting to get hit?");
return 0;
}
return 1; /* Do nothing, but let other things happen */
}