16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 04:19:19 +02:00

semaphores controllable on minimap

This commit is contained in:
milek7
2019-03-02 14:32:39 +01:00
parent 2d66192c9a
commit 1f0d8c4dc8
26 changed files with 678 additions and 315 deletions

View File

@@ -1,4 +1,27 @@
#include "widgets/map_objects.h"
std::vector<std::shared_ptr<map::semaphore>> map::Semaphores;
std::vector<std::shared_ptr<map::track_switch>> map::Switches;
map::objects map::Objects;
map::sorted_object_list map::objects::find_in_range(glm::vec3 from, float distance)
{
sorted_object_list items;
float max_distance2 = distance * distance;
for (auto const entry : entries) {
glm::vec3 entry_location = entry->location;
glm::vec3 search_point = from;
if (glm::isnan(from.y)) {
entry_location.y = 0.0f;
search_point.y = 0.0f;
}
float dist = glm::distance2(entry_location, search_point);
if (dist < max_distance2) {
items.emplace(dist, std::move(entry));
}
}
return items;
}