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

Function otransit_msg

src/dokick.c:1908–1939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1906}
1907
1908staticfn void
1909otransit_msg(struct obj *otmp, boolean nodrop, boolean chainthere, long num)
1910{
1911 char *optr = 0, obuf[BUFSZ], xbuf[BUFSZ];
1912
1913 if (otmp->otyp == CORPSE) {
1914 /* Tobjnam() calls xname() and would yield "The corpse";
1915 we want more specific "The newt corpse" or "Medusa's corpse" */
1916 optr = upstart(corpse_xname(otmp, (char *) 0, CXN_PFX_THE));
1917 } else {
1918 optr = Tobjnam(otmp, (char *) 0);
1919 }
1920 Strcpy(obuf, optr);
1921
1922 if (num || chainthere) {
1923 /* As of 3.6.2: use a separate buffer for the suffix to avoid risk of
1924 overrunning obuf[] (let pline() handle truncation if necessary) */
1925 if (num) { /* means: other objects are impacted */
1926 Sprintf(xbuf, " %s %s object%s", otense(otmp, "hit"),
1927 (num == 1L) ? "another" : "other", (num > 1L) ? "s" : "");
1928 } else { /* chain-only msg */
1929 Sprintf(xbuf, " %s your chain", otense(otmp, "rattle"));
1930 }
1931 if (nodrop)
1932 Sprintf(eos(xbuf), ".");
1933 else
1934 Sprintf(eos(xbuf), " and %s %s.",
1935 otense(otmp, "fall"), gg.gate_str);
1936 pline("%s%s", obuf, xbuf);
1937 } else if (!nodrop)
1938 pline("%s %s %s.", obuf, otense(otmp, "fall"), gg.gate_str);
1939}
1940
1941/* migration destination for objects which fall down to next level */
1942schar

Callers 1

ship_objectFunction · 0.85

Calls 6

upstartFunction · 0.85
corpse_xnameFunction · 0.85
TobjnamFunction · 0.85
otenseFunction · 0.85
eosFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected