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

Function opentin

src/eat.c:1702–1719  ·  view source on GitHub ↗

called during each move whilst opening a tin */

Source from the content-addressed store, hash-verified

1700
1701/* called during each move whilst opening a tin */
1702staticfn int
1703opentin(void)
1704{
1705 /* perhaps it was stolen (although that should cause interruption) */
1706 if (!carried(svc.context.tin.tin)
1707 && (!obj_here(svc.context.tin.tin, u.ux, u.uy)
1708 || !can_reach_floor(TRUE)))
1709 return 0; /* %% probably we should use tinoid */
1710 if (svc.context.tin.usedtime++ >= 50) {
1711 You("give up your attempt to open the tin.");
1712 return 0;
1713 }
1714 if (svc.context.tin.usedtime < svc.context.tin.reqtime)
1715 return 1; /* still busy */
1716
1717 consume_tin("You succeed in opening the tin.");
1718 return 0;
1719}
1720
1721/* called when starting to open a tin */
1722staticfn void

Callers

nothing calls this directly

Calls 4

obj_hereFunction · 0.85
can_reach_floorFunction · 0.85
YouFunction · 0.85
consume_tinFunction · 0.85

Tested by

no test coverage detected