Does anyone know where the ncurses initialization code is? And for that matter, where the code to draw the player is? ~Lewis

All of the windowport specific code is in win-subdir, for this it's tty_startup() in in win/tty/termcap.c. The code to "draw the player" (and other display stuff) is in display.c, see for example flush_screen in display.c --paxed 06:51, April 13, 2010 (UTC)

Is nethack vanilla C or ANSI C? -- PraetorFenix 03:26, 25 June 2006 (UTC)

It's definitely not ANSI C, but I don't know exactly which specification it tries to adhere to. --Jayt 18:04, 25 June 2006 (UTC)
I have started an ANSI C article. It seems that NetHack is sometimes in ANSI C, but sometimes not, depending on conditions in tradstdc.h. (Having source code here helped me much in starting an ANSI C page.) --Kernigh 04:52, 29 June 2006 (UTC)

In the Source Code what files define the corpse weights? -- PraetorFenix 08:43, 25 June 2006 (UTC)

They're in monst.c#line101. The first number in that line says giant ants (and also their corpses) have weight 10. --Jayt 18:04, 25 June 2006 (UTC)

What does it mean to be able to "annotate" the code on this wiki? Is it just the ability to provide links to the code on other wiki pages, or could we add in commentary on the source page itself? 19:09, 10 July 2006 (UTC)

Kernigh writes: It is a wiki, so you could try anything! Just go to a source code page, click "edit" and do something interesting...
For example, I have been reading artifact.c and saving my notes about artifact invocations in there. The one thing that we are not doing is that we are not editing the C code itself. However, it is possible to use square brackets to insert links. --Kernigh 02:07, 11 July 2006 (UTC)
I would add that the overall goal of annotation is to explain the source code; in particular, to document what each bit means in terms of gameplay. So you can add any kind of annoation between source code lines, but it would be nice to keep comments like "What the hell was he on when he wrote rnz()?" to the discussion pages :-) --Jayt 13:52, 11 July 2006 (UTC)

Function/macro reference Edit

I've been thinking about making a page that lists all the functions and macros in the source, with links to the point where it is defined. Any thoughts on that before I start doing it? GreyKnight 02:19, 23 August 2006 (UTC)

I think it'd be a wonderful reference. I've been going through the source and adding h2 tags to function definitions, so part of the work is done. I haven't been doing macros though, because they're generally only one line long; for those I suppose you can just link to file.ext#lineN. --Eidolos 04:21, 23 August 2006 (UTC)
I also like this. Are you aware of Doxygen? If you can figure out how to customize its output, then it will do all the heavy lifting for you, depending on what it is you have in mind. --Jayt 21:40, 25 August 2006 (UTC)
Ctags (probably in your emacs package) might be closer to what is needed here:
$ ctags -o /dev/fd/1 -x *.c | awk '// {print "* [[" $3 "#line" $2 "|" $1 "]]" }'
* [[wizard.c#line300|tactics]]
* [[sit.c#line9|take_gold]]
* [[do_wear.c#line1932|take_off]]
* [[invent.c#line729|taking_off]]
* [[dog.c#line745|tamedog]]
* [[wizard.c#line218|target_on]]
* [[teleport.c#line398|tele]]
* [[teleport.c#line185|tele_jump_ok]]
* [[teleport.c#line1048|tele_restrict]]
* [[teleport.c#line841|tele_trap]]
--Stefanor 08:18, 3 September 2006 (UTC)
paxed and I have gone through each function and tagged it with its name (there may be a few files left, I'll take care of those). So [[wizard.c#tactics|tactics]] would be usable, for example. If I had remembered ctags I probably would've automated the process long ago. But the benefit of doing it the arduous way is that, unlike ctags, a human can better distinguish where the start of the function is. This is mainly a problem with comments. See, for example, teleport.c#tele_jump_ok versus teleport.c#line185 (tele_jump_ok). --Eidolos 18:03, 3 September 2006 (UTC)

Files generated by makedefs.c Edit

Am I right in thinking that some of the missing files here (those generated by makedefs.c) may vary depending on platform and config.h options? If so, we should probably include a "typical" version and mark it as such. --Jayt 23:00, 26 August 2006 (UTC)

This is at least true of vis_tab.c; if VISION_TABLES is enabled, a longer form of it is generaed. --Ray Chason 01:08, 27 August 2006 (UTC)

Starting inventory and pet Edit

In what file are the starting inventory and pet for a given role defined? --Dr. 8-Bit 01:31, April 30, 2010 (UTC)

Starting inventories are in u_init.c, line 25, default pets are in role.c, line 40 at that position on the struct. (it's the last value on that line. NON_PM means random) --paxed 08:16, April 30, 2010 (UTC)
The role-struct is pretty well documented in you.h, line 75. --paxed 08:17, April 30, 2010 (UTC)
Ah, thank you. If anyone knows where the inventory for monsters is, that'd be helpful too; for now I'll be making new roles. Dr. 8-Bit 16:39, April 30, 2010 (UTC)
Also, I'd like to know where the encyclopedia is defined. Dr. 8-Bit 17:02, April 30, 2010 (UTC)
The items monsters get are defined eg. in m_initweap in makemon.c, m_initinv in makemon.c, mongets in makemon.c, makemon in makemon.c. Encyclopedia entries are defined in dat/data.base. --paxed 07:20, May 1, 2010 (UTC)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.