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

Function welcome

src/allmain.c:853–929  ·  view source on GitHub ↗

show "welcome [back] to NetHack" message at program startup */

Source from the content-addressed store, hash-verified

851
852/* show "welcome [back] to NetHack" message at program startup */
853void
854welcome(boolean new_game) /* false => restoring an old game */
855{
856 char buf[BUFSZ];
857 boolean currentgend = Upolyd ? u.mfemale : flags.female,
858 adrift = (u.ualign.type != u.ualignbase[A_CURRENT]);
859
860 l_nhcore_call(new_game ? NHCORE_START_NEW_GAME : NHCORE_RESTORE_OLD_GAME);
861
862 /* skip "welcome back" if restoring a doomed character */
863 if (!new_game && Upolyd && ugenocided()) {
864 /* death via self-genocide is pending */
865 pline("You're back, but you still feel %s inside.", udeadinside());
866 return;
867 }
868
869 if (Hallucination)
870 pline("NetHack is filmed in front of an undead studio audience.");
871
872 /*
873 * The "welcome back" message always describes your innate form
874 * even when polymorphed or wearing a helm of opposite alignment.
875 * Alignment is shown unconditionally for new games; for restores
876 * it's only shown if it has changed from its original value.
877 * Sex is shown for new games except when it is redundant; for
878 * restores it's only shown if different from its original value.
879 */
880 *buf = '\0';
881#if 0
882 if (new_game || u.ualignbase[A_ORIGINAL] != u.ualignbase[A_CURRENT])
883 Sprintf(eos(buf), " %s", align_str(u.ualignbase[A_ORIGINAL]));
884#else
885 /*
886 * 2026-04-24
887 * GitHub issue https://github.com/NetHack/NetHack/issues/537
888 * "Judging by the comment above, it should display your new alignment
889 * if it was changed, so align_str(u.ualignbase[A_CURRENT]) would
890 * probably be more appropriate. This won't affect the new game message."
891 *
892 * That is followed by a suggestion to revisit the matter (paraphrased):
893 * "That's actually intentional; the comment oversimplifies.
894 * When it was implemented, it may have been the only way to tell that
895 * you had converted alignment. Now ^X mentions your starting alignment
896 * if base alignment has been changed, so revisiting this welcome back
897 * message."
898 */
899 if (new_game || u.ualignbase[A_ORIGINAL] != u.ualignbase[A_CURRENT] || adrift)
900 Sprintf(eos(buf), " %s%s",
901 adrift ? "adrift " : "",
902 adrift ? align_str(u.ualign.type)
903 : align_str(u.ualignbase[A_CURRENT]));
904#endif
905 if (!gu.urole.name.f
906 && (new_game
907 ? (gu.urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE)
908 : currentgend != flags.initgend))
909 Sprintf(eos(buf), " %s", genders[currentgend].adj);
910 Sprintf(eos(buf), " %s %s", gu.urace.adj,

Callers 2

newgameFunction · 0.85
dorecoverFunction · 0.85

Calls 10

l_nhcore_callFunction · 0.85
ugenocidedFunction · 0.85
udeadinsideFunction · 0.85
eosFunction · 0.85
align_strFunction · 0.85
HelloFunction · 0.85
livelog_printfFunction · 0.85
hellish_smoke_mesgFunction · 0.85
print_level_annotationFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected