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

Function find_launcher

src/dothrow.c:446–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444/* look through hero inventory for launcher matching ammo,
445 avoiding known cursed items. Returns NULL if no match. */
446staticfn struct obj *
447find_launcher(struct obj *ammo)
448{
449 struct obj *otmp, *oX;
450
451 if (!ammo)
452 return (struct obj *) 0;
453
454 for (oX = 0, otmp = gi.invent; otmp; otmp = otmp->nobj) {
455 if (otmp->cursed && otmp->bknown)
456 continue; /* known to be cursed, so skip */
457 if (ammo_and_launcher(ammo, otmp)) {
458 if (otmp->bknown)
459 return otmp; /* known-B or known-U (known-C won't get here) */
460 if (!oX)
461 oX = otmp; /* unknown-BUC; used if no known-BU item found */
462 }
463 }
464 return oX;
465}
466
467/* the #fire command -- throw from the quiver or use wielded polearm */
468int

Callers 1

dofireFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected