New DB routines.

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 08/27/97

On the way home from a SAN283 (Data Communications and Client/Server
Applications) I was thinking about a new system unrelated to sockets but of
reworking the way the DB routines worked.  The professor had to give a
lecture on UNIX and C because there were ENT (Engineering Technologies)
students there that had not taken a programming course and in that lecture
he talked about functions which re-sparked my idea a few weeks ago to make
the loading and parsing of the world files a little more neat.

Basically I had it tiered such as this (using mobiles as an example):
Boot db

load_all(mobiles) figures out the correct index file and passes it's FILE *
to parse_index().  parse_index() then reads every line in the index and
calls read_file(FILE *).  read_file() then takes that whole
mob file.  It passes it to parse_mobiles() which then parses the
information and returns the number of characters used placing the mob
structure in the address given as an argument.  Those all loop until
finished placing the informationinto the mob_proto structure that was
allocated through a count of the mobiles total as usual.

The beauty of this would be that instead of prototyping a mobile and then
loading it to modify, you could create the string to be parsed on the fly
and then load it.  Like:

struct mob_data * x= parse_mobiles("puff~\npuff~\na dragon~\n1 23\netc\n");
if (x) char_to_room(x, r_mortal_start_room);

And of course, sprintf()'s could tailor the mob and allow the parse_mobile
code to transfer it to the correct structure.

The existing code already has a structure something like this but must
originate from a file.

Won't break anything...but would be useful for making zombies, unique mobs,
and other things on the fly that don't need to be prototyped. (a la animate
dead, summon, etc.)

I'll start work on a patch that will do this but was interested in what
people think of the new possibilities. (Or we could even get funny and not
load the mobs from disk until they are actually accessed with it, or
perhaps don't load a zone until someone goes there, or load rooms unless
someone enters it, etc, with minor changes.)

-- | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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