Re: Proposal for the skills array

From: Jesse Becker (
Date: 11/05/02

On Tue, 5 Nov 2002, George Greer wrote:

> You could change the skill list to be a pointer to an array.  If the mobile
> has no skills, point it at dummy_mob's skill list.  If they have skills,
> you give them the full array and fill in the values.  Only change would be
> some . to -> conversions, excluding the obvious "can't save a pointer"
> problem but that's in a linked list too.  If you've already done the linked
> list then it's not worth going back to.

Interesting idea...  I'll take a look at how that'd affect my code.

Saving and reading skills is fairly simple, since it's just text parsing.
I had to tweak the parser to accept 3 bits of data, instead of the usual
two.  Mobs with skills must be E class mobs, and each skill is stored in
the file as "M <skill> <level>", but that was easy enough.  When loading
the mob, you build the linked list node by node, when saving, you just
walk the list and write out each line as needed.

If you store the entire array, that would also make the .mob files larger,
unless you stored only the non-zero values.  The other downside having
each mob have an entire array of skills is that you have to then keep a
second list of which ones they can actually use; otherwise you have to do
a linear search on the array for each mob to determine what skills the can
use.  If you have a list, then you just walk the list (which will almost
always be very short).


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT