17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 11:39:14 +01:00

fix(editor): no variables named near or far, the Windows headers define them away

This commit is contained in:
maj00r
2026-10-06 22:37:00 +02:00
parent 24923dd472
commit d4271ea7c5
4 changed files with 19 additions and 19 deletions

View File

@@ -899,7 +899,7 @@ void editor_mode::infra_recognize()
auto const cells{points.size() == 1 ? links.cells_of(Binding) : std::vector<TMemCell *>{}}; auto const cells{points.size() == 1 ? links.cells_of(Binding) : std::vector<TMemCell *>{}};
auto const readers{links.readers_of(cells)}; auto const readers{links.readers_of(cells)};
infra::station geometric; infra::station geometric;
auto const near{index.nearest(points.front(), Reach, geometric)}; auto const nearby{index.nearest(points.front(), Reach, geometric)};
if (false == readers.empty()) if (false == readers.empty())
{ {
auto best{-1.0}; auto best{-1.0};
@@ -923,11 +923,11 @@ void editor_mode::infra_recognize()
} }
if (candidate.reader == nullptr) if (candidate.reader == nullptr)
{ {
state.elsewhere += near ? 1 : 0; state.elsewhere += nearby ? 1 : 0;
return; return;
} }
auto const &thread{thread_of(candidate.reader)}; auto const &thread{thread_of(candidate.reader)};
if (near && geometric.track != station.track && std::none_of(thread.begin(), thread.end(), [&](track_area const &Area) { return Area.track == geometric.track; })) if (nearby && geometric.track != station.track && std::none_of(thread.begin(), thread.end(), [&](track_area const &Area) { return Area.track == geometric.track; }))
{ {
candidate.nearer = geometric.track; candidate.nearer = geometric.track;
candidate.nearer_foot = infra::frame_at(geometric).point; candidate.nearer_foot = infra::frame_at(geometric).point;

View File

@@ -512,11 +512,11 @@ std::pair<int, int> editor_mode::profile_generate_ground(std::vector<std::pair<d
glm::dvec2 const middle{low + glm::dvec2{size * 0.5}}; glm::dvec2 const middle{low + glm::dvec2{size * 0.5}};
if (streaming ? m_streamer.terrain_at(middle.x, middle.y) != nullptr : m_grid_chunks.count(key) > 0) if (streaming ? m_streamer.terrain_at(middle.x, middle.y) != nullptr : m_grid_chunks.count(key) > 0)
continue; continue;
std::vector<std::size_t> near; std::vector<std::size_t> around;
for (std::size_t i = 0; i < samples.size(); ++i) for (std::size_t i = 0; i < samples.size(); ++i)
if (std::abs(samples[i].position.x - middle.x) <= size * 0.5 + Reach && std::abs(samples[i].position.z - middle.y) <= size * 0.5 + Reach) if (std::abs(samples[i].position.x - middle.x) <= size * 0.5 + Reach && std::abs(samples[i].position.z - middle.y) <= size * 0.5 + Reach)
near.push_back(i); around.push_back(i);
if (near.empty()) if (around.empty())
continue; continue;
std::vector<glm::dvec3> points; std::vector<glm::dvec3> points;
std::vector<std::size_t> nearest; std::vector<std::size_t> nearest;
@@ -526,9 +526,9 @@ std::pair<int, int> editor_mode::profile_generate_ground(std::vector<std::pair<d
for (std::size_t ix = 0; ix < side; ++ix) for (std::size_t ix = 0; ix < side; ++ix)
{ {
glm::dvec3 point{low.x + ix * cellsize, 0.0, low.y + iz * cellsize}; glm::dvec3 point{low.x + ix * cellsize, 0.0, low.y + iz * cellsize};
auto best{near.front()}; auto best{around.front()};
auto distance{std::numeric_limits<double>::max()}; auto distance{std::numeric_limits<double>::max()};
for (auto const i : near) for (auto const i : around)
{ {
auto const d{plan_distance(point, samples[i].position)}; auto const d{plan_distance(point, samples[i].position)};
if (d < distance) if (d < distance)

View File

@@ -395,19 +395,19 @@ std::vector<sweep_node *> editor_mode::sweeps_near(TTrack const &Track) const
if (sweep == nullptr || sweep->m_editorremoved) if (sweep == nullptr || sweep->m_editorremoved)
continue; continue;
auto const &definition{sweep->definition()}; auto const &definition{sweep->definition()};
bool near{false}; bool close{false};
for (auto const &piece : definition.pieces) for (auto const &piece : definition.pieces)
{ {
bezier const curve{piece}; bezier const curve{piece};
for (int k = 0; k <= 8 && false == near; ++k) for (int k = 0; k <= 8 && false == close; ++k)
{ {
auto const point{curve.point(k / 8.0)}; auto const point{curve.point(k / 8.0)};
near = std::any_of(points.begin(), points.end(), [&](glm::dvec3 const &Other) { return plan_distance(point, Other) < kSweepNear; }); close = std::any_of(points.begin(), points.end(), [&](glm::dvec3 const &Other) { return plan_distance(point, Other) < kSweepNear; });
} }
if (near) if (close)
break; break;
} }
if (near) if (close)
result.push_back(sweep); result.push_back(sweep);
} }
return result; return result;
@@ -628,11 +628,11 @@ void editor_mode::render_sweep_ui()
// models along curves by this line // models along curves by this line
if (track != nullptr) if (track != nullptr)
{ {
auto const near{sweeps_near(*track)}; auto const alongside{sweeps_near(*track)};
if (false == near.empty()) if (false == alongside.empty())
{ {
ImGui::TextDisabled("%s", STR_C("By this track:")); ImGui::TextDisabled("%s", STR_C("By this track:"));
for (auto *sweep : near) for (auto *sweep : alongside)
{ {
ImGui::PushID(sweep); ImGui::PushID(sweep);
auto const &definition{sweep->definition()}; auto const &definition{sweep->definition()};

View File

@@ -461,13 +461,13 @@ bool editor_mode::turntable_fit_end(editor_track::snap_target const &End, turnta
if (false == best.has_value() && own != nullptr && own->eType == tt_Normal && own->m_paths.size() == 1 && own->Dynamics.empty()) if (false == best.has_value() && own != nullptr && own->eType == tt_Normal && own->m_paths.size() == 1 && own->Dynamics.empty())
{ {
auto const &path{own->m_paths.front()}; auto const &path{own->m_paths.front()};
auto const far{End.point.kind == editor_track::point_kind::start ? path.points[segment_data::point::end] : path.points[segment_data::point::start]}; auto const opposite{End.point.kind == editor_track::point_kind::start ? path.points[segment_data::point::end] : path.points[segment_data::point::start]};
auto const straight{std::abs(geometry::cross(t, plan_of(far - End.position))) < 0.01 && glm::dot(t, plan_of(far - End.position)) > 1.0}; auto const straight{std::abs(geometry::cross(t, plan_of(opposite - End.position))) < 0.01 && glm::dot(t, plan_of(opposite - End.position)) > 1.0};
std::string reason; std::string reason;
if (straight && editor_track::can_edit_geometry(*own, reason)) if (straight && editor_track::can_edit_geometry(*own, reason))
{ {
auto const first{issue}; auto const first{issue};
target = far; target = opposite;
e = plan_of(target); e = plan_of(target);
solve(); solve();
if (best.has_value()) if (best.has_value())