optimizes range queries, fixes #3717

This was SVN commit r17573.
This commit is contained in:
mimo 2015-12-30 13:44:51 +00:00
parent 082a32802b
commit 36c08193ba
2 changed files with 6 additions and 6 deletions

View File

@ -1087,6 +1087,7 @@ public:
r.push_back(it->first);
}
std::sort(r.begin(), r.end());
}
// check a regular range (i.e. not the entire world, and not parabolic)
else
@ -1117,6 +1118,7 @@ public:
r.push_back(it->first);
}
std::sort(r.begin(), r.end());
}
}

View File

@ -514,8 +514,8 @@ public:
}
/**
* Returns a sorted list of items that are either in the square or close to it.
* It's the responsibility of the querier to do proper distance checking.
* Returns a (non sorted) list of items that are either in the square or close to it.
* It's the responsibility of the querier to do proper distance checking and entity sorting.
*/
void GetInRange(std::vector<entity_id_t>& out, CFixedVector2D posMin, CFixedVector2D posMax)
{
@ -545,13 +545,11 @@ public:
out.insert(out.end(), subdivision.begin(), subdivision.end());
}
}
std::sort(out.begin(), out.end());
}
/**
* Returns a sorted list of items that are either in the circle or close to it.
* It's the responsibility of the querier to do proper distance checking.
* Returns a (non sorted) list of items that are either in the circle or close to it.
* It's the responsibility of the querier to do proper distance checking and entity sorting.
*/
void GetNear(std::vector<entity_id_t>& out, CFixedVector2D pos, entity_pos_t range)
{