Re: Seeing spec procs on in do_stat_mob

From: Erwin S. Andreasen (erwin@PIP.DKNET.DK)
Date: 11/13/97

On Thu, 13 Nov 1997, John Evans wrote:

> >  I will again grumble about how to know if one certain spec was hanged to
> > the one certain mob... :I
> >
> I'm working on code now that will not just show "SpecProc" when you stat
> a mob, but will give you the name of the spec proc as well. I don't know
> if it is even possible without some major changes, but I'm working on it
> because it's a very good idea. :)

It certainly is; just have some table set up like:

/* Three times the fun! */
#define SPECNAME(fun) { fun, #fun },

        SpecFun *fun;
        char *name;
specfun_names[] =

        {NULL, NULL} /* to terminate the table */

This will generate something like:

{ spec_something, "spec_somethig" }

(somewhat easier than having to type spec_something then

If you come from a non-C background you may frown at those preprocessor
tricks, but I use whatever will allow me to add something in just one
place, and automatically update the table without me having to type the
same thing in N times.

Anyway, you'd then just run through this table, match spec fun pointers
and then return the appropriate string. And the other way when you want to
lookup a spec fun pointer from a string when loading the areas (which
AFAICS stock circle does not do right now, but assigns the spec fun via
hardcoding - which seems a bit an unfortunate way to do this; I guess this
was something inherited from Diku).

Erwin Andreasen   Herlev, Denmark <>  UNIX System Programmer
<URL:>         <*>           (not speaking for) DDE

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

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