mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
Codechange: Make kdtree member functions const for const-correctness (#13099)
This commit is contained in:
parent
d2496b6ec4
commit
60ae50e016
@ -308,7 +308,7 @@ class Kdtree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Check if the entire tree is in need of rebuilding */
|
/** Check if the entire tree is in need of rebuilding */
|
||||||
bool IsUnbalanced()
|
bool IsUnbalanced() const
|
||||||
{
|
{
|
||||||
size_t count = this->Count();
|
size_t count = this->Count();
|
||||||
if (count < 8) return false;
|
if (count < 8) return false;
|
||||||
@ -316,7 +316,7 @@ class Kdtree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Verify that the invariant is true for a sub-tree, assert if not */
|
/** Verify that the invariant is true for a sub-tree, assert if not */
|
||||||
void CheckInvariant(size_t node_idx, int level, CoordT min_x, CoordT max_x, CoordT min_y, CoordT max_y)
|
void CheckInvariant(size_t node_idx, int level, CoordT min_x, CoordT max_x, CoordT min_y, CoordT max_y) const
|
||||||
{
|
{
|
||||||
if (node_idx == INVALID_NODE) return;
|
if (node_idx == INVALID_NODE) return;
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ class Kdtree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Verify the invariant for the entire tree, does nothing unless KDTREE_DEBUG is defined */
|
/** Verify the invariant for the entire tree, does nothing unless KDTREE_DEBUG is defined */
|
||||||
void CheckInvariant()
|
void CheckInvariant() const
|
||||||
{
|
{
|
||||||
#ifdef KDTREE_DEBUG
|
#ifdef KDTREE_DEBUG
|
||||||
CheckInvariant(this->root, 0, std::numeric_limits<CoordT>::min(), std::numeric_limits<CoordT>::max(), std::numeric_limits<CoordT>::min(), std::numeric_limits<CoordT>::max());
|
CheckInvariant(this->root, 0, std::numeric_limits<CoordT>::min(), std::numeric_limits<CoordT>::max(), std::numeric_limits<CoordT>::min(), std::numeric_limits<CoordT>::max());
|
||||||
|
Loading…
Reference in New Issue
Block a user