Re: GUILD related layout

From: Web Remedies Network (webremedies@home.com)
Date: 03/28/01


Tony Robbins wrote:

> Since you're putting in the potential for any mob to
> teach a skill, you'll likely want to save the data as
> an E-Spec.
>
> Anyway, the structure you've created is fine, but
> instead of an array, you might lean toward:
>
> struct trainer_data *train;

Ok I realize I was wasting a little usage by specifying both
an array with elements pertaining to related spell/skill
numbers.  In turn the above was a great suggestion, either
I could initialize the array without the use of spell_num,
or create a pointer much like you have above, maintaining
the spell_num variable.

> Then, I'd recommend saving the data as an E-Spec, which
> you can look up in parse_espec.  It will take some
> modification, but on loading it, you could:

- Took a look at the function itself, mildly confusing
but other than that somewhat understood.

> struct trainer_data *new_train;
>
> CREATE(new_train, struct trainer_data, 1);

Stop me if I'm wrong, but this will direct the
pointer (new_train) to trainer_data, inturn
initializing each element of the structure to 1.

> new_train->next = mob->train_skills;
> new_train->... = /* parsed values */
> mob->train_skills = new_train;

- Ok, I believe your trying to say, run through the
assignment of the next value once, and then cycle it
like a look back onto itself.  I am a little confused
here, new_train->next(pointer to trainer_data *next) will
be set to mob?->train_skills (are you referring to me
initializing an element in mob_saved as to train_skills?
Sorry little jumbled here in my brain, with the
addition of mob and train_skills.

> By doing this, you'll only allocate as much memory as
> you need, and the only difference is you'll have to
> step through the list and be careful when removing
> stuff from the list.  It also means that in Oasis,
> using numbers in the interface won't translate as
> easily to array values.  To make it a little easier to
> remove stuff from the list, you might think about
> adding a "struct trainer_data *prev;" and linking it
> properly that way.  Then, when you go to remove
> something from the list:
>
> this_train->prev->next = this_train->next;
> this_train->next->prev = this_train->prev;
> free(this_train);

Would 'this_train' and prev. be declared something along the lines of:

 struct trainer_data *this_train
 struct *this_train *prev

may be totally off the wall here, apologize.
or rather are you referring to redoing the structure to something
similar to:

struct trainer_data {
 int spell_num;
 int percent;
 int cost;
 struct trainer_data *next;
 struct trainer_data *prev;
}

 struct trainer_data this_train

I realize, I was wasting space by initializing both the array
and spell_num element, when they would be identical.

- Sorry to be such a confusing S.O.B, and all the help so far
has been greatly appreciated.

- Am I still on the right path or am I venturing onto "moron" lane?

Bill
webremedies@home.com

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST