/*
....[@@@..[@@@..............[@.................. MUD++ is a written from
....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and
....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++.
....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing
....[@......[@..[@@@@@..[@@@@@.................. development project.  All 
................................................ contributions are welcome. 
....Copyright(C).1995.Melvin.Smith.............. Enjoy. 
------------------------------------------------------------------------------
Melvin Smith (aka Fusion)         msmith@hom.net 
MUD++ development mailing list    mudpp@van.ml.org
------------------------------------------------------------------------------
npc.h
*/
#ifndef _NPC_H
#define _NPC_H
#include "char.h"
extern const bitType npc_bit_list[];
const int NPC_UNDEFINED		= 0;  // Dont use !
const int NPC_UNUSED1		= 1;
const int NPC_WIMPY			= 2;
const int NPC_AGGRESSIVE	= 3;
const int NPC_SENTINEL		= 4;
const int NPC_STAY_ZONE		= 5;
const int NPC_SCAVENGER		= 6;
const int NPC_FRIENDLY		= 7;
const int NPC_TAME			= 8;
const int NPC_CHARMED		= 9;
const int NPC_BANKER		= 10; 
const int NPC_TRAINER		= 11;
const int NPC_PRACTICER		= 12;
const int MAX_NPC_BIT_FIELDS	= 1;
inline int getNPCBit( const String & x )
{
	return lookupBit( npc_bit_list, x );
}
inline const char * getNPCBitName( int x )
{
	return lookupBitName( npc_bit_list, x );
}
class NPC : public Char
{
	private:
		static int total_count;
	protected:
		//Index index;
		unsigned long npc_bits[ MAX_NPC_BIT_FIELDS ];
		Repop *repop;
	public:
		NPC()
		:	repop(0)
		{
			total_count++;
			memset( npc_bits, 0, sizeof( npc_bits[0] ) * MAX_NPC_BIT_FIELDS );
		}
		NPC( const NPC & x )
		:	Char( x ),   // propagate up the hierarchy
			repop(0)
		{
			total_count++;
			memcpy( (void *)npc_bits, (void *)x.npc_bits,
								sizeof( npc_bits[0] ) * MAX_NPC_BIT_FIELDS );
		}
		virtual ~NPC();
		virtual vmtype getVMType() { return VMT_NPC; }
 
		bool isNPC() const { return true; }
		void setNPCBit( int x ) { SET_BIT( npc_bits, x ); }
		void clrNPCBit( int x ) { CLR_BIT( npc_bits, x ); }
		void toggleNPCBit( int x ) { TOGGLE_BIT( npc_bits, x ); }
		bool NPCBitSet( int x ) { return IS_SET( npc_bits, x ); }
		void out( const char * );
		void out( const String & x ) { NPC::out( x.chars() ); }
		virtual bool pulse();
		void extract();
		void fromWorld();
		void toWorld();
		void setRepop( Repop * x ) { repop = x; }
		Repop * getRepop() { return repop; }
		void readFrom_mainblock( StaticInput & );
		virtual bool readFrom_optionalblock( StaticInput & );
		int readFrom( StaticInput & );
		void writeTo_mainblock( Output & ) const;
		virtual void writeTo_optionalblock( Output & ) const;
		int writeTo( Output & ) const;
		void say( const String & ) {}
		void look( Object * );
		void look( Char * );
		void makeCorpse();
		virtual void describeItself( String &);
		static int getTotalCount() { return total_count; }
};
extern LList<NPC>	npcs;
inline void NPC::fromWorld()
	{	npcs.remove( this ); }
inline void NPC::toWorld()
	{	npcs.add( this ); }
#endif