Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions cem/cem.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,17 +574,15 @@ void FindBeachCells(int YStart)
if (debug1) printf("FirstX: %3d FirstY: %3d z: 0 \n", X[0], Y[0]);

z = 0;
X[z - 1] = X[z];
Y[z - 1] = Y[z] - 1;

while ((Y[z] < 2 * Y_MAX - 1) && (z < MaxBeachLength - 1)) {
z++;
NextX = -2;
NextY = -2;
BehindX = -2;
BehindY = -2;

FindNextCell(X[z - 1], Y[z - 1], z - 1);
FindNextCell(X[z], Y[z], z);
z++;
X[z] = NextX;
Y[z] = NextY;
XBehind[z] = BehindX;
Expand Down Expand Up @@ -733,7 +731,7 @@ void FindNextCell(int x, int y, int z)
{
return;
}
if ((X[z - 1] == X[z]) && (Y[z - 1] == Y[z] - 1))
if (z == 0 ||(X[z - 1] == X[z]) && (Y[z - 1] == Y[z] - 1))
/* came from left */
{
if ((PercentFullSand[x + 1][y] + PercentFullRock[x + 1][y]) > 0.0) {
Expand Down
2 changes: 1 addition & 1 deletion cem/conditions.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void InitBeach(double **percent_full_sand, double **percent_full_rock, char **al

int ocean_start = INIT_BEACH + 1;
/* Fill in first row of ocean */
percent_full_rock[beach_start][col] = 0.0;
percent_full_rock[ocean_start][col] = 0.0;
percent_full_sand[ocean_start][col] = 0.0;
all_rock[ocean_start][col] = 'n';
all_beach[ocean_start][col] = 'n';
Expand Down