Skip to content
Snippets Groups Projects
Commit e1c0be95 authored by Ian Prins's avatar Ian Prins
Browse files

add method contains(Coord) to Room

parent 92d09949
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ class Room {
bool exists();
bool touches(Coord);
void printInfo(int);
bool contains(Coord&);
private:
Coord topLeft;
Coord bottomRight;
......
......@@ -76,3 +76,8 @@ void Room::dig(Level& level) {
}
}
}
bool Room::contains(Coord& coord) {
return (topLeft[0] <= coord[0]) && (coord[0] <= bottomRight[0])
&& (topLeft[1] <= coord[1]) && (coord[1] <= bottomRight[1]);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment