mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-28 21:37:31 +01:00
refactor(editor): drop unused editor state and vertical leftovers of the route design
This commit is contained in:
@@ -472,7 +472,6 @@ class editor_mode : public application_mode
|
||||
void render_path_parameters(TTrack &Track);
|
||||
void render_straight_ui();
|
||||
track_tab m_track_tab{track_tab::straights};
|
||||
int m_track_tab_request{-1};
|
||||
void delete_selected_track();
|
||||
void start_straight_gesture(int const Tool);
|
||||
void finish_straight_gesture();
|
||||
@@ -575,7 +574,6 @@ class editor_mode : public application_mode
|
||||
std::vector<infra::binding> m_bindings;
|
||||
std::vector<std::pair<scene::layer_handle, std::string>> m_bindings_unresolved; // lines kept as they are
|
||||
bool m_bindings_loaded{false};
|
||||
bool m_bindings_changed{false};
|
||||
std::vector<infra::object_state> m_infra_buffer; // states of the objects before the change in progress
|
||||
bool m_infra_suspended{false};
|
||||
void infra_hooks();
|
||||
|
||||
@@ -374,11 +374,6 @@ bool nearest_beside(Areas_ const &Areas, glm::dvec3 const &Point, double const C
|
||||
return best >= 0.0;
|
||||
}
|
||||
|
||||
bool station_near(std::vector<track_area> const &Areas, glm::dvec3 const &Point, double const Corridor, infra::station &Station)
|
||||
{
|
||||
return nearest_beside(Areas, Point, Corridor, Station);
|
||||
}
|
||||
|
||||
// paths of the whole scenery by cells of the plan, for the lookups reaching up to kReach from the axis
|
||||
class track_index
|
||||
{
|
||||
@@ -662,7 +657,6 @@ void editor_mode::infra_store()
|
||||
entry.second.insert(entry.second.begin(), "# objects bound to the paths in the track editor, they follow changes of the track; the simulation skips these lines");
|
||||
scene::Layers.mark(entry.first, kBindingMark, std::move(entry.second));
|
||||
}
|
||||
m_bindings_changed = false;
|
||||
}
|
||||
|
||||
std::vector<TTrack *> editor_mode::infra_scope() const
|
||||
@@ -830,8 +824,6 @@ void editor_mode::infra_bind_chosen()
|
||||
candidate.chosen = false;
|
||||
++count;
|
||||
}
|
||||
if (count > 0)
|
||||
m_bindings_changed = true;
|
||||
state.status = format("%d object(s) bound, they follow the changes of the track. The bindings are kept in the scenery files on save", count);
|
||||
}
|
||||
|
||||
@@ -848,8 +840,6 @@ void editor_mode::infra_unbind(std::vector<std::size_t> Indices)
|
||||
candidate.bound = false;
|
||||
m_bindings.erase(m_bindings.begin() + *index);
|
||||
}
|
||||
if (false == Indices.empty())
|
||||
m_bindings_changed = true;
|
||||
}
|
||||
|
||||
infra::object_state editor_mode::infra_state_of(infra::binding const &Binding) const
|
||||
@@ -973,7 +963,7 @@ void editor_mode::infra_follow(std::vector<TTrack *> const &Tracks)
|
||||
// paths which took over may have been committed before the old ones were retired
|
||||
std::optional<std::vector<track_area>> everywhere;
|
||||
auto const take_over = [&](glm::dvec3 const &Foot, infra::station &Station) {
|
||||
if (station_near(areas, Foot, 30.0, Station))
|
||||
if (nearest_beside(areas, Foot, 30.0, Station))
|
||||
return true;
|
||||
if (false == everywhere.has_value())
|
||||
{
|
||||
@@ -983,7 +973,7 @@ void editor_mode::infra_follow(std::vector<TTrack *> const &Tracks)
|
||||
everywhere->push_back(area_of(*track));
|
||||
}
|
||||
// only a path running where the old one did, not the one alongside
|
||||
return station_near(*everywhere, Foot, 1.0, Station);
|
||||
return nearest_beside(*everywhere, Foot, 1.0, Station);
|
||||
};
|
||||
for (auto &binding : m_bindings)
|
||||
{
|
||||
|
||||
@@ -93,12 +93,10 @@ void editor_mode::select_track(scene::basic_node *Node)
|
||||
}
|
||||
else if (editor_track::is_straight(*track, m_straights.tolerance))
|
||||
{
|
||||
m_track_tab_request = 0;
|
||||
m_track_tab = track_tab::straights;
|
||||
}
|
||||
else if (std::find(m_route.chain.tracks.begin(), m_route.chain.tracks.end(), track) != m_route.chain.tracks.end() || route_from_curve(*track))
|
||||
{
|
||||
m_track_tab_request = 1;
|
||||
m_track_tab = track_tab::route;
|
||||
}
|
||||
}
|
||||
@@ -803,7 +801,6 @@ void editor_mode::route_recommend(alignment::vertex &Vertex) const
|
||||
Vertex.cant = recommended.cant;
|
||||
Vertex.transition_in = recommended.transition;
|
||||
Vertex.transition_out = recommended.transition;
|
||||
Vertex.vertical_radius = 0.0;
|
||||
}
|
||||
|
||||
void editor_mode::route_bind_ends()
|
||||
@@ -1013,13 +1010,7 @@ glm::dvec3 editor_mode::route_vertex_position(int const Vertex) const
|
||||
else
|
||||
position = design.vertices[Vertex].position;
|
||||
|
||||
double height;
|
||||
if (Vertex < static_cast<int>(result.vertex_elevations.size()))
|
||||
height = result.vertex_elevations[Vertex];
|
||||
else if (false == design.vertices[Vertex].auto_elevation)
|
||||
height = design.vertices[Vertex].elevation;
|
||||
else
|
||||
height = design.start.y + (design.end.y - design.start.y) * (Vertex + 1) / (count + 1.0);
|
||||
auto const height{Vertex < static_cast<int>(result.vertex_elevations.size()) ? result.vertex_elevations[Vertex] : design.start.y + (design.end.y - design.start.y) * (Vertex + 1) / (count + 1.0)};
|
||||
return {position.x, height, position.y};
|
||||
}
|
||||
|
||||
@@ -2361,7 +2352,6 @@ void editor_mode::toggle_straight_set(TTrack &Track)
|
||||
state.set.push_back(line);
|
||||
m_node = &Track;
|
||||
ui()->set_node(m_node);
|
||||
m_track_tab_request = 0;
|
||||
m_track_tab = track_tab::straights;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user