From 86ecefc7add0ef9e354a33704212629c58ff684b Mon Sep 17 00:00:00 2001 From: Charles Ofria Date: Mon, 2 Oct 2023 09:11:21 -0400 Subject: [PATCH] Fixed WorldGrid::IsValid() to use ony double values. --- source/core/WorldGrid.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/core/WorldGrid.hpp b/source/core/WorldGrid.hpp index a3405a34..29ea830e 100644 --- a/source/core/WorldGrid.hpp +++ b/source/core/WorldGrid.hpp @@ -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