Re: [Code] Different structures

From: Rasdan (thomajam@ucs.orst.edu)
Date: 02/13/97


I haven't implemented the changing of the structure types, but I have 
added significantly to them. All I did then was modify db.c to account 
for the change like this:

  First, in structs.h, in the room structure, add
	int new_value;		

Then in parse_room, where it loads the room flags, do:

  get_line(fl, line);

  if (sscanf(line, " %d %s %d %d", t, flags, t + 2, t + 3) == 4)
  {

  /* t[0] is the zone number; ignored with the zone-file system */
  world[room_nr].room_flags = asciiflag_conv(flags);
  world[room_nr].sector_type = t[2];
  world[room_hr].new_value = t[3];
  }
else
  if (sscanf(line, " %d %s %d", t, flags, t + 2) == 3)
  {

  /* t[0] is the zone number; ignored with the zone-file system */
  world[room_nr].room_flags = asciiflag_conv(flags);
  world[room_nr].sector_type = t[2];
  world[room_nr].new_value = (a default value, if one isn't in the file);
  }
else
  {
    fprintf(stderr, "Format error in room #%d\n", virtual_nr);
    exit(1);
  }

That way, you don't have to go through all your world files and change 
each occurence, the code will recognize each of the different types.

I have done this all over db.c, not just in parse_room. Seems to work 
fine for me.

Hope this was of any help (or provided a clue at all),

Rasdan

> That's a really good idea.  Has anyone implemented this code or something
> similar to it?
> 

         =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	                   James C. Thomas Jr.
         thomajam@ucs.orst.edu            rasdan@necromium.com 

		If ya want to build, or code, check out:

		      finality.mudservices.com 5555
		   =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST