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

Function new_book_description

src/write.c:394–418  ·  view source on GitHub ↗

most book descriptions refer to cover appearance, so we can issue a message for converting a plain book into one of those with something like "the spellbook turns red" or "the spellbook turns ragged"; but some descriptions refer to composition and "the book turns vellum" looks funny, so we want to insert "into " prior to such descriptions; even that's rather iffy, indicating that su

Source from the content-addressed store, hash-verified

392 even that's rather iffy, indicating that such descriptions probably
393 ought to be eliminated (especially "cloth"!) */
394staticfn char *
395new_book_description(int booktype, char *outbuf)
396{
397 /* subset of description strings from objects.c; if it grows
398 much, we may need to add a new flag field to objects[] instead */
399 static const char *const compositions[] = {
400 "parchment",
401 "vellum",
402 "cloth",
403#if 0
404 "canvas", "hardcover", /* not used */
405 "papyrus", /* not applicable--can't be produced via writing */
406#endif /*0*/
407 0
408 };
409 const char *descr, *const *comp_p;
410
411 descr = OBJ_DESCR(objects[booktype]);
412 for (comp_p = compositions; *comp_p; ++comp_p)
413 if (!strcmpi(descr, *comp_p))
414 break;
415
416 Sprintf(outbuf, "%s%s", *comp_p ? "into " : "", descr);
417 return outbuf;
418}
419
420/*write.c*/

Callers 1

dowriteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected