/**************************************************************
 * FFTacticsMUD : area.h                                      *
 **************************************************************
 * (c) 2002 Damien Dailidenas (Trenton). All rights reserved. *
 **************************************************************/

#define MAX_ROOMS	10000

#define AREA_ORBONNE_MONASTERY	1

#define ROOM_OUTSIDE	0
#define ROOM_BAR	1
#define ROOM_SHOP	2
#define ROOM_FURSHOP	3

typedef class SHOP SHOP;
typedef bool BATTLE_FUN args((CH *ch, const short phase=1));

class AREA {
public:
  AREA *next;
  short id;
  ROOM *room[4], *exits[4];

  AREA() {
    next=NULL;
    id=0;

    for(short x = 0; x < 4; ++x)
      exits[x] = room[x] = NULL;
  }

  string name();
  BATTLE_FUN *battle();
};
 
class ROOM {
public:
  short id;
  AREA *area;
  SHOP *shop;
  CH *people;

  ROOM() {
    area=NULL;
    shop=NULL;
    people=NULL;
    id=0;
  }

  void echo(const string str, CH *ch = NULL, CH *ch2 = NULL);
  CH *ch(const string name, CH *ch = NULL);
  void print_contents(CH *ch);
  string name();
  string description();
};

class BATTLE_AREA {
public:
  short id;
  string name;
  BATTLE_ROOM *room[MAX_ROOMS];
  unsigned int width, height;
  BATTLE_AREA *next;
  short weather;

  BATTLE_AREA() {
    weather=0;

    for(long x = 0; room[x]; ++x)  
      room[x] = NULL;
  
    next = NULL;
  }
  
  long size();
  void set_coordinates();
  CH *ch(const string name);
  string str_weather();
};

class BATTLE_ROOM {
public:
  BATTLE_AREA *area;
  CH *people;
  OBJ *objects;
  unsigned short sector, x, y, type;
  float height, depth;
  long id;
      
  BATTLE_ROOM() {
    area=NULL;
    people=NULL;
    objects=NULL;
    type=sector=x=y=0;
    height=depth=0;
    id=0;
  };

  BATTLE_ROOM *get_adjacent_room(const short door);

  short distance(const BATTLE_ROOM *room);
  short distance(const CH *ch);

  string location();

  OBJ *obj(const string name);
  OBJ *obj(const short id);

  void print_contents(CH *ch);
  void stat(CH *ch);

  CH *ch(const string name, CH *ch = NULL);
  CH *occupied(CH *ch);
};

struct areas {
  char *name, *description;
  BATTLE_FUN *battle;
  short exits[4];
  bool bar, shop, furshop;
};

extern	const 	struct 	areas area_table[];
extern  BATTLE_AREA *battle_area_list;
extern  AREA *area_list;

BATTLE_AREA 	*get_battle_area(const short id);
AREA    	*get_area(const short id);