Re: New Class

From: Brian Gray (mandy@tmarts.com)
Date: 07/18/96


On Thu, 18 Jul 1996 goamkows@kirk.geog.sc.edu wrote:

> :P This got me thinking.  Would it be possible to associate the fighter
> :P class with the knight class?  What is mean is this:  Since the knight 
> :P will (for example) have all of the skills of a standard fighter, plus
> :P maybe some extras - would there be a way to do away with all of the
> :P checks (GET_CLASS(ch) != CLASS_KNIGHT) and avoid having to put them
> :P throughout the code?  
> 
> yeah, write your code in C++ and make classes objects :)
> the four basic classes become the base objects, and other classes can
> be derived from them.  this would even make multi-classing fairly
> easy, come to think of it, since you can have more than one base
> object (if i understand correctly, i'm still learning C++ :)

  You're on the right track.  Not having done it myself, I can only make 
a rough speculation of how I would do it, but I assume the classes would 
be structured approximately as follows...

                                   character
                                      |
                     +----------------+-----------------+
                     |                                  |
                  player                               mob
                     |                                  |
            +--------+--------+                        ...
            |                 |
         classes           races(?)
            |                 |
            +--------+--------+
                     |
     whatever the end product is called

  If you include classes AND races, you'd have to set up multiple 
inheritance and virtual classes and all sorts of fun stuff.  If there're 
no races, it just branches to each class inheriting player which inherits 
character.  Hmm...don't know where descriptor works in, but as mobs don't 
connect I would guess it's part of player.  There may even be a class 
more basic than character that describes objects and rooms too... 
after all, they also have at least names and descriptions, if nothing 
else in common.

 -- Mandy, Coding Director of The Multiplex
 -- telnet:pccs.cs.pomona.edu
 -- http://www.tmarts.com/Multiplex



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