Real Time Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CF: object structure layout.
- To: crossfire mailing list <crossfire (at) ifi.uio.no>
- Subject: Re: CF: object structure layout.
- From: Christian Stieber <>
- Date: Mon, 14 Jun 1999 15:08:08 +0200
- In-Reply-To: <>; from Mark Wedel on Sun, Jun 13, 1999 at 07:26:55AM +0000
- Mail-Followup-To: crossfire mailing list <>
- References: <>
- Sender:
On Sun, Jun 13, 1999 at 07:26:55AM +0000, Mark Wedel wrote:
> ...
> Now there would still be some differences between the two - players
> still have the socket code and spells to deal with. Monsters might
> still match messages. But making the two more common just seemed
> like it would give a lot more options for customizing both players
> and monsters. Any thoughts/suggestions?
Make it a class hierarchy. It probably needs some thinking to put it
into a single-inheritance hierarchy (multiple inheritance probably is
too ugly in C).
Something like this:
struct Object
{
int Type; /* immediate subtypes, i.e. types that start with a "Object" */
int x,y;
struct Map *Map;
...
};
struct Monster
{
struct Object Object;
int Type; /* immediate subtypes, i.e. types that start with a "Monster" */
int Race;
int Str;
...
};
struct Player
{
struct Monster Monster;
struct PlayerSocket PlayerSocket;
...
};
struct Item
{
struct Object Object;
int FireProtection;
...
};
struct Armor
{
struct Item Item;
int AC;
int Armor;
};
struct Weapon
{
struct Item Item;
int Damage;
};
struct EdgedWeapon
{
struct Weapon Weapon;
int Sharpness;
};
Things like this. Thatīs just how I would probably do it --- but then, I
this is just a "first idea without any thinking", so please donīt shoot
me if it sucks :-)
Christian
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to ]