Skip to content

Commit

Permalink
Fixed WorldGrid::IsValid() to use ony double values.
Browse files Browse the repository at this point in the history
  • Loading branch information
mercere99 committed Oct 2, 2023
1 parent 2a3cf8f commit 86ecefc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/core/WorldGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ namespace cse491 {
[[nodiscard]] size_t GetNumCells() const { return cells.size(); }

/// Test if specific coordinates are in range for this GridWorld.
[[nodiscard]] bool IsValid(size_t x, size_t y) const {
return x < width && y < height;
[[nodiscard]] bool IsValid(double x, double y) const {
return x >= 0.0 && x < width && y >= 0.0 && y < height;
}

/// Test if a GridPosition is in range for this GridWorld.
[[nodiscard]] bool IsValid(GridPosition pos) const {
return IsValid(pos.CellX(), pos.CellY());
return IsValid(pos.GetX(), pos.GetY());
}

/// @return The grid state at the provided x and y coordinates
Expand Down

0 comments on commit 86ecefc

Please sign in to comment.