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

Function newgame

src/allmain.c:765–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

763}
764
765void
766newgame(void)
767{
768 int i;
769
770 /* make sure welcome messages are given before noticing monsters */
771 notice_mon_off();
772 disp.botlx = TRUE;
773 svc.context.ident = 2; /* id 1 is reserved for gy.youmonst */
774 svc.context.warnlevel = 1;
775 svc.context.next_attrib_check = 600L; /* arbitrary first setting */
776 svc.context.tribute.enabled = TRUE; /* turn on 3.6 tributes */
777 svc.context.tribute.tributesz = sizeof(struct tribute_info);
778 get_nhuuid();
779
780 for (i = LOW_PM; i < NUMMONS; i++)
781 svm.mvitals[i].mvflags = mons[i].geno & G_NOCORPSE;
782
783 init_objects(); /* must be before u_init() */
784
785 flags.pantheon = -1; /* role_init() will reset this */
786 role_init(); /* must be before init_dungeons(), u_init(),
787 * and init_artifacts() */
788
789 init_dungeons(); /* must be before u_init() to avoid rndmonst()
790 * creating odd monsters for any tins and eggs
791 * in hero's initial inventory */
792 init_artifacts(); /* before u_init() in case $WIZKIT specifies
793 * any artifacts */
794 u_init_misc();
795
796 l_nhcore_init(); /* create a Lua state that lasts until end of game */
797 reset_glyphmap(gm_newgame);
798#ifndef NO_SIGNAL
799 (void) signal(SIGINT, (SIG_RET_TYPE) done1);
800#endif
801#ifdef NEWS
802 if (iflags.news)
803 display_file(NEWS, FALSE);
804#endif
805 /* quest_init(); -- Now part of role_init() */
806
807 mklev();
808 u_on_upstairs();
809 vision_reset(); /* set up internals for level (after mklev) */
810 check_special_room(FALSE);
811
812 if (MON_AT(u.ux, u.uy))
813 mnexto(m_at(u.ux, u.uy), RLOC_NOMSG);
814 (void) makedog();
815
816 u_init_inventory_attrs();
817 docrt();
818 flush_screen(1);
819 bot();
820 while (u.uroleplay.reroll && reroll_menu()) {
821 u_init_inventory_attrs();
822 bot();

Callers 7

mainFunction · 0.85
libnhmain.cFile · 0.85
MAINFunction · 0.85
mainFunction · 0.85
pcmainFunction · 0.85
MAINFunction · 0.85
mainFunction · 0.85

Calls 15

init_objectsFunction · 0.85
role_initFunction · 0.85
init_dungeonsFunction · 0.85
init_artifactsFunction · 0.85
u_init_miscFunction · 0.85
l_nhcore_initFunction · 0.85
reset_glyphmapFunction · 0.85
mklevFunction · 0.85
u_on_upstairsFunction · 0.85
vision_resetFunction · 0.85
check_special_roomFunction · 0.85
mnextoFunction · 0.85

Tested by

no test coverage detected