tfe-1.0/area/
tfe-1.0/files/
tfe-1.0/logs/
tfe-1.0/logs/immortal/
tfe-1.0/logs/mob/
tfe-1.0/logs/object/
tfe-1.0/logs/player/
tfe-1.0/logs/room/
tfe-1.0/notes/clans/
tfe-1.0/player/
tfe-1.0/prev/
tfe-1.0/prev/area/
tfe-1.0/prev/player/
tfe-1.0/prev/rooms/
tfe-1.0/rooms/
tfe-1.0/src-gc/
tfe-1.0/src-msvc/
tfe-1.0/src-unix/
tfe-1.0/www/
tfe-1.0/www/html/
#include <ctype.h>
#include <sys/types.h>
#include <stdio.h>
#include <syslog.h>
#include "define.h"
#include "struct.h"


bool water_logged( room_data* room )
{
  if(  room->sector_type == SECT_WATER_SURFACE 
    || room->sector_type == SECT_UNDERWATER   
    || room->sector_type == SECT_RIVER 
    || room->sector_type == SECT_SHALLOWS )  
    return TRUE;

  return FALSE;
}


bool deep_water( room_data* room )
{
  if(  room->sector_type == SECT_WATER_SURFACE 
    || room->sector_type == SECT_UNDERWATER   
    || room->sector_type == SECT_RIVER ) 
    return TRUE;

  return FALSE;
}


bool is_submerged( char_data* ch )
{
  room_data* room;

  if( ( room = Room( ch->array->where ) ) == NULL )
    return FALSE;

  if( room->sector_type == SECT_UNDERWATER )
    return TRUE;

  if( ( room->sector_type == SECT_WATER_SURFACE 
    || room->sector_type == SECT_RIVER )
    && !ch->can_fly( ) && !ch->can_float( ) )
    return TRUE;

  return FALSE;
}


void enter_water( char_data* ch )
{
  char         tmp  [ TWO_LINES ];
  char        list  [ 5 ][ ONE_LINE ];
  int        count  = 0;
//  obj_data*    obj;
  room_data*  room;

  if( is_set( ch->affected_by, AFF_FIRE_SHIELD ) ) 
    strip_affect( ch, AFF_FIRE_SHIELD );

  if( ( room = Room( ch->array->where ) ) != NULL
    && room->sector_type == SECT_UNDERWATER 
    && ( ch->species == NULL
    || !is_set( ch->species->affected_by, AFF_WATER_BREATHING ) ) )
    add_queue( new event_data( execute_drown, ch ),
      number_range( 50, 75 ) );

  /*
  for( obj = get_eq_char( ch, WEAR_LIGHT ); obj != NULL;
    obj = obj->next_list ) {
    if( !is_set( obj->extra_flags, OFLAG_WATER_PROOF ) ) {
      sprintf( list[count++], obj->Name( ch ) );
      unequip_char( ch, obj );
      }
    }  
  */

  if( count == 0 )
    return;

  *tmp = '\0';
  for( int i = 0; i < count; i++ ) 
    sprintf( tmp+strlen( tmp ), "%s%s",
      i == 0 ? "" : ( i == count-1 ? "and " : ", " ), list[i] );

  send( ch, "As you enter the water %s you are carrying %s quickly\
 extinguished.\n\r", tmp, count == 1 ? "is" : "are" );
}


/*
 *   WATER BASED SPELLS
 */


bool spell_water_breathing( char_data* ch, char_data* victim, void*, 
  int level, int duration )
{

  spell_affect( ch, victim, level, duration, SPELL_WATER_BREATHING,
    AFF_WATER_BREATHING );

  return TRUE;
}