Re: [SMAUG] tables
Re: [SMAUG] tables
Well, just to let everyone know, you can eliminate one of the 'tables' in
tables.c by adding a 'code' variable to the skill and command structures.
The skill_name and spell_name table functions are utterly useless from what
I've seen.
I eliminated those tables by adding the variable, and in doing so I dropped
16k off my compile size, I lost no RAM usage (it stayed the same), and I got
the added benefit of only needing to make one entry into tables.c.
Someone mentioned that this could be done with spec_funs as well, I believe
(I may be wrong about that), but I've not checked into it yet. But, overall,
I get to be a bit lazier, I lost no RAM usage, my exe size is smaller, and
also the tables are gone thus making the full package of Chronicles smaller.
It's not a full step into making it totally automated, but it's a nice
beginning I think. :)
The modification in question will be in the next version of the Chronicles
codebase, by the way, for those who wish to see it in use. Though, most of
the people on this list would probably be able to pull it off (it's an easy
change) with little effort. :)
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--
Orion Elder
* Chronicles -
http://www.mudplanet.org/chronicles
* MUD-Con -
http://www.mudplanet.org/mudcon
* MUD Planet Administrator -
http://www.mudplanet.org/
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--
----- Original Message -----
From: "Xerves" <xerves@rafermand.net>
To: "Cronel" <pejro@millicom.com.ar>
Cc: <smaug@realms.game.org>
Sent: Sunday, December 29, 2002 2:12 PM
Subject: Re: [SMAUG] tables
| I think I already did something similiar. I released a small program in
| C that can modify the tables.c and mud.h file and add the do_ files
| in. Just download, install it into the code (which can be the difficult
| part, rofl) and then type
|
| insertskill do_newskill
|
| And it adds it in. It isn't pretty but it works. I guess I am waiting
| till someone figures a way to do it online without rebooting, laugh.
|
| --X
|
| Cronel wrote:
|
| >Well, I'd posted on the dlsym thread on tms but it got eaten by the
crash.
| >Samson, since you asked, there is another way to be lazy about the tables
and
| >forget about them: have them automatically generated by a preprocessor
based
| >on the headers. Like so:
| >
| >#!/usr/bin/perl
| >print "DO_FUN *skill_function( char *name )\n";
| >print "{\n";
| >while( <> ) {
| > if( /^DECLARE_DO_FUN\(\s*(.*?)\s*\);$/ ) {
| > print " if( str_cmp(name, \"$1\") ) return $1;\n";
| > }
| >}
| >print " return skill_notfound;\n";
| >print "}\n\n\n";
| >
| >Run like 'script.pl <mud.h' and it should print a simplified version of
| >skill_function. Do it for all 4 functions and add it to the build and
that's
| >it. This way all you need to do is DECLARE_DO_FUN them.
| >
| >If anyones interested let me know.
| >
| >--cronel
| >
| >
| >
| >
|
|