#ifndef BABBLEMUD_ROOM_H
#define BABBLEMUD_ROOM_H

#include <list>

#include "object.h"

/*

 I am going to split rooms and their contents into two different places. :)
 
 The room is the room description, exits etc. which will be a standard ObjectList.
 
 The World object (below) stores the current state of one room in the world - what 
 its contents are, its stock etc.

 Rooms are changed by building. The World object(s) are changed by players moving around
 and taking things.
 
*/

// a room in the world (vnum of room is in the room map)
class World : public TopThing
  {
  public: 
    
  friend void RebuildRoom (ObjectList::const_iterator & roomIter);
  friend void RebuildWorldMap ();
  
  private:
    
  ObjectList::const_iterator room_;    // iterator to room in room () list
  
  // make these private, data should be retieved using roomString, roomNumber etc.
  // note - these are not implemented
  const string gets (const string &, const string & sDefault = string ()) const;
  const int geti (const string &, const int & iDefault = int ()) const;
  const double getf (const string &, const double & fDefault = double ()) const;
  const bool getb (const string &, const bool & bDefault = bool ()) const;
  void sets (const string &, const string &);
  void seti (const string &, const int &);
  void setf (const string &, const double &);
  void setb (const string &, const bool &);
  
  public:
 
  // default ctor
  World () {}
    
  ObjectList & contents ()  { return items_ ["contents"]; }   // what is in the room
  ObjectList & stock ()     { return items_ ["stock"]; }      // for shops, what they sell
  
  // these things come from the underlying room object

  // room short name
  const string roomName         (const string & prefix) const;
  // room long description
  const string roomDescription  (const string & prefix) const;
  // room flag
  const bool roomFlag           (const string & which, const int & bDefault = bool ()) const
    {
    return room_->getb (which, bDefault);
    }
  // room number
  const int roomNumber          (const string & which, const int & iDefault = int ()) const
    {
    return room_->geti (which, iDefault);
    }
  // room float
  const double roomFloat        (const string & which, const double fDefault = double ()) const
    {
    return room_->getf (which, fDefault);
    }
  // room string
  const string roomString       (const string & which, const string sDefault = string ()) const
    {
    return room_->gets (which, sDefault);
    }
  // exits 
  const ObjectList & exits () const
    { 
    return room_->contents_; 
    }      // exits

  };  // end of class v

// we will use a map of rooms in the world
typedef std::map <int, World> WorldMap;
typedef WorldMap::iterator WorldMapIterator;

World & FindRoom (const int & vnum);
void RebuildWorldMap ();

#endif // BABBLEMUD_ROOM_H

