Difference between revisions of "Source talk:NetHack 3.4.3/include/obj.h"

From NetHackWiki
Jump to navigation Jump to search
Line 1: Line 1:
Why all the gratuitous "to code multiplayer nethack is difficult, because..." sentences?
+
Why all the gratuitous "to code multiplayer nethack is difficult, because..." sentences? {{unsigned|62.148.103.224|16 August 2006}}
 +
 
 +
 
 +
----
  
  

Revision as of 12:39, 16 August 2006

Why all the gratuitous "to code multiplayer nethack is difficult, because..." sentences? — Preceding unsigned comment added by 62.148.103.224 (talkcontribs) 16 August 2006




An object is normally allocated to have extra space after the end of the struct. Using ONAME(thing) retrieves some text from this extra space. I think that ONAME probably contains the name left with the #name command (such as "cursed" or "REAL", if you ever have a "yellow potion named cursed" or an "Amulet of Yendor named REAL"), however I would have to examine do_name.c more carefully to learn the details. I find this approach difficult to understand.

When you give a longer #name to an object, you would have to reallocate it, thus possibly making invalid any pointers to that object. It appears that in do_name.c, do_oname calls oname which calls realloc_obj to do this. This process feels all unnecessary to me because I would have put a char* in the struct and allocated the name string separately. --Kernigh 20:07, 19 June 2006 (UTC)