17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 14:29:20 +02:00
Files
maszyna/widgets/map_objects.cpp
maj00r ce5ee288ff fix the clang CI build
Every module unit now includes the standard headers it uses. Declarations
reaching a unit only through an imported module's global module fragment
are reachable but not visible, so ADL misses the free operators older
libstdc++ declares beside a type - reproduced on ubuntu 24.04 (libstdc++
13), where gl/vao.cpp could not compare vector iterators.

Also drops a stale editor/editorSettings.hpp from the MSVC source list,
which broke the Windows configure step, silences the deliberate
include-in-purview warning in the glm wrapper, and removes GCC support:
clang or MSVC only.
2026-09-09 22:52:28 +02:00

62 lines
1.3 KiB
C++

module;
#include <array>
#include <map>
#include <string>
#include <vector>
#include <memory>
#include "vehicle/DynObj_macros.h"
module eu07.widgets.map_objects;
import eu07.simulation.simulation;
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, entry);
}
}
for (TDynamicObject *dynobj : simulation::Vehicles.sequence()) {
if (!dynobj->Controller || dynobj->Prev())
continue;
glm::vec3 entry_location = dynobj->GetPosition();
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)
{
auto entry = std::make_shared<map::vehicle>();
entry->dynobj = dynobj;
entry->name = dynobj->name();
items.emplace(dist, std::move(entry));
}
}
return items;
}