< index
< 12. Field of view toolkit
< 12.2 Computing the field of view

=====================================
12.3 Reading fov information
=====================================

> 12.4 Destroying a map
Once your computed the field of view, you can know if a cell is visible with :

C++ : bool TCODMap::isInFov(int x, int y) const
C   : bool TCOD_map_is_in_fov(TCOD_map_t map, int x, int y)

ParameterDescription
mapIn the C version, the map handler returned by the TCOD_map_new function.
x,yCoordinates of the cell we want to check.
0 <= x < map width.
0 <= y < map height.

Example :

C++ : TCODMap *map = new TCODMap(50,50); // allocate the map
      map->setProperties(10,10,true,true); // set a cell as 'empty'
      map->computeFov(10,10); // calculate fov from the cell 10x10
	  bool visible=map->isInFov(10,10); // is the cell 10x10 visible ?      
C   : TCOD_map_t map = TCOD_map_new(50,50);
      TCOD_map_set_properties(map,10,10,true,true);
      TCOD_map_compute_fov(map,10,10);
      bool visible = TCOD_map_is_in_fov(map,10,10);

You can also retrieve transparent/walkable informations with :

C++ : bool TCODMap::isTransparent(int x, int y) const
      bool TCODMap::isWalkable(int x, int y) const
C   : bool TCOD_map_is_transparent(TCOD_map_t map, int x, int y)
      bool TCOD_map_is_walkable(TCOD_map_t map, int x, int y)

ParameterDescription
mapIn the C version, the map handler returned by the TCOD_map_new function.
x,yCoordinates of the cell we want to check.
0 <= x < map width.
0 <= y < map height.