// Room.h - header file for roms
// By: Odis

#ifndef __ROOM_H_
#define __ROOM_H_

#include "avatar.h"
#include <iostream>
#include <map>

#ifndef ROOM_VERSION
#define ROOM_VERSION 1
#endif

using namespace std;

class Room;
typedef std::map<std::string, Room *> RoomMap;

//prototypes
bool CheckVnumRange( Avatar *av, const string& str );
string GenOppDir( string dir, string* str = NULL );

// so the exit class doesnt freak out
class Room
{
  public:
    Room(unsigned int rid);
    Room( const string& );
   ~Room();

    // public because i'm lazy
    unsigned int id;

    RoomMap         GetExits() const      { return exits; }
    Room *          GetExit(string dir) { return exits[dir]; }
    void            AddExit( string s, Room *r );
    void            RemExit( string s );
    
    //utils
    void            InsertAvatar( Avatar *a, bool look = true );
    void            Broadcast( const std::string & );

    bool            Set( const string &set, const string &value );
    string          Get( const string &get );
    
    bool            Save();

    // examines string and generates exits accordingly
    void            InterpExitStr(string s);
    string          GenExitStr();

    list<Char *>  _charList;
    
  private:
    RoomMap             exits;
    map<string, string> info;

    bool                Load(unsigned int r);
    bool                LoadVnum(const string& vnum);
};

// for room editing online
class EditRoomHandler: public Handler
{
	Room *      _edit;

	public:
	  EditRoomHandler();
	  EditRoomHandler( Char *, const std::string & );
	  void Enter( Char * );
	  void Exit( Char * );
      void Handle( Char *, const std::string & );
	  std::string Prompt( Char * );
};

//room defined constants, use quotes since the defines are used mostly for FindRoom calls
#define ROOM_LIMBO      "1"

// min vnum should be the lowest possible vnum to allow setting for non-imps
#define MIN_VNUM        100

// max vnum should be the highest to allow setable
#define MAX_VNUM        1000000

// default start range for dynamic rooms
#define DROOM_START     MAX_VNUM+1

#endif // __ROOM_H_