MCPcopy Index your code
hub / github.com/NetHack/NetHack / dothrow

Function dothrow

src/dothrow.c:351–376  ·  view source on GitHub ↗

the #throw command */

Source from the content-addressed store, hash-verified

349
350/* the #throw command */
351int
352dothrow(void)
353{
354 struct obj *obj;
355 int shotlimit;
356
357 /*
358 * Since some characters shoot multiple missiles at one time,
359 * allow user to specify a count prefix for 'f' or 't' to limit
360 * number of items thrown (to avoid possibly hitting something
361 * behind target after killing it, or perhaps to conserve ammo).
362 *
363 * Prior to 3.3.0, command ``3t'' meant ``t(shoot) t(shoot) t(shoot)''
364 * and took 3 turns. Now it means ``t(shoot at most 3 missiles)''.
365 *
366 * [3.6.0: shot count setup has been moved into ok_to_throw().]
367 */
368 if (!ok_to_throw(&shotlimit))
369 return ECMD_OK;
370
371 obj = getobj("throw", throw_ok, GETOBJ_PROMPT | GETOBJ_ALLOWCNT);
372 /* it is also possible to throw food */
373 /* (or jewels, or iron balls... ) */
374
375 return obj ? throw_obj(obj, shotlimit) : ECMD_CANCEL;
376}
377
378/* KMH -- Automatically fill quiver */
379/* Suggested by Jeffrey Bay <jbay@convex.hp.com> */

Callers

nothing calls this directly

Calls 3

ok_to_throwFunction · 0.85
getobjFunction · 0.85
throw_objFunction · 0.85

Tested by

no test coverage detected