Rationalizing the use of scan_radius and making it accessible

This commit is contained in:
2021-11-23 16:10:48 -05:00
parent c75ba3b3a8
commit 8c871a9f40
10 changed files with 109 additions and 110 deletions

View File

@@ -228,7 +228,7 @@ void World::tangible_delete(int64_t id) {
LS.result();
}
util::IdVector World::get_near_unsorted(int64_t player_id, float radius, bool exclude_nowhere) const {
util::IdVector World::get_near_unsorted(int64_t player_id, float radius, bool exclude_nowhere, bool omit_player) const {
const Tangible *player = tangible_get(player_id);
if (player == nullptr) {
return IdVector();
@@ -236,19 +236,18 @@ util::IdVector World::get_near_unsorted(int64_t player_id, float radius, bool ex
// Find out where's the center of the world.
const AnimStep &aqback = player->anim_queue_.back();
if (exclude_nowhere && (aqback.plane() == "nowhere")) {
IdVector idv;
idv.push_back(player_id);
return idv;
}
return plane_map_.scan_radius(aqback.plane(), aqback.xyz().x, aqback.xyz().y, radius, player_id);
return plane_map_.scan_radius_unsorted(aqback.plane(), aqback.xyz().x, aqback.xyz().y, radius, exclude_nowhere, player_id, omit_player);
}
util::IdVector World::get_near(int64_t player_id, float radius, bool exclude_nowhere) const {
util::IdVector v = get_near_unsorted(player_id, radius, exclude_nowhere);
std::sort(v.begin(), v.end());
return v;
util::IdVector World::get_near(int64_t player_id, float radius, bool exclude_nowhere, bool omit_player) const {
const Tangible *player = tangible_get(player_id);
if (player == nullptr) {
return IdVector();
}
// Find out where's the center of the world.
const AnimStep &aqback = player->anim_queue_.back();
return plane_map_.scan_radius(aqback.plane(), aqback.xyz().x, aqback.xyz().y, radius, exclude_nowhere, player_id, omit_player);
}
World::Redirects World::fetch_redirects() {