[Circle] [code] Room affections in world files

From: The Arrow (pt94jpi@student.hk-r.se)
Date: 08/07/96


Well, it was so easy to allowing setting of room affections in the world files, 
that I did it.

It is very, very simple! :)

In the file db.c (where else? :), in the function parse_room(), look for 
the line
  sprintf(buf, "Format error in room #%d (expecting D/E/S)", virtual_nr);
and change it to:
  sprintf(buf, "Format error in room #%d (expecting D/E/A/S)", virtual_nr);

Then before the "case 'S':" statement, add this case statement:
		case 'A':
			if (!get_line(fl, line)) {
				fprintf(stderr, "Format error in room #%d, " \
					"expecting flag field after 'A'.\n",
					virtual_nr);
				exit(1);				
			}
			world[room_nr].room_affections = asciiflag_conv(line);
			break;

You can of course change the error message, or the letter 'A' to what 
ever you like :)

This piece of code, and the room affection code in general is tested, but 
only for a single case (room/spell). It should be general enough though.

PS. If you use the room affection code, a small note in some credits 
somewhere (like in "help credits") would be apreciated.

/ Joachim

 ---------------------------------------------------------------------
  The Arrow              Moses@PTMUD   sargasso.fukt.hk-r.se 4000

  Joachim Pileborg       Email: pt94jpi@student.hk-r.se
  Svarvarevägen 5
  37230 Ronneby          http://www.rby.hk-r.se/~pt94jpi/pt94jpi.html
  SWEDEN
---------------------------------------------------------------------


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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