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

Function MAIN

outdated/sys/be/bemain.c:21–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#endif
20
21int
22MAIN(int argc, char **argv)
23{
24 int fd;
25 char *dir;
26 boolean resuming = FALSE; /* assume new game */
27
28 early_init();
29
30 dir = nh_getenv("NETHACKDIR");
31 if (!dir)
32 dir = nh_getenv("HACKDIR");
33
34 choose_windows(DEFAULT_WINDOW_SYS);
35 chdirx(dir);
36 initoptions();
37
38 init_nhwindows(&argc, argv);
39 whoami();
40
41 /*
42 * It seems you really want to play.
43 */
44 u.uhp = 1; /* prevent RIP on early quits */
45 process_options(argc, argv); /* command line options */
46
47 set_playmode(); /* sets plname to "wizard" for wizard mode */
48 /* strip role,race,&c suffix; calls askname() if plname[] is empty
49 or holds a generic user name like "player" or "games" */
50 plnamesuffix();
51 /* unlike Unix where the game might be invoked with a script
52 which forces a particular character name for each player
53 using a shared account, we always allow player to rename
54 the character during role/race/&c selection */
55 iflags.renameallowed = TRUE;
56
57 getlock();
58
59 dlb_init(); /* must be before newgame() */
60
61 /*
62 * Initialize the vision system. This must be before mklev() on a
63 * new game or before a level restore on a saved game.
64 */
65 vision_init();
66
67 init_sound_disp_gamewindows();
68
69 /*
70 * First, try to find and restore a save file for specified character.
71 * We'll return here if new game player_selection() renames the hero.
72 */
73attempt_restore:
74 if ((fd = restore_saved_game()) >= 0) {
75#ifdef NEWS
76 if (iflags.news) {
77 display_file(NEWS, FALSE);
78 iflags.news = FALSE; /* in case dorecover() fails */

Callers

nothing calls this directly

Calls 15

early_initFunction · 0.85
choose_windowsFunction · 0.85
initoptionsFunction · 0.85
set_playmodeFunction · 0.85
plnamesuffixFunction · 0.85
dlb_initFunction · 0.85
vision_initFunction · 0.85
restore_saved_gameFunction · 0.85
dorecoverFunction · 0.85
YouFunction · 0.85
nh_compressFunction · 0.85

Tested by

no test coverage detected