/*
* Ueberpruefe, ob in wator[zeile][spalte] feldtyp vorliegt,
* wenn ja, wird in nx[index] und ny[index] zeile und spalte abgelegt
* und 1 zurueckgeliefert, ansonsten 0;
* die Koordinaten zeile, spalte duerfen den Rand um eins verlassen -
* in diesem Fall wird zeile und spalte entsprechend der Torusform
* korrigiert
*/
int teste(int zeile, int spalte, char feldtyp,
int nx[RICHTUNGEN], int ny[RICHTUNGEN], int index)
{
/* Torusform von Wator */
if (zeile == -1)
zeile = ZEILEN-1;
else if (zeile == ZEILEN)
zeile = 0;
if (spalte == -1)
spalte = SPALTEN-1;
else if (spalte == SPALTEN)
spalte = 0;
if (wator[zeile][spalte] == feldtyp) {
nx[index] = zeile;
ny[index] = spalte;
return 1;
} else
return 0;
}
|