Re: Change to spell system

From: Andrew Ritchie (object@ALPHALINK.COM.AU)
Date: 09/04/98


<snip>

>command and finds the spell being cast. Then it passes the spell number,
>caster data, and the argument (Whatever is inside the ' ') to a function. This
>is simply a huge switch containing each SPELL_XXXX. So this means that each
>spell has its own code, and not just a generic, boring spell. Now this might

<snip>

Personally I don't think that a huge switch statement is the way to go in any
code, although sometimes it is unavoidable. However, a huge switch statement
will take quite a long time (in computer speed) to process all the spells -
especially if you have a decent number (200+) of spells. The best way to go
I think is to catogorise them, but possibly in a different way than it is
now. If you categorise the spells, there can be a simple and effecient switch
to determiune the type of spell, then you can use a switch statement to work
out what spell it was. Ie, you wouldn't go through all the spells, just the
ones that are in that spell's category, maybe 30 out of 200. That is the whole
point of categories - to find things faster.

| Andrew Ritchie, object@alphalink.com.au.
| Farewell Mr. Fred Greedy - know that you
| will be missed.


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



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