mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 05:09:20 +02:00
fix(editor): no variables named near or far, the Windows headers define them away
This commit is contained in:
@@ -899,7 +899,7 @@ void editor_mode::infra_recognize()
|
||||
auto const cells{points.size() == 1 ? links.cells_of(Binding) : std::vector<TMemCell *>{}};
|
||||
auto const readers{links.readers_of(cells)};
|
||||
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())
|
||||
{
|
||||
auto best{-1.0};
|
||||
@@ -923,11 +923,11 @@ void editor_mode::infra_recognize()
|
||||
}
|
||||
if (candidate.reader == nullptr)
|
||||
{
|
||||
state.elsewhere += near ? 1 : 0;
|
||||
state.elsewhere += nearby ? 1 : 0;
|
||||
return;
|
||||
}
|
||||
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_foot = infra::frame_at(geometric).point;
|
||||
|
||||
@@ -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}};
|
||||
if (streaming ? m_streamer.terrain_at(middle.x, middle.y) != nullptr : m_grid_chunks.count(key) > 0)
|
||||
continue;
|
||||
std::vector<std::size_t> near;
|
||||
std::vector<std::size_t> around;
|
||||
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)
|
||||
near.push_back(i);
|
||||
if (near.empty())
|
||||
around.push_back(i);
|
||||
if (around.empty())
|
||||
continue;
|
||||
std::vector<glm::dvec3> points;
|
||||
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)
|
||||
{
|
||||
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()};
|
||||
for (auto const i : near)
|
||||
for (auto const i : around)
|
||||
{
|
||||
auto const d{plan_distance(point, samples[i].position)};
|
||||
if (d < distance)
|
||||
|
||||
@@ -395,19 +395,19 @@ std::vector<sweep_node *> editor_mode::sweeps_near(TTrack const &Track) const
|
||||
if (sweep == nullptr || sweep->m_editorremoved)
|
||||
continue;
|
||||
auto const &definition{sweep->definition()};
|
||||
bool near{false};
|
||||
bool close{false};
|
||||
for (auto const &piece : definition.pieces)
|
||||
{
|
||||
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)};
|
||||
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;
|
||||
}
|
||||
if (near)
|
||||
if (close)
|
||||
result.push_back(sweep);
|
||||
}
|
||||
return result;
|
||||
@@ -628,11 +628,11 @@ void editor_mode::render_sweep_ui()
|
||||
// models along curves by this line
|
||||
if (track != nullptr)
|
||||
{
|
||||
auto const near{sweeps_near(*track)};
|
||||
if (false == near.empty())
|
||||
auto const alongside{sweeps_near(*track)};
|
||||
if (false == alongside.empty())
|
||||
{
|
||||
ImGui::TextDisabled("%s", STR_C("By this track:"));
|
||||
for (auto *sweep : near)
|
||||
for (auto *sweep : alongside)
|
||||
{
|
||||
ImGui::PushID(sweep);
|
||||
auto const &definition{sweep->definition()};
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
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 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 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(opposite - End.position))) < 0.01 && glm::dot(t, plan_of(opposite - End.position)) > 1.0};
|
||||
std::string reason;
|
||||
if (straight && editor_track::can_edit_geometry(*own, reason))
|
||||
{
|
||||
auto const first{issue};
|
||||
target = far;
|
||||
target = opposite;
|
||||
e = plan_of(target);
|
||||
solve();
|
||||
if (best.has_value())
|
||||
|
||||
Reference in New Issue
Block a user