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

Function moveloop_preamble

src/allmain.c:47–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47staticfn void
48moveloop_preamble(boolean resuming)
49{
50 /* if a save file created in normal mode is now being restored in
51 explore mode, treat it as normal restore followed by 'X' command
52 to use up the save file and require confirmation for explore mode */
53 if (resuming && iflags.deferred_X)
54 (void) enter_explore_mode();
55
56 /* side-effects from the real world */
57 flags.moonphase = phase_of_the_moon();
58 if (flags.moonphase == FULL_MOON) {
59 You("are lucky! Full moon tonight.");
60 change_luck(1);
61 } else if (flags.moonphase == NEW_MOON) {
62 pline("Be careful! New moon tonight.");
63 }
64 flags.friday13 = friday_13th();
65 if (flags.friday13) {
66 pline("Watch out! Bad things can happen on Friday the 13th.");
67 change_luck(-1);
68 }
69
70 if (!resuming) { /* new game */
71 program_state.beyond_savefile_load = 1; /* for TTY_PERM_INVENT */
72 svc.context.rndencode = rnd(9000);
73 set_wear((struct obj *) 0); /* for side-effects of starting gear */
74 reset_justpicked(gi.invent);
75 (void) pickup(1); /* autopickup at initial location */
76 /* only matters if someday a character is able to start with
77 clairvoyance (wizard with cornuthaum perhaps?); without this,
78 first "random" occurrence would always kick in on turn 1 */
79 svc.context.seer_turn = (long) rnd(30);
80 /* give hero initial movement points; new game only--for restore,
81 pending movement points were included in the save file */
82 u.umovement = NORMAL_SPEED;
83 initrack();
84 }
85 disp.botlx = TRUE; /* for STATUS_HILITES */
86 if (resuming) { /* restoring old game */
87 read_engr_at(u.ux, u.uy); /* subset of pickup() */
88 fix_shop_damage();
89 }
90
91 encumber_msg(); /* in case they auto-picked up something */
92 if (gd.defer_see_monsters) {
93 gd.defer_see_monsters = FALSE;
94 see_monsters();
95 }
96
97 u.uz0.dlevel = u.uz.dlevel;
98 svc.context.move = 0;
99
100 /* finish processing "--debug:fuzzer" from the command line */
101 if (iflags.fuzzerpending) {
102 iflags.debug_fuzzer = fuzzer_impossible_panic;
103 iflags.fuzzerpending = FALSE;
104 }

Callers 1

moveloopFunction · 0.85

Calls 15

enter_explore_modeFunction · 0.85
phase_of_the_moonFunction · 0.85
YouFunction · 0.85
change_luckFunction · 0.85
friday_13thFunction · 0.85
rndFunction · 0.85
set_wearFunction · 0.85
reset_justpickedFunction · 0.85
pickupFunction · 0.85
initrackFunction · 0.85
read_engr_atFunction · 0.85
fix_shop_damageFunction · 0.85

Tested by

no test coverage detected