MCPcopy Create free account
hub / github.com/NetHack/NetHack / cmd_safety_prevention

Function cmd_safety_prevention

src/do.c:2324–2346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2322}
2323
2324boolean
2325cmd_safety_prevention(const char *ucverb, const char *cmddesc,
2326 const char *act, int *flagcounter)
2327{
2328 if (flags.safe_wait && !iflags.menu_requested && !gm.multi) {
2329 char buf[QBUFSZ];
2330
2331 buf[0] = '\0';
2332 if (iflags.cmdassist || !(*flagcounter)++)
2333 Sprintf(buf, " Use '%s' prefix to force %s.",
2334 visctrl(cmd_from_func(do_reqmenu)), cmddesc);
2335
2336 if (monster_nearby()) {
2337 Norep("%s%s", act, buf);
2338 return TRUE;
2339 } else if (danger_uprops()) {
2340 Norep("%s doesn't feel like a good idea right now.", ucverb);
2341 return TRUE;
2342 }
2343 }
2344 *flagcounter = 0;
2345 return FALSE;
2346}
2347
2348/* '.' command: do nothing == rest; also the
2349 ' ' command iff 'rest_on_space' option is On */

Callers 2

dosearchFunction · 0.85
donullFunction · 0.85

Calls 5

visctrlFunction · 0.85
cmd_from_funcFunction · 0.85
monster_nearbyFunction · 0.85
NorepFunction · 0.85
danger_upropsFunction · 0.85

Tested by

no test coverage detected