/*
 * SUMMARY:      IsStationLocation.c - Check for station location
 * USAGE:        Part of DHSVM
 *
 * AUTHOR:       Bart Nijssen
 * ORG:          University of Washington, Department of Civil Engineering
 * E-MAIL:       nijssen@u.washington.edu
 * ORIG-DATE:    Apr-96
 * Last Change: Wed Feb  3 23:11:38 1999 by Bart Nijssen <nijssen@u.washington.edu>
 * DESCRIPTION:  Check whether the current pixel is a station location
 * DESCRIP-END.
 * FUNCTIONS:    IsStationLocation()
 * COMMENTS:     
 */

#ifndef lint
static char vcid[] = "$Id: IsStationLocation.c,v 1.2 2001/03/31 00:10:29 waichler Exp $";
#endif /* lint */

#include <stdio.h>
#include <stdlib.h>
#include "settings.h"
#include "data.h"
#include "functions.h"

#define NOTSAME -1

/*****************************************************************************
function  : IsStationLocation()
input     : Current Location, address of structure with station data, and
            pointer to int indicating which station is at current location 
	    (if any)
output    : TRUE if the current location coincides with a station
            FALSE otherwise
modifies  : integer indicating which station is at current location
programmer: Bart Nijssen

This routine determines whether there is a station at the current location
*****************************************************************************/
uchar IsStationLocation(COORD *Loc, int NStats, METLOCATION *Station, 
			int *WhichStation)
{
  int i;			/* Station Counter */
  

  for (i = 0, *WhichStation = NOTSAME; i < NStats && 
       *WhichStation == NOTSAME; i++) {
    if (Loc->N == Station[i].Loc.N && Loc->E == Station[i].Loc.E) {
      *WhichStation = i;
      return TRUE;
    }
  }

  return FALSE;
}
