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

Function dip_into

src/potion.c:2378–2405  ·  view source on GitHub ↗

#altdip - #dip with "what to dip?" and "what to dip it into?" asked in the opposite order; ignores floor water; used for context-sensitive inventory item-action: the potion has already been selected and is in cmdq ready to answer the first getobj() prompt */

Source from the content-addressed store, hash-verified

2376 inventory item-action: the potion has already been selected and is in
2377 cmdq ready to answer the first getobj() prompt */
2378int
2379dip_into(void)
2380{
2381 struct obj *obj, *potion;
2382 char qbuf[QBUFSZ];
2383
2384 if (!cmdq_peek(CQ_CANNED)) {
2385 impossible("dip_into: where is potion?");
2386 return ECMD_FAIL;
2387 }
2388 /* note: drink_ok() callback for quaffing is also used to validate
2389 a potion to dip into */
2390 drink_ok_extra = 0; /* affects drink_ok(): haven't been asked about and
2391 * declined to use a floor feature like a fountain */
2392 potion = getobj("dip", drink_ok, GETOBJ_NOFLAGS);
2393 if (!potion || potion->oclass != POTION_CLASS)
2394 return ECMD_CANCEL;
2395
2396 /* "What do you want to dip into <the potion>? [abc or ?*] " */
2397 Snprintf(qbuf, sizeof qbuf, "dip into %s%s",
2398 is_plural(potion) ? "one of " : "", thesimpleoname(potion));
2399 obj = getobj(qbuf, dip_ok, GETOBJ_PROMPT);
2400 if (!obj)
2401 return ECMD_CANCEL;
2402 if (inaccessible_equipment(obj, "dip", FALSE))
2403 return ECMD_OK;
2404 return potion_dip(obj, potion);
2405}
2406
2407staticfn void
2408poof(struct obj *potion)

Callers

nothing calls this directly

Calls 6

cmdq_peekFunction · 0.85
getobjFunction · 0.85
thesimpleonameFunction · 0.85
inaccessible_equipmentFunction · 0.85
potion_dipFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected