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

Function main

outdated/sys/mac/macmain.c:35–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33#endif
34
35int
36main(void)
37{
38 register int fd = -1;
39 int argc = 1;
40 boolean resuming = FALSE; /* assume new game */
41
42 early_init();
43 windowprocs = mac_procs;
44 InitMac();
45
46 gh.hname = "Mac Hack";
47 hackpid = getpid();
48
49 setrandom();
50 initoptions();
51 init_nhwindows(&argc, (char **) &gh.hname);
52
53 /*
54 * It seems you really want to play.
55 */
56 u.uhp = 1; /* prevent RIP on early quits */
57
58 finder_file_request();
59
60 dlb_init(); /* must be before newgame() */
61
62 /*
63 * Initialize the vision system. This must be before mklev() on a
64 * new game or before a level restore on a saved game.
65 */
66 vision_init();
67
68 init_sound_disp_gamewindows();
69
70 set_playmode(); /* sets plname to "wizard" for wizard mode */
71 /* strip role,race,&c suffix; calls askname() if plname[] is empty
72 or holds a generic user name like "player" or "games" */
73 plnamesuffix();
74 /* unlike Unix where the game might be invoked with a script
75 which forces a particular character name for each player
76 using a shared account, we always allow player to rename
77 the character during role/race/&c selection */
78 iflags.renameallowed = TRUE;
79
80 getlock();
81
82/*
83 * First, try to find and restore a save file for specified character.
84 * We'll return here if new game player_selection() renames the hero.
85 */
86attempt_restore:
87 if ((fd = restore_saved_game()) >= 0) {
88#ifdef NEWS
89 if (iflags.news) {
90 display_file(NEWS, FALSE);
91 iflags.news = FALSE; /* in case dorecover() fails */
92 }

Callers 2

mrecover.cFile · 0.70
winmain.cFile · 0.50

Calls 15

early_initFunction · 0.85
InitMacFunction · 0.85
initoptionsFunction · 0.85
finder_file_requestFunction · 0.85
dlb_initFunction · 0.85
vision_initFunction · 0.85
set_playmodeFunction · 0.85
plnamesuffixFunction · 0.85
restore_saved_gameFunction · 0.85
dorecoverFunction · 0.85
YouFunction · 0.85

Tested by

no test coverage detected