Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

Commit

Permalink
GetBoardCoord() fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SzieberthAdam committed Jan 24, 2023
1 parent 46188fc commit 0e74acd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Binary file modified bin/hortirata.exe
Binary file not shown.
10 changes: 7 additions & 3 deletions src/hortirata.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,14 @@ Coord GetBoardCoord(bool restricttoboard)
int8_t lbound = (tileSize-tileActiveSize)/2;
int8_t ubound = tileActiveSize + lbound - 1;
bool validloc = true;
if (restricttoboard && 0 <= row && row < BOARDROWS && 0 <= col && col < BOARDCOLUMNS)
if (restricttoboard)
{
uint8_t c = board[row][col];
if (!(0 < c-Grass && c-Grass < FIELDTYPECOUNT)) validloc = false;
if (0 <= row && row < BOARDROWS && 0 <= col && col < BOARDCOLUMNS)
{
uint8_t c = board[row][col];
if (!(0 < c-Grass && c-Grass < FIELDTYPECOUNT)) validloc = false;
}
else validloc = false;
}
validloc = (validloc && (lbound <= rowmod && rowmod <= ubound && lbound <= colmod && colmod <= ubound));
if (validloc) return (Coord){col, row};
Expand Down

0 comments on commit 0e74acd

Please sign in to comment.