void ivkill() { previous_obj = FALSE; if (dcheck() && g.dflag >= 2) object = DWARF; if (here(SNAKE)) addobj(SNAKE); if (at(DRAGON) && g.prop[DRAGON] == 0) addobj(DRAGON); if (at(TROLL)) addobj(TROLL); if (here(GNOME)) addobj(GNOME); if (here(BEAR) && g.prop[BEAR] == 0) addobj(BEAR); if (here(WUMPUS) && g.prop[WUMPUS] == 0) addobj(WUMPUS); /* Can't attack bird by throwing axe */ if (here(BIRD) && verb != THROW) addobj(BIRD); /* Clam and oyster both treated as clam for intransitive case; no harm done. */ if (here(CLAM) || here(OYSTER)) addobj(CLAM); if ((previous_obj) || (object == 0)) rspeak(44); else vkill(); return; }
/* Routine to process a transitive verb */ trverb() { switch(verb){ case CALM: case WALK: case QUIT: case SCORE: case FOO: case BRIEF: case SUSPEND: case HOURS: case LOG: actspk(verb); break; case TAKE: vtake(); break; case DROP: vdrop(); break; case OPEN: case LOCK: vopen(); break; case SAY: vsay(); break; case NOTHING: rspeak(54); break; case ON: von(); break; case OFF: voff(); break; case WAVE: vwave(); break; case KILL: vkill(); break; case POUR: vpour(); break; case EAT: veat(); break; case DRINK: vdrink(); break; case RUB: if (object != LAMP) rspeak(76); else actspk(RUB); break; case THROW: vthrow(); break; case FEED: vfeed(); break; case FIND: case INVENTORY: vfind(); break; case FILL: vfill(); break; case READ: vread(); break; case BLAST: vblast(); break; case BREAK: vbreak(); break; case WAKE: vwake(); break; default: printf("This verb is not implemented yet.\n"); } }
void kbdinput::readcb () { struct _isigs { int ch; int sig; }; static const _isigs isig[] = { { VINTR, SIGINT }, { VQUIT, SIGQUIT }, { VSUSP, SIGTSTP }, #ifdef VDSUSP { VDSUSP, SIGTSTP }, #endif /* VDSUSP */ { -1, -1 } }; u_char c; size_t n = read (kbdfd, &c, 1); if (n <= 0) { setorig (); if (n == 0) fatal ("keyboard: EOF (with ICANON clear)\n"); else fatal ("keyboard: %m\n"); } dst->update (&c, 1); getclocknoise (dst); if (!lnext && c != _POSIX_VDISABLE) { #ifdef VLNEXT if (c == torig.c_cc[VLNEXT]) { lnext = true; return; } #endif /* VLNEXT */ for (int i = 0; isig[i].sig > 0; i++) if (c == torig.c_cc[isig[i].ch]) { setorig (); tcflush (kbdfd, TCIFLUSH); kill (0, isig[i].sig); gotsig = true; setraw (); getclocknoise (dst); vreprint (); gotsig = false; return; } if (iserase (c)) verase (); else if (iskill (c)) vkill (); else if (isreprint (c)) vreprint (); else goto normal; return; } normal: bool olnext = lnext; lnext = false; gotch (c, olnext); c = 0; }