Re: Modulizing "Added Spells, Skills, Commands, etc"

From: Fizal (amustapa@gamebox.net)
Date: 08/21/00


Just wanted to ask a few questions to Melissa Jadwinski, or anyone else for
that matter:

>struct spell_info_type {
>   char *name;          /* name of spell */
>   char *plural;        /* plural name of spell */

Why noting the plural name of the spell/skill?  Are you making a generic
message for all of them?

>   byte min_position;   /* Position for caster   */
>   int mana_min;        /* Min amount of mana used by a spell (highest
lev) */
>   int mana_max;        /* Max amount of mana used by a spell (lowest lev) */
>   int mana_change;     /* Change in mana used by spell from lev to lev */
>
>   int min_level[NUM_CLASSES];   /* must == num_classes in structs.h */
>   int routines;
>   byte violent;
>   int targets;         /* See below for use with TAR_XXX  */
>   long type;           /* SPL_XXX. Mana-spell/skill/memorize-spell? */
>   int spell_level;     /* Rank of the spell, for wizard spells use 0 for
>nonwizards */
>   byte deleted;        /* don't write spell to file */
>   int sortpos;         /* this spell's # in alphabetical order of all
>spells */
>
>   char *wearoff;       /* spell/skill wearoff message */
>
>.. and so on... (info about damdice, healdice, affect bits etc. excerpted)

The structure is somewhat similar to SMAUG/MERC codebase.  With all these
info, wouldn't it be better if you group all related info into a structure
first and then include them in the main one?  I mean:

struct damage_spell {
  damdice, etc
}

struct affect_spell {
  affect bits, duration, etc
}

struct spell_info_type {
  basic info
  struct damage_spell *damage;
  struct affect_spell *affects;
  etc, etc
}

Coz from my POV, seems like there's a lot of memory being wasted since not
all of them are being used.  Especially when declaring a skill, which only
uses name, plural, and sortpos... unless you're using the damdice to calc
the damage of the skill as well.  You might do this to ease the adding of
your 300+ spells, but also remember that we're using the same structure to
keep track of skills as well which will bound to increase together with the
number of spells.

Are you trying to create SpellOLC which allows imp to create/remove/edit
spells/skills online, or just reading in the primary data from a textfile?
I was planning to do something like a SpellOLC, but decided to shelf it
first.  I came up with several ways to do it, but didn't like any one of
them... except for scripting.  But then again, haven't got the time to sit
down and think about it properly yet.... *Shrug*

Any comments?

---

Afizal Mustapa
Petaling Jaya, Selangor, Malaysia.
(amustapa@hotmail.com)


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT