/*
....[@@@..[@@@..............[@.................. 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@falcon.mercer.peachnet.edu
MUD++ development mailing list mudpp-list@spice.com
------------------------------------------------------------------------------
room.h
*/
#ifndef _ROOM_H
#define _ROOM_H
#include "file.h"
#include "string.h"
#include "llist.h"
#include "vector.h"
#include "nameable.h"
#include "streamable.h"
#include "exit.h"
class Area;
class Repop;
class Description;
class Object;
class Char;
class PC;
class NPC;
const int DIR_UNDEFINED = -1;
const int DIR_NORTH = 0;
const int DIR_EAST = 1;
const int DIR_SOUTH = 2;
const int DIR_WEST = 3;
const int DIR_UP = 4;
const int DIR_DOWN = 5;
const int MAX_DIR = 6;
// Unused
const int DIR_NORTH_EAST = 6;
const int DIR_NORTH_WEST = 7;
const int DIR_SOUTH_EAST = 8;
const int DIR_SOUTH_WEST = 9;
class Room : public Nameable, public Streamable
{
protected:
Area * area;
String key; // Index key
Vector vec;
String desc; // Detailed room desc
Exit * exits[ MAX_DIR ];
int temp; // temperature - function of environ and inside heat sources
public:
LList<Repop> repops;
LList<Description> ed;
LList<Object> inv;
LList<Char> chars;
Room()
: area(0)
{
memset( exits, 0, sizeof( exits[0] ) * MAX_DIR );
}
Room( Area *x )
: area(x)
{
memset( exits, 0, sizeof( exits[0] ) * MAX_DIR );
}
Room( Area *x, const String & y )
: area(x), key(y)
{
memset( exits, 0, sizeof( exits[0] ) * MAX_DIR );
}
~Room();
// const Index & getIndex() const { return index; }
// void setIndex( const Index & x ) { index = x; }
// void setIndexScope( const String & x ) { index.setScope( x ); }
void setKey( const String & x ) { key = x; }
const String & getScope() const;
const String getKey() const { return key; }
void pulse();
int writeTo( OutFile & ) const;
int readFrom( InFile & );
int writeProtoTo( OutFile & ) const {}
int readProtoFrom( InFile & ) {}
void hardLink();
void addRepop( Repop * );
void repop();
Area *getArea() { return area; }
void addObjInv( Object * );
void rmObjInv( Object * );
void addCharInv( Char * );
void rmCharInv( Char * );
virtual void out( const char * );
virtual void out( const String & x ) { out( x.chars() ); }
virtual void outAllCharExcept( const char *, Char *, Char * );
virtual void outAllCharExcept( const String &, Char *, Char * );
const String & getDesc() { return desc; }
void setDesc( const String & x) { desc = x; }
const String & getExtraDesc( const String & x ) { return getExtraDesc( x.chars() ); }
const String & getExtraDesc( const char * );
void addExtraDesc( Description * d ) { ed.addTop( d ); }
Exit * getExit( int );
Room *toRoom( int );
void addExit( Exit *, int );
void deleteExit( int );
Char *getChar( const String & ); // player or mob
PC *getPC( const String & ); // player
NPC *getNPC( const String & ); // mob
Object *getObj( const String & );
};
inline void Room::outAllCharExcept( const String & x, Char * y, Char * z )
{
outAllCharExcept( x.chars(), y, z );
}
#endif