For some reason, the compiler was allowing assignment to these returned locations. That has no effect and is broken, so add const to prevent it.

This commit is contained in:
2025-08-02 00:33:35 -04:00
parent 2c1e52364d
commit bf46b235eb
2 changed files with 11 additions and 11 deletions

View File

@@ -178,23 +178,23 @@ const rectangle_size_delegate rectangle::height() const {
return rectangle_size_delegate(*const_cast<rectangle*>(this), &rectangle::top, &rectangle::bottom);
}
location rectangle::centre() const {
const location rectangle::centre() const {
return location((left + right) / 2, (top + bottom) / 2);
}
location rectangle::topLeft() const {
const location rectangle::topLeft() const {
return location(left, top);
}
location rectangle::topRight() const {
const location rectangle::topRight() const {
return location(right, top);
}
location rectangle::bottomLeft() const {
const location rectangle::bottomLeft() const {
return location(left, bottom);
}
location rectangle::bottomRight() const {
const location rectangle::bottomRight() const {
return location(right, bottom);
}
@@ -433,4 +433,4 @@ int closest_point_idx(std::vector<location> points, location anchor) {
location closest_point(std::vector<location> points, location anchor) {
return points[closest_point_idx(points, anchor)];
}
}

View File

@@ -81,11 +81,11 @@ struct rectangle {
rectangle_size_delegate height();
const rectangle_size_delegate width() const;
const rectangle_size_delegate height() const;
location centre() const;
location topLeft() const;
location topRight() const;
location bottomLeft() const;
location bottomRight() const;
const location centre() const;
const location topLeft() const;
const location topRight() const;
const location bottomLeft() const;
const location bottomRight() const;
bool contains(location p) const;
bool contains(int x, int y) const;
bool empty() const;