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

Function mkroll_launch

src/trap.c:3658–3692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3656}
3657
3658staticfn int
3659mkroll_launch(
3660 struct trap *ttmp,
3661 coordxy x,
3662 coordxy y,
3663 short otyp,
3664 long ocount)
3665{
3666 struct obj *otmp;
3667 coord cc = UNDEFINED_VALUES;
3668 boolean success = FALSE;
3669
3670 success = find_random_launch_coord(ttmp, &cc);
3671
3672 if (!success) {
3673 /* create the trap without any ammo, launch pt at trap location */
3674 cc.x = x;
3675 cc.y = y;
3676 } else {
3677 otmp = mksobj(otyp, TRUE, FALSE);
3678 otmp->quan = ocount;
3679 otmp->owt = weight(otmp);
3680 place_object(otmp, cc.x, cc.y);
3681 stackobj(otmp);
3682 }
3683 ttmp->launch.x = cc.x;
3684 ttmp->launch.y = cc.y;
3685 if (ttmp->ttyp == ROLLING_BOULDER_TRAP) {
3686 ttmp->launch2.x = x - (cc.x - x);
3687 ttmp->launch2.y = y - (cc.y - y);
3688 } else
3689 ttmp->launch_otyp = otyp;
3690 newsym(ttmp->launch.x, ttmp->launch.y);
3691 return 1;
3692}
3693
3694staticfn boolean
3695isclearpath(

Callers 1

maketrapFunction · 0.85

Calls 6

find_random_launch_coordFunction · 0.85
mksobjFunction · 0.85
weightFunction · 0.85
place_objectFunction · 0.85
stackobjFunction · 0.85
newsymFunction · 0.85

Tested by

no test coverage detected