diff --git a/application/editormode.cpp b/application/editormode.cpp index 5248a03b..de7cf339 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -2242,7 +2242,8 @@ void editor_mode::render_orthophoto_ui() { config.north = m_orthophoto_origin_edit.x; config.east = m_orthophoto_origin_edit.y; - changed = persist = true; + changed = true; + persist = true; } if (m_georeference) { @@ -2253,9 +2254,12 @@ void editor_mode::render_orthophoto_ui() ImGui::SameLine(); if (ImGui::SmallButton(STR_C("Use it"))) { - config.north = m_orthophoto_origin_edit.x = m_georeference_origin.x; - config.east = m_orthophoto_origin_edit.y = m_georeference_origin.y; - changed = persist = true; + m_orthophoto_origin_edit.x = m_georeference_origin.x; + config.north = m_orthophoto_origin_edit.x; + m_orthophoto_origin_edit.y = m_georeference_origin.y; + config.east = m_orthophoto_origin_edit.y; + changed = true; + persist = true; } } } @@ -2287,7 +2291,10 @@ void editor_mode::render_orthophoto_ui() }; if (ImGui::Checkbox(STR_C("Fit to terrain"), &config.drape)) - changed = persist = true; + { + changed = true; + persist = true; + } if (ImGui::IsItemHovered()) ImGui::SetTooltip(STR_C("Lays the imagery onto the ground geometry (terrain shapes, terrain tile models, heightmap terrain).\n" "Places without any ground use the height below.")); @@ -2321,7 +2328,10 @@ void editor_mode::render_orthophoto_ui() end_disabled(config.drape); if (ImGui::Checkbox(STR_C("Covered by objects and terrain"), &config.in_scene)) - changed = persist = true; + { + changed = true; + persist = true; + } if (ImGui::IsItemHovered()) ImGui::SetTooltip(STR_C("Draws the imagery as part of the scene, so tracks, models and terrain in front of it hide it.\n" "It is lit like the scene. Fully opaque, mouse placement lands on it as on any surface;\n" @@ -2344,21 +2354,26 @@ void editor_mode::render_orthophoto_ui() if (ImGui::Selectable(STR_C("Newest"), config.year == 0)) { config.year = 0; - changed = persist = true; + changed = true; + persist = true; } for (int year = thisyear; year >= editor_orthophoto::oldest_year; --year) { if (ImGui::Selectable(std::to_string(year).c_str(), config.year == year)) { config.year = year; - changed = persist = true; + changed = true; + persist = true; } } ImGui::EndCombo(); } if (ImGui::Checkbox(STR_C("4K tiles where available"), &config.hires)) - changed = persist = true; + { + changed = true; + persist = true; + } if (ImGui::IsItemHovered()) ImGui::SetTooltip(STR_C("4096 px tiles (~6 cm/px) from the high-resolution orthophoto, for the tiles around the camera.\n" "Areas it doesn't cover use the standard imagery. Each 4K tile takes ~85 MB of video memory.")); @@ -2926,7 +2941,9 @@ bool editor_mode::save() if (result.success && trailing.size() == 3) { std::istringstream header{trailing.front()}; - std::string keyword, timetable, track; + std::string keyword; + std::string timetable; + std::string track; double offset{0.0}; header >> keyword >> timetable >> track >> offset; if (auto *path{simulation::Paths.find(track)}; path != nullptr && simulation::Vehicles.find("wmb10-6457") == nullptr) @@ -3060,7 +3077,8 @@ void editor_mode::apply_include() auto const directive = editor_includes::compose_directive(m_include.target, m_include.values); if (directive == before) return; - std::string read_before, read_after; + std::string read_before; + std::string read_after; if (false == m_include.info.signal_read.empty()) { std::string file; @@ -3450,7 +3468,8 @@ void editor_mode::read_georeference() // Rainsted writes the origin of the scenery as: //$g , in kilometres std::istringstream words(line.substr(mark + 4)); std::string system; - double east{0.0}, north{0.0}; + double east{0.0}; + double north{0.0}; if (false == static_cast(words >> system >> east >> north) || system.find("1992") == std::string::npos) continue; auto const scale = (east < 10000.0 && north < 10000.0) ? 1000.0 : 1.0; @@ -5011,7 +5030,8 @@ void editor_mode::on_scroll(double const Xoffset, double const Yoffset) auto const before{Global.EditorOrthoExtent}; auto const after{std::clamp(before * static_cast(std::pow(0.85, Yoffset)), 5.0f, 5000.0f)}; screen_projection const projection; - glm::dvec3 origin, direction; + glm::dvec3 origin; + glm::dvec3 direction; projection.ray(ImGui::GetIO().MousePos, origin, direction); auto const scale{static_cast(after) / static_cast(before)}; Camera.Pos.x = origin.x + (Camera.Pos.x - origin.x) * scale; diff --git a/application/editormodeinfra.cpp b/application/editormodeinfra.cpp index a1d055f5..34a36a95 100644 --- a/application/editormodeinfra.cpp +++ b/application/editormodeinfra.cpp @@ -658,8 +658,11 @@ std::optional read_binding(std::string const &Text, scene::layer { double const tolerance{0.05}; std::istringstream line{Text}; - std::string kindname, key; - int group{0}, turns{0}, count{0}; + std::string kindname; + std::string key; + int group{0}; + int turns{0}; + int count{0}; glm::dvec3 location; line >> kindname >> group >> location.x >> location.y >> location.z >> key >> turns >> count; if (line.fail() || count < 1 || count > 4) @@ -707,7 +710,8 @@ std::optional read_binding(std::string const &Text, scene::layer for (int i = 0; i < count && found; ++i) { int path{0}; - glm::dvec3 start, end; + glm::dvec3 start; + glm::dvec3 end; line >> path >> start.x >> start.y >> start.z >> end.x >> end.y >> end.z; start = Context.to_world(start); end = Context.to_world(end); @@ -865,7 +869,10 @@ void editor_mode::infra_recognize() state.error = (state.scope == 2 ? STR_C("Open the vertical profile of a route first") : state.scope == 3 ? STR_C("The scenery has no paths the editor can handle") : STR_C("Select a path first")); return; } - state.read = state.overruled = state.unread = state.elsewhere = 0; + state.read = 0; + state.overruled = 0; + state.unread = 0; + state.elsewhere = 0; track_index index; std::unordered_set names; std::unordered_set const scope(state.tracks.begin(), state.tracks.end()); diff --git a/application/editormodeprofile.cpp b/application/editormodeprofile.cpp index eb10e686..1a2d1a0b 100644 --- a/application/editormodeprofile.cpp +++ b/application/editormodeprofile.cpp @@ -126,7 +126,9 @@ void editor_mode::profile_library_load() { stored_profile entry; entry.layer = layer; - glm::dvec3 start, end, middle; + glm::dvec3 start; + glm::dvec3 end; + glm::dvec3 middle; line >> entry.length >> start.x >> start.y >> start.z >> end.x >> end.y >> end.z >> middle.x >> middle.y >> middle.z; if (line.fail()) { @@ -145,7 +147,8 @@ void editor_mode::profile_library_load() std::string word; if (keyword == "speed") { - int start{1}, end{1}; + int start{1}; + int end{1}; line >> entry.line.speed >> word >> entry.origin >> word >> start >> end; entry.line.join_start = (start != 0); entry.line.join_end = (end != 0); @@ -385,8 +388,10 @@ void editor_mode::profile_open_run(TTrack &Track) void editor_mode::profile_take(editor_track::route Route, TTrack *From, TTrack *To) { auto &state{m_profile}; - state.from = state.picked_from = From; - state.to = state.picked_to = To; + state.picked_from = From; + state.from = state.picked_from; + state.picked_to = To; + state.to = state.picked_to; state.route = std::move(Route); state.selected = -1; profile_resample(); @@ -474,7 +479,8 @@ void editor_mode::profile_fit_ground() state.selected = -1; state.error.clear(); profile_check(); - double fill{0.0}, cut{0.0}; + double fill{0.0}; + double cut{0.0}; for (std::size_t i = 0; i < state.samples.size(); ++i) { if (false == std::isfinite(state.terrain[i])) @@ -514,7 +520,8 @@ std::pair editor_mode::profile_generate_ground(std::vector(cells) + 1}; - int made{0}, skipped{0}; + int made{0}; + int skipped{0}; for (auto const &key : keys) { if (m_streamer.exists(key)) @@ -636,7 +643,8 @@ void editor_mode::profile_shape_ground() } modifier.points.push_back(points.back()); - double fill{0.0}, cut{0.0}; + double fill{0.0}; + double cut{0.0}; for (std::size_t i = 0; i < samples.size(); ++i) { if (i >= state.terrain.size() || false == std::isfinite(state.terrain[i])) @@ -947,7 +955,9 @@ void editor_mode::profile_after_undo() { state.route = {}; state.samples.clear(); - state.selected = state.dragging = state.curve_grip = -1; + state.selected = -1; + state.dragging = -1; + state.curve_grip = -1; return; } profile_resample(); @@ -1480,7 +1490,8 @@ void editor_mode::render_profile_canvas(float const Height) void editor_mode::profile_fit_exaggeration(profile_view const &View) { auto &state{m_profile}; - double low{std::numeric_limits::max()}, high{std::numeric_limits::lowest()}; + double low{std::numeric_limits::max()}; + double high{std::numeric_limits::lowest()}; for (auto const &sample : state.samples) { low = std::min(low, sample.position.y); @@ -1492,7 +1503,10 @@ void editor_mode::profile_fit_exaggeration(profile_view const &View) high = std::max(high, point.elevation); } if (low > high) - low = high = 0.0; + { + low = 0.0; + high = 0.0; + } auto const range{std::max(1.0, (high - low) * 1.3)}; state.exaggeration = static_cast(std::clamp(View.across / (range / View.height), 1.0, 500.0)); state.view_centre = (low + high) * 0.5; @@ -1584,9 +1598,15 @@ bool editor_mode::profile_canvas_edit(profile_view const &View, bool const Hover auto const point{hit_point()}; auto const grip{point < 0 ? hit_grip() : -1}; if (point >= 0) - state.selected = state.dragging = point; + { + state.dragging = point; + state.selected = state.dragging; + } else if (grip >= 0) - state.selected = state.curve_grip = grip; + { + state.curve_grip = grip; + state.selected = state.curve_grip; + } else state.selected = -1; } diff --git a/application/editormodeselftest.cpp b/application/editormodeselftest.cpp index 931e8e4b..3f2783ae 100644 --- a/application/editormodeselftest.cpp +++ b/application/editormodeselftest.cpp @@ -57,7 +57,8 @@ editor_mode::selftest_result editor_mode::selftest_scene(std::string const &comm auto &test{m_selftest}; if (command == "camera") { - glm::dvec3 from, to; + glm::dvec3 from; + glm::dvec3 to; words >> from.x >> from.y >> from.z >> to.x >> to.y >> to.z; auto const look{glm::normalize(to - from)}; Camera.Pos = from; @@ -79,7 +80,9 @@ editor_mode::selftest_result editor_mode::selftest_scene(std::string const &comm if (command == "frames") { std::string name; - double from{0.0}, to{0.0}, step{0.1}; + double from{0.0}; + double to{0.0}; + double step{0.1}; words >> name >> from >> to >> step; auto *sweep{simulation::Sweeps.find(name)}; if (sweep == nullptr) @@ -292,7 +295,8 @@ editor_mode::selftest_result editor_mode::selftest_scene(std::string const &comm state.skin = source.skin; state.scale = source.scale; probe.define(state); - glm::dvec3 boxlow{std::numeric_limits::max()}, boxhigh{-std::numeric_limits::max()}; + glm::dvec3 boxlow{std::numeric_limits::max()}; + glm::dvec3 boxhigh{-std::numeric_limits::max()}; for (auto const &item : probe.items()) { auto const transform{source.transform * glm::scale(glm::dmat4(1.0), source.scale) * item.transform}; @@ -325,7 +329,9 @@ editor_mode::selftest_result editor_mode::selftest_scene(std::string const &comm } if (command == "key") { - std::string key, action, mods; + std::string key; + std::string action; + std::string mods; words >> key >> action >> mods; if (key == "RMB") m_input.mouse.button(GLFW_MOUSE_BUTTON_RIGHT, action == "press" ? GLFW_PRESS : GLFW_RELEASE); @@ -459,7 +465,8 @@ editor_mode::selftest_result editor_mode::selftest_sweep(std::string const &comm } if (command == "drag") { - glm::dvec3 from{0.0}, to{0.0}; + glm::dvec3 from{0.0}; + glm::dvec3 to{0.0}; words >> from.x >> from.z >> to.x >> to.z; m_sweep.open = true; if (false == sweep_press_at(from, false)) @@ -690,11 +697,14 @@ editor_mode::selftest_result editor_mode::selftest_sweep(std::string const &comm WriteLog("SELFTEST bendprobe: nothing bent"); return selftest_result::handled; } - glm::dvec3 low, high, shift; + glm::dvec3 low; + glm::dvec3 high; + glm::dvec3 shift; sweep->bounds(low, high, shift); auto const &state{sweep->definition()}; auto const marker{bend_marker(*sweep)}; - glm::dvec3 boxlow{std::numeric_limits::max()}, boxhigh{-std::numeric_limits::max()}; + glm::dvec3 boxlow{std::numeric_limits::max()}; + glm::dvec3 boxhigh{-std::numeric_limits::max()}; std::size_t vertices{0}; for (auto const &shape : sweep->create_shapes()) for (auto const &vertex : shape.data().vertices) @@ -865,7 +875,8 @@ editor_mode::selftest_result editor_mode::selftest_track(std::string const &comm } if (command == "lay") { - std::string name, side; + std::string name; + std::string side; words >> name >> side; auto *track{simulation::Paths.find(name)}; if (track == nullptr || track->m_paths.empty()) @@ -1018,7 +1029,8 @@ editor_mode::selftest_result editor_mode::selftest_track(std::string const &comm } if (command == "vprofile") { - std::string from, to; + std::string from; + std::string to; words >> from >> to; auto *first{simulation::Paths.find(from)}; auto *last{simulation::Paths.find(to)}; @@ -1226,8 +1238,10 @@ editor_mode::selftest_result editor_mode::selftest_switch(std::string const &com { if (command == "curvedswitch") { - std::string name, label; - glm::dvec3 at{0.0}, toward{0.0}; + std::string name; + std::string label; + glm::dvec3 at{0.0}; + glm::dvec3 toward{0.0}; words >> name >> at.x >> at.z >> toward.x >> toward.z >> label; m_node = simulation::Paths.find(name); ui()->set_node(m_node); @@ -1270,7 +1284,8 @@ editor_mode::selftest_result editor_mode::selftest_switch(std::string const &com { auto const t{i * 0.125}; auto const point{other.point(t)}; - double best{std::numeric_limits::max()}, along{0.0}; + double best{std::numeric_limits::max()}; + double along{0.0}; for (int k = 0; k <= 2000; ++k) if (auto const distance{geometry::plan_distance(main.point(k / 2000.0), point)}; distance < best) { @@ -1292,7 +1307,8 @@ editor_mode::selftest_result editor_mode::selftest_switch(std::string const &com } if (command == "switchdrive") { - int index{-1}, side{0}; + int index{-1}; + int side{0}; words >> index >> side; scan_switch_drives(); m_switch.drive = index; @@ -1302,7 +1318,8 @@ editor_mode::selftest_result editor_mode::selftest_switch(std::string const &com } if (command == "drivechoice") { - int index{-1}, side{0}; + int index{-1}; + int side{0}; words >> index >> side; scan_switch_drives(); m_switch.drive = index; @@ -1380,7 +1397,8 @@ editor_mode::selftest_result editor_mode::selftest_switch(std::string const &com { std::string label; glm::dvec3 point{0.0}; - int direction{1}, side{1}; + int direction{1}; + int side{1}; words >> label >> point.x >> point.z >> direction >> side; std::replace(label.begin(), label.end(), '_', ' '); auto &tool{m_switch}; @@ -1456,7 +1474,8 @@ editor_mode::selftest_result editor_mode::selftest_switch(std::string const &com { double distance{0.0}; words >> distance; - double low{0.0}, high{0.0}; + double low{0.0}; + double high{0.0}; std::string reason; auto const room{switch_room(*track, low, high, reason)}; auto const done{slide_switch(*track, distance)}; @@ -1524,7 +1543,8 @@ editor_mode::selftest_result editor_mode::selftest_join(std::string const &comma { if (command == "join" || command == "layto") { - glm::dvec3 a{0.0}, b{0.0}; + glm::dvec3 a{0.0}; + glm::dvec3 b{0.0}; words >> a.x >> a.z >> b.x >> b.z; auto const from{editor_track::find_free_end(nullptr, 1, a, 3.0, {})}; extend_tool tool; @@ -1539,7 +1559,8 @@ editor_mode::selftest_result editor_mode::selftest_join(std::string const &comma if (command == "join") { double radius{0.0}; - int variant{0}, transitions{0}; + int variant{0}; + int transitions{0}; words >> radius >> variant >> transitions; auto const to{editor_track::find_free_end(nullptr, 1, b, 3.0, {from.track})}; if (to.track == nullptr) @@ -1619,7 +1640,8 @@ editor_mode::selftest_result editor_mode::selftest_join(std::string const &comma glm::dvec3 previous{0.0}; double slope{0.0}; bool first{true}; - double hanging{0.0}, buried{0.0}; + double hanging{0.0}; + double buried{0.0}; int paths{0}; for (auto step{before}; step < m_history.size(); ++step) for (auto const *track : m_history[step].created) @@ -1722,7 +1744,8 @@ editor_mode::selftest_result editor_mode::selftest_join(std::string const &comma } else if (action == "begin") { - std::string operation, kind; + std::string operation; + std::string kind; int path{-1}; words >> operation >> path >> kind; m_track_point = {}; @@ -1975,7 +1998,8 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co if (command == "orthophoto") { auto config{m_orthophoto.settings()}; - int fit{1}, inscene{0}; + int fit{1}; + int inscene{0}; words >> config.north >> config.east >> config.radius >> fit >> inscene; config.drape = fit != 0; config.in_scene = inscene != 0; @@ -1992,7 +2016,10 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co } if (command == "terrainsculpt" || command == "terrainpaint" || command == "terrainlevel") { - double x{0.0}, z{0.0}, radius{10.0}, value{1.0}; + double x{0.0}; + double z{0.0}; + double radius{10.0}; + double value{1.0}; int mode{0}; words >> x >> z >> radius >> value >> mode; auto const changed{command == "terrainsculpt" ? m_streamer.sculpt(x, z, radius, value) @@ -2006,10 +2033,13 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co { heightmap::modifier modifier; heightmap::corridor_point a, b; - double formation{0.0}, halfwidth{3.5}; + double formation{0.0}; + double halfwidth{3.5}; words >> modifier.name >> a.position.x >> a.position.y >> b.position.x >> b.position.y >> formation >> halfwidth; - a.formation = b.formation = formation; - a.half_width = b.half_width = halfwidth; + b.formation = formation; + a.formation = b.formation; + b.half_width = halfwidth; + a.half_width = b.half_width; modifier.points = {a, b}; m_streamer.modifier(std::move(modifier)); forget_ground(); @@ -2022,7 +2052,8 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co words >> layer >> m_paint_feather >> m_paint_rotation; m_terrain_layer = layer; m_paint_outline.clear(); - double x, z; + double x; + double z; while (words >> x >> z) m_paint_outline.emplace_back(x, 0.0, z); fill_terrain_area(); @@ -2051,7 +2082,9 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co } if (command == "terrainrestore") { - double x{0.0}, z{0.0}, radius{10.0}; + double x{0.0}; + double z{0.0}; + double radius{10.0}; words >> x >> z >> radius; auto const changed{m_streamer.restore_stitching(x, z, radius, 1.0)}; forget_ground(); @@ -2069,7 +2102,8 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co } if (command == "terrainselect") { - int cx{0}, cz{0}; + int cx{0}; + int cz{0}; std::string add; words >> cx >> cz >> add; if (add != "add") @@ -2130,7 +2164,9 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co } if (command == "terrainprobe") { - double x{0.0}, z{0.0}, height{0.0}; + double x{0.0}; + double z{0.0}; + double height{0.0}; words >> x >> z; auto const *chunk{m_streamer.terrain_at(x, z)}; std::string materials; @@ -2146,7 +2182,8 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co if (chunk != nullptr) { auto const &data{chunk->data()}; - double base{0.0}, adjust{0.0}; + double base{0.0}; + double adjust{0.0}; if (false == data.base.empty()) base = data.height_in(data.base, x, z); if (false == data.adjust.empty()) @@ -2171,7 +2208,8 @@ editor_mode::selftest_result editor_mode::selftest_terrain(std::string const &co load_ground_files(); for (auto const &source : m_ground_conversion.files) { - glm::dvec3 low{1e30}, high{-1e30}; + glm::dvec3 low{1e30}; + glm::dvec3 high{-1e30}; for (auto index = source.first; index < source.first + source.count; ++index) for (auto const &vertex : m_ground_conversion.triangles[index]) { diff --git a/application/editormodesweep.cpp b/application/editormodesweep.cpp index 5cc26e21..c77da640 100644 --- a/application/editormodesweep.cpp +++ b/application/editormodesweep.cpp @@ -286,7 +286,10 @@ void editor_mode::sweep_measure() if (platform_model(model)) platform_edge(tool.settings, model, 0.0); else - tool.settings.platform = tool.settings.widen = false; + { + tool.settings.platform = false; + tool.settings.widen = false; + } } tool.model_length = 0.0; if (model.empty()) @@ -544,7 +547,8 @@ bool editor_mode::sweep_press_at(glm::dvec3 const &Point, bool const Anywhere) if (tool.settings.side_anchor == 0) tool.settings.side_anchor = 1; tool.anchor = std::round(station * 10.0) / 10.0; - tool.settings.from = tool.settings.to = tool.anchor; + tool.settings.to = tool.anchor; + tool.settings.from = tool.settings.to; tool.dragging = true; return true; } @@ -1083,7 +1087,8 @@ bool editor_mode::bend_source_of_selection(bend_source &Source) const return false; auto info{m_include.info}; editor_includes::suggest(m_include.target, info); - glm::dvec3 position{0.0}, rotation{0.0}; + glm::dvec3 position{0.0}; + glm::dvec3 rotation{0.0}; Source.parameters = m_include.values; for (std::size_t i = 0; i < Source.parameters.size(); ++i) { @@ -1146,7 +1151,8 @@ bool editor_mode::bend_definition(bend_source const &Source, TTrack &Track, swee State.parameters = Source.parameters; State.scale = Source.scale; State.face = false; - State.platform = State.widen = platform_model(Source.file); + State.widen = platform_model(Source.file); + State.platform = State.widen; State.side_anchor = tool.side_anchor; State.height_anchor = tool.height_anchor; State.point = tool.point; @@ -1181,7 +1187,9 @@ bool editor_mode::bend_definition(bend_source const &Source, TTrack &Track, swee State.flip = (glm::dot(direction, forward) < 0.0) != tool.turned; State.lateral = lateral != 0.0 ? lateral : 1e-3; define(); - glm::dvec3 low, high, shift; + glm::dvec3 low; + glm::dvec3 high; + glm::dvec3 shift; if (false == probe.bounds(low, high, shift)) { tool.status = STR("The model has no triangles to bend, or it can't be loaded"); @@ -1453,7 +1461,9 @@ double editor_mode::bend_fixed(sweep_node const &Sweep, glm::dvec3 const &Point) { auto const from{Sweep.distance_at(Sweep.start())}; auto const stretch{Sweep.distance_at(Sweep.end()) - from}; - glm::dvec3 low, high, shift; + glm::dvec3 low; + glm::dvec3 high; + glm::dvec3 shift; if (false == Sweep.bounds(low, high, shift)) return from; switch (m_bend.along_anchor) @@ -1470,7 +1480,9 @@ double editor_mode::bend_fixed(sweep_node const &Sweep, glm::dvec3 const &Point) void editor_mode::bend_stretch(sweep_node const &Sweep, double const Fixed, double const Length, glm::dvec3 const &Point, sweep_node::state &State) const { - glm::dvec3 low, high, shift; + glm::dvec3 low; + glm::dvec3 high; + glm::dvec3 shift; auto first{Fixed}; switch (m_bend.along_anchor) { @@ -1497,7 +1509,9 @@ void editor_mode::bend_reanchor(sweep_node::state &State, int const Side, int co scene::node_data data; sweep_node probe{data}; probe.define(State); - glm::dvec3 low, high, before; + glm::dvec3 low; + glm::dvec3 high; + glm::dvec3 before; if (false == probe.bounds(low, high, before)) return; auto const stretch{probe.distance_at(probe.end()) - probe.distance_at(probe.start())}; @@ -1525,7 +1539,9 @@ void editor_mode::bend_reanchor(sweep_node::state &State, int const Side, int co glm::dvec3 editor_mode::bend_marker(sweep_node const &Sweep) const { - glm::dvec3 low, high, shift; + glm::dvec3 low; + glm::dvec3 high; + glm::dvec3 shift; if (false == Sweep.bounds(low, high, shift)) return glm::dvec3{0.0}; auto const &state{Sweep.definition()}; @@ -1544,7 +1560,9 @@ void editor_mode::bend_pick(glm::dvec3 const &Point) tool.picking = false; if (auto *sweep{tool.edited}; sweep != nullptr && false == sweep->m_editorremoved) { - glm::dvec3 low, high, shift; + glm::dvec3 low; + glm::dvec3 high; + glm::dvec3 shift; if (false == sweep->bounds(low, high, shift)) return; auto const &state{sweep->definition()}; @@ -1562,7 +1580,9 @@ void editor_mode::bend_pick(glm::dvec3 const &Point) Point.y - at.position.y - state.height - sweep->rise(at) - shift.z}; auto const raw{glm::inverse(axes_matrix(*sweep)) * local / state.scale}; tool.point = raw; - tool.along_anchor = tool.side_anchor = tool.height_anchor = 4; + tool.along_anchor = 4; + tool.side_anchor = 4; + tool.height_anchor = 4; auto next{state}; bend_reanchor(next, 4, 4, raw); bend_edit(next); @@ -1574,7 +1594,9 @@ void editor_mode::bend_pick(glm::dvec3 const &Point) return; auto const local{glm::dvec3(glm::inverse(source.transform) * glm::dvec4(Point, 1.0))}; tool.point = local / source.scale; - tool.along_anchor = tool.side_anchor = tool.height_anchor = 4; + tool.along_anchor = 4; + tool.side_anchor = 4; + tool.height_anchor = 4; tool.signature.clear(); } tool.status = format(STR_C("Reference point %.2f %.2f %.2f in the model"), tool.point.x, tool.point.y, tool.point.z); @@ -1617,7 +1639,9 @@ void editor_mode::render_bend() if (auto *sweep{tool.edited}) { auto state{sweep->definition()}; - glm::dvec3 low, high, shift; + glm::dvec3 low; + glm::dvec3 high; + glm::dvec3 shift; auto const measured{sweep->bounds(low, high, shift)}; auto const own{measured ? high.x - low.x : 0.0}; auto const from{sweep->distance_at(sweep->start())}; @@ -1976,7 +2000,8 @@ void editor_mode::bend_drag_update() }; if (tool.dragging == 2) { - glm::dvec3 origin, direction; + glm::dvec3 origin; + glm::dvec3 direction; projection.ray(mouse, origin, direction); glm::dvec3 normal{Global.pCamera.Pos.x - tool.drag_anchor.x, 0.0, Global.pCamera.Pos.z - tool.drag_anchor.z}; if (glm::length(normal) < 1e-6) @@ -2028,7 +2053,9 @@ sweep_node *editor_mode::sweep_under(glm::dvec3 const &Point) const auto const station{sweep->project(Point, lateral)}; if (station < sweep->start() - 0.5 || station > sweep->end() + 0.5) continue; - glm::dvec3 low, high, shift; + glm::dvec3 low; + glm::dvec3 high; + glm::dvec3 shift; if (false == sweep->bounds(low, high, shift)) continue; auto const at{sweep->frame_at(station)}; diff --git a/application/editormodetrack.cpp b/application/editormodetrack.cpp index 0d43f351..941180fd 100644 --- a/application/editormodetrack.cpp +++ b/application/editormodetrack.cpp @@ -424,7 +424,8 @@ void editor_mode::restore_track_snapshot(EditorSnapshot const &Snapshot, std::ve { m_route.chain = {}; m_route.result = {}; - m_route.vertex = m_route.grip = -1; + m_route.vertex = -1; + m_route.grip = -1; } else { @@ -602,7 +603,13 @@ void editor_mode::render_track_inspector() m_infra.open = m_track_window_open && m_track_tab == track_tab::infra; m_joints.open = m_track_window_open && m_track_tab == track_tab::joints; if (false == m_track_window_open || m_track_tab != track_tab::lineside) - m_sweep.open = m_hekto.open = m_fouling.open = m_parallel.open = m_vehicle.open = false; + { + m_sweep.open = false; + m_hekto.open = false; + m_fouling.open = false; + m_parallel.open = false; + m_vehicle.open = false; + } ui()->set_track(m_track_window_open); if (false == m_track_window_open) { @@ -1531,7 +1538,8 @@ bool editor_mode::route_from_curve(TTrack &Track) { m_route.chain = {}; m_route.result = {}; - m_route.vertex = m_route.grip = -1; + m_route.vertex = -1; + m_route.grip = -1; m_route.error = STR_C("No curve here: LMB on a curve"); return false; } @@ -1630,7 +1638,8 @@ void editor_mode::route_take_stored(int const Index) design.arc_piece_angle = stored.design.arc_piece_angle; route.designed = static_cast(design.vertices.size()); route.origin = stored.origin; - route.vertex = route.grip = -1; + route.vertex = -1; + route.grip = -1; route_update(); } @@ -1788,7 +1797,9 @@ bool editor_mode::route_from_line(TTrack &Track) if (entry.kink) { vertex.radius = std::max(10.0, std::round(alignment::recommend(design.speed, 1000.0, design.norms).radius_min / 10.0) * 10.0); - vertex.transition_in = vertex.transition_out = vertex.cant = 0.0; + vertex.transition_in = 0.0; + vertex.transition_out = 0.0; + vertex.cant = 0.0; } else { @@ -3164,7 +3175,8 @@ void editor_mode::straight_reshape(editor_track::straight const &Line, double co { TTrack *track; int path; - double from, to; + double from; + double to; bool forward; }; auto line{Line}; @@ -3184,9 +3196,11 @@ void editor_mode::straight_reshape(editor_track::straight const &Line, double co } std::sort(spans.begin(), spans.end(), [](span const &A, span const &B) { return A.from < B.from; }); }; - int first{-1}, last{-1}; + int first{-1}; + int last{-1}; auto const select = [&](double const End) { - first = last = -1; + first = -1; + last = -1; for (int i = 0; i < static_cast(spans.size()); ++i) { if (spans[i].to > From && spans[i].from < End) @@ -3213,12 +3227,14 @@ void editor_mode::straight_reshape(editor_track::straight const &Line, double co best = i; if (best < 0) { - first = last = -1; + first = -1; + last = -1; return; } middle = best; } - int low{middle}, high{middle}; + int low{middle}; + int high{middle}; while (low > first && spans[low - 1].track->eType == tt_Normal) --low; while (high < last && spans[high + 1].track->eType == tt_Normal) @@ -3320,7 +3336,8 @@ void editor_mode::straight_reshape(editor_track::straight const &Line, double co state.status = m_route.error; return; } - m_route.design.start_reserve = m_route.design.end_reserve = 0.0; + m_route.design.start_reserve = 0.0; + m_route.design.end_reserve = 0.0; for (auto &vertex : m_route.design.vertices) { vertex.radius = Radius; @@ -3696,7 +3713,8 @@ std::string editor_mode::track_readout() const }; if (m_extend.active) { - double length{0.0}, radius{0.0}; + double length{0.0}; + double radius{0.0}; auto const pieces{extend_pieces()}; for (auto const &piece : pieces) { @@ -5089,7 +5107,8 @@ bool editor_mode::cut_straight(editor_track::straight const &Line, double const { TTrack *track; int path; - double from, to; + double from; + double to; bool forward; }; std::vector spans; @@ -5101,7 +5120,8 @@ bool editor_mode::cut_straight(editor_track::straight const &Line, double const spans.push_back({Line.tracks[i], Line.paths[i], std::min(a, b), std::max(a, b), a < b}); } std::sort(spans.begin(), spans.end(), [](span const &A, span const &B) { return A.from < B.from; }); - int first{-1}, last{-1}; + int first{-1}; + int last{-1}; for (int i = 0; i < static_cast(spans.size()); ++i) { if (spans[i].to > from + 1e-3 && spans[i].from < to - 1e-3) @@ -5367,7 +5387,10 @@ void editor_mode::render_switch_ui() auto label{entry.source != nullptr ? STR("Scenery: ") + entry.label + " (" + std::to_string(entry.count) + "x)" : "PLK: " + entry.label}; label += "##switch" + std::to_string(i); if (ImGui::Selectable(label.c_str(), tool.armed == i)) - tool.armed = tool.last = i; + { + tool.last = i; + tool.armed = tool.last; + } } }; ImGui::TextDisabled("%s", STR_C("Switch template")); @@ -5477,7 +5500,8 @@ void editor_mode::apply_detour() struct span { TTrack *track; - double from, to; + double from; + double to; }; std::vector spans; for (std::size_t i = 0; i < line.tracks.size(); ++i) @@ -5488,7 +5512,8 @@ void editor_mode::apply_detour() spans.push_back({line.tracks[i], std::min(a, b), std::max(a, b)}); } std::sort(spans.begin(), spans.end(), [](span const &A, span const &B) { return A.from < B.from; }); - int first{-1}, last{-1}; + int first{-1}; + int last{-1}; for (int i = 0; i < static_cast(spans.size()); ++i) { if (spans[i].to > from && spans[i].from < to && spans[i].track->eType == tt_Normal) @@ -5501,7 +5526,8 @@ void editor_mode::apply_detour() { if (spans[i].from > stations[3]) break; - first = last = -1; + first = -1; + last = -1; } } if (first < 0) @@ -5523,7 +5549,10 @@ void editor_mode::apply_detour() vertex.radius = radius; route_recommend(vertex); if (false == state.auto_transitions) - vertex.transition_in = vertex.transition_out = state.transition; + { + vertex.transition_out = state.transition; + vertex.transition_in = vertex.transition_out; + } design.vertices.clear(); auto first_vertex{vertex}; first_vertex.offset = std::max(0.1, stations[0] - startalong); @@ -6181,7 +6210,8 @@ std::vector editor_mode::curved_switch_paths(editor_track::switch_ glm::dvec2 const chord{end.x - start.x, end.z - start.z}; auto const localstart{glm::normalize(control1 != glm::dvec3{} ? plan_of(control1) : chord)}; auto const localend{glm::normalize(control2 != glm::dvec3{} ? -plan_of(control2) : chord)}; - glm::dvec2 startdirection, enddirection; + glm::dvec2 startdirection; + glm::dvec2 enddirection; auto const p0{map(start, startdirection, localstart)}; auto const p3{map(end, enddirection, localend)}; auto path{hermite(p0, startdirection, p3, enddirection)}; diff --git a/application/editormodetrackux.cpp b/application/editormodetrackux.cpp index 67b171ff..26b3442c 100644 --- a/application/editormodetrackux.cpp +++ b/application/editormodetrackux.cpp @@ -893,7 +893,8 @@ void editor_mode::start_track_box() { auto const &io{ImGui::GetIO()}; m_track_box.active = true; - m_track_box.from = m_track_box.to = {io.MousePos.x, io.MousePos.y}; + m_track_box.to = {io.MousePos.x, io.MousePos.y}; + m_track_box.from = m_track_box.to; m_track_box.hovered = m_hover.track; } diff --git a/application/editormodeturntable.cpp b/application/editormodeturntable.cpp index 2991a599..182d93bb 100644 --- a/application/editormodeturntable.cpp +++ b/application/editormodeturntable.cpp @@ -772,7 +772,8 @@ editor_mode::track_intent editor_mode::turntable_intent(glm::dvec3 const &Ground intent.position = end.position; return make(kind::turntable_fit, STR("Click: lead this track to the turntable")); } - double heading, length; + double heading; + double length; if (turntable_exit_at(cursor_level(centre.y), heading, length)) { tool.heading = heading; diff --git a/application/editorprojection.h b/application/editorprojection.h index a20d0543..ba3accb8 100644 --- a/application/editorprojection.h +++ b/application/editorprojection.h @@ -91,7 +91,8 @@ class screen_projection // where the ray through the point of the screen crosses the level of the height; false if it runs along it or away bool on_level(ImVec2 const &Screen, double const Height, glm::dvec3 &Point) const { - glm::dvec3 origin, direction; + glm::dvec3 origin; + glm::dvec3 direction; ray(Screen, origin, direction); if (std::abs(direction.y) < 1e-6) return false; diff --git a/editor/editorAlignment.cpp b/editor/editorAlignment.cpp index 44bfcd3e..c702f17a 100644 --- a/editor/editorAlignment.cpp +++ b/editor/editorAlignment.cpp @@ -63,7 +63,8 @@ local_point transition_point(transition_shape const Shape, double const Length, auto const angle = [&](double const S) { return S * S / (2.0 * Radius * Length); }; int const steps{std::max(8, static_cast(std::ceil(distance / 0.5)) * 2)}; double const h{distance / steps}; - double x{0.0}, y{0.0}; + double x{0.0}; + double y{0.0}; for (int i = 0; i <= steps; ++i) { double const weight = (i == 0 || i == steps) ? 1.0 : (i % 2 ? 4.0 : 2.0); @@ -81,7 +82,8 @@ local_point spiral_point(double const Start, double const End, double const Leng auto const heading = [&](double const S) { return Start * S + (End - Start) * S * S / (2.0 * std::max(Length, 1e-9)); }; int const steps{std::max(8, static_cast(std::ceil(Distance / 0.5)) * 2)}; double const h{Distance / steps}; - double x{0.0}, y{0.0}; + double x{0.0}; + double y{0.0}; for (int i = 0; i <= steps; ++i) { double const weight = (i == 0 || i == steps) ? 1.0 : (i % 2 ? 4.0 : 2.0); @@ -127,7 +129,9 @@ compound_curve build_compound(double const Deflection, std::vector segments.push_back({curvatures[i], curvatures[i], share * arcs / curvatures[i]}); } segments.push_back({curvatures.back(), 0.0, Lengthout * f}); - double x{0.0}, y{0.0}, heading{0.0}; + double x{0.0}; + double y{0.0}; + double heading{0.0}; for (auto const &segment : segments) { if (segment[2] < 1e-6) @@ -440,7 +444,8 @@ result fit_between(design const &Design) }; if (angles(1.0) > deflection) { - double low{0.0}, high{1.0}; + double low{0.0}; + double high{1.0}; for (int i = 0; i < 50; ++i) { auto const middle{(low + high) * 0.5}; @@ -490,7 +495,8 @@ result fit_between(design const &Design) auto const fits_budget = [&](double const Radius) { if (transition_point(Design.shape, fit.transition_in, Radius, 1.0).angle + transition_point(Design.shape, fit.transition_out, Radius, 1.0).angle > fit.deflection) return false; - double tangentin, tangentout; + double tangentin; + double tangentout; fit.tangents(Radius, tangentin, tangentout); return tangentin <= budgetin && tangentout <= budgetout; }; @@ -535,7 +541,8 @@ result fit_between(design const &Design) if (fit.radius * (fit.deflection - angles(1.0)) < minimum - 1e-6) { auto const target{fit.deflection - minimum / fit.radius}; - double low{0.0}, high{1.0}; + double low{0.0}; + double high{1.0}; for (int i = 0; i < 50; ++i) { auto const middle{(low + high) * 0.5}; @@ -695,7 +702,8 @@ result fit_between(design const &Design) if (lengthin > 0.0) { curve.kind = element_kind::transition_in; - curve.transition = curve.length = lengthin; + curve.length = lengthin; + curve.transition = curve.length; curve.origin = curvestart; curve.direction = directionin; curve.normal = normalin; @@ -714,7 +722,8 @@ result fit_between(design const &Design) if (lengthout > 0.0) { curve.kind = element_kind::transition_out; - curve.transition = curve.length = lengthout; + curve.length = lengthout; + curve.transition = curve.length; curve.origin = curveend; curve.direction = -directionout; curve.normal = normalout; @@ -827,13 +836,15 @@ result compute(design const &Design) auto const endextension{first.end_extension > 1e-4 ? first.end_extension : 0.0}; if (false == first.errors.empty() || (startextension == 0.0 && endextension == 0.0)) { - first.start_extension = first.end_extension = 0.0; + first.start_extension = 0.0; + first.end_extension = 0.0; return first; } auto extended{Design}; extended.start = along_end(Design.start, Design.start_direction, Design.start_grade, -startextension); extended.end = along_end(Design.end, Design.end_direction, Design.end_grade, endextension); - extended.start_reserve = extended.end_reserve = 0.0; + extended.start_reserve = 0.0; + extended.end_reserve = 0.0; if (extended.vertices.size() >= 2) { extended.vertices.front().offset += startextension; @@ -859,7 +870,8 @@ result compute_recommended(design &Design, bool const Transitions) for (auto &vertex : Design.vertices) { vertex.cant = 0.0; - vertex.transition_in = vertex.transition_out = 0.0; + vertex.transition_in = 0.0; + vertex.transition_out = 0.0; } auto r{compute(Design)}; if (false == Transitions || false == r.valid) @@ -880,7 +892,8 @@ result compute_recommended(design &Design, bool const Transitions) auto const recommended{recommend(allowed, curve.radius, attempt.norms)}; auto const length{recommended.transition * share}; auto &vertex{attempt.vertices[curve.vertex]}; - vertex.transition_in = vertex.transition_out = length; + vertex.transition_out = length; + vertex.transition_in = vertex.transition_out; vertex.cant = std::min({recommended.cant, length * 1000.0 / (attempt.norms.ramp_factor * allowed), attempt.norms.cant_rate * 3.6 * length / allowed}); vertex.cant = vertex.cant < 5.0 ? 0.0 : std::floor(vertex.cant / 5.0) * 5.0; slowest = std::min(slowest, allowed); @@ -1183,7 +1196,8 @@ station evaluate(result const &Result, double const Chainage) auto const s{std::clamp(Chainage, 0.0, Result.length)}; auto const &e{element_at(Result, s)}; auto const distance{std::clamp(s - e.chainage, 0.0, e.length)}; - glm::dvec2 position, direction; + glm::dvec2 position; + glm::dvec2 direction; element_point(e, Result.shape, distance, position, direction); result.position = {position.x, elevation(Result, s), position.y}; result.direction = glm::normalize(glm::dvec3{direction.x, grade(Result, s), direction.y}); @@ -1206,7 +1220,8 @@ std::vector pieces(result const &Result, design const &Design, std struct span { std::size_t element; - double from, to; + double from; + double to; bool generic{false}; double start{0.0}; double end{0.0}; @@ -1333,10 +1348,14 @@ std::vector pieces(result const &Result, design const &Design, std continue; } auto const &e{Result.elements[piece.element]}; - glm::dvec2 p0, p3, d0, d3; + glm::dvec2 p0; + glm::dvec2 p3; + glm::dvec2 d0; + glm::dvec2 d3; element_point(e, Design.shape, piece.from, p0, d0); element_point(e, Design.shape, piece.to, p3, d3); - glm::dvec2 p1, p2; + glm::dvec2 p1; + glm::dvec2 p2; switch (e.kind) { case element_kind::straight: diff --git a/editor/editorAlignment.hpp b/editor/editorAlignment.hpp index 914e7a7a..08c03b22 100644 --- a/editor/editorAlignment.hpp +++ b/editor/editorAlignment.hpp @@ -132,8 +132,10 @@ struct curve_report double tangent_in{0.0}; double tangent_out{0.0}; double unbalanced{0.0}; - double cant_rate_in{0.0}, cant_rate_out{0.0}; - double jerk_in{0.0}, jerk_out{0.0}; + double cant_rate_in{0.0}; + double cant_rate_out{0.0}; + double jerk_in{0.0}; + double jerk_out{0.0}; recommendation recommended; }; diff --git a/editor/editorAlignmentStore.cpp b/editor/editorAlignmentStore.cpp index 55d3445c..572e1459 100644 --- a/editor/editorAlignmentStore.cpp +++ b/editor/editorAlignmentStore.cpp @@ -75,7 +75,8 @@ void sample(record &Record) auto const count{static_cast(std::ceil(length / kStep))}; for (std::size_t i = 0; i <= count; ++i) Record.samples.push_back(plan_of(alignment::evaluate(Record.result, std::min(length, i * kStep)).position)); - Record.low = Record.high = Record.samples.empty() ? glm::dvec2{0.0} : Record.samples.front(); + Record.high = Record.samples.empty() ? glm::dvec2{0.0} : Record.samples.front(); + Record.low = Record.high; for (auto const &point : Record.samples) { Record.low = glm::min(Record.low, point); @@ -152,7 +153,9 @@ alignment::vertex reversed_vertex(alignment::vertex Vertex) { struct part { - double radius, share, transition; + double radius; + double share; + double transition; }; std::vector parts{{Vertex.radius, Vertex.share, 0.0}}; for (auto const &arc : Vertex.arcs) @@ -234,7 +237,8 @@ stored_element describe(alignment::element const &Element) result.radius_end = sign * Element.radius; break; case alignment::element_kind::arc: - result.radius_start = result.radius_end = sign * Element.radius; + result.radius_end = sign * Element.radius; + result.radius_start = result.radius_end; break; case alignment::element_kind::transition_out: result.radius_start = sign * Element.radius; @@ -646,7 +650,8 @@ int store(alignment::design const &Design, alignment::result const &Result, doub record entry; entry.source = Source; entry.design = Design; - entry.design.start_reserve = entry.design.end_reserve = 0.0; + entry.design.start_reserve = 0.0; + entry.design.end_reserve = 0.0; entry.origin = Origin; finish(entry); if (false == entry.result.valid) diff --git a/editor/editorAlignmentStore.hpp b/editor/editorAlignmentStore.hpp index 3ace09ff..4620a06e 100644 --- a/editor/editorAlignmentStore.hpp +++ b/editor/editorAlignmentStore.hpp @@ -47,7 +47,8 @@ struct record alignment::result result; // made of the design std::vector elements; // as written in the file bool consistent{true}; // the design makes the elements written in the file - glm::dvec2 low{0.0}, high{0.0}; + glm::dvec2 low{0.0}; + glm::dvec2 high{0.0}; std::vector samples; }; diff --git a/editor/editorGeometry.hpp b/editor/editorGeometry.hpp index 83db47e5..271178f1 100644 --- a/editor/editorGeometry.hpp +++ b/editor/editorGeometry.hpp @@ -90,7 +90,10 @@ inline std::vector arc_pieces(glm::dvec3 const &Point, glm::dvec2 // path as a cubic Bezier curve; a path without control points is a straight with evenly spread parameter struct bezier { - glm::dvec3 p0, p1, p2, p3; + glm::dvec3 p0; + glm::dvec3 p1; + glm::dvec3 p2; + glm::dvec3 p3; explicit bezier(segment_data const &Path) { diff --git a/editor/editorSwitchStore.cpp b/editor/editorSwitchStore.cpp index 131cbf07..ffc09bc4 100644 --- a/editor/editorSwitchStore.cpp +++ b/editor/editorSwitchStore.cpp @@ -151,7 +151,9 @@ void load() std::istringstream line{text}; record entry; entry.layer = layer; - std::string keyword, hand, km; + std::string keyword; + std::string hand; + std::string km; std::size_t count{0}; line >> entry.kind; if (entry.kind != "switch" && entry.kind != "slip" && entry.kind != "crossing") @@ -163,7 +165,8 @@ void load() entry.parts.resize(count); for (auto &part : entry.parts) line >> part; - glm::dvec3 start{0.0}, ahead{0.0}; + glm::dvec3 start{0.0}; + glm::dvec3 ahead{0.0}; glm::dvec2 direction{0.0, 1.0}; line >> keyword; if (keyword == "shape") diff --git a/editor/editorSwitchStore.hpp b/editor/editorSwitchStore.hpp index 4edf98e8..5ec9d60b 100644 --- a/editor/editorSwitchStore.hpp +++ b/editor/editorSwitchStore.hpp @@ -33,7 +33,8 @@ struct record double radius{0.0}; // of the diverging track of the straight switch the type is made of double ratio{0.0}; // n of 1:n char hand{'-'}; // L, R as seen along the switch from its start - double a{0.0}, b{0.0}; + double a{0.0}; + double b{0.0}; double main_radius{0.0}; // of the main track, signed: + to the right, - to the left, 0 straight std::vector parts; // the switch, the switches of a slip, the paths of a crossing glm::dvec3 start{0.0}; // of the first part diff --git a/editor/editorTrack.cpp b/editor/editorTrack.cpp index 95d3eee9..859e76cb 100644 --- a/editor/editorTrack.cpp +++ b/editor/editorTrack.cpp @@ -1460,7 +1460,8 @@ bool editor_track::is_straight(TTrack const &Track, straight_tolerance const &To auto const &end{path.points[segment_data::point::end]}; auto const length{glm::length(plan_of(end - start))}; auto const direction{glm::normalize(plan_of(end - start))}; - bool foundbefore, foundafter; + bool foundbefore; + bool foundafter; auto const before{direction_at(*Track.trPrev, start, true, foundbefore)}; auto const after{direction_at(*Track.trNext, end, false, foundafter)}; if (false == foundbefore || false == foundafter) @@ -1532,8 +1533,10 @@ editor_track::straight editor_track::find_straight(TTrack &Track, straight_toler } } - double low{0.0}, high{0.0}; - glm::dvec3 lowpoint{origin}, highpoint{origin}; + double low{0.0}; + double high{0.0}; + glm::dvec3 lowpoint{origin}; + glm::dvec3 highpoint{origin}; for (auto const &member : run) { result.tracks.push_back(member.first); @@ -1744,7 +1747,10 @@ bool editor_track::analyse_curve(std::vector> const &R for (std::size_t i = run.size(); i > 0 && varying[i - 1]; --i) Curve.transition_out += lengths[i - 1]; if (Curve.transition_in + Curve.transition_out >= std::accumulate(lengths.begin(), lengths.end(), 0.0)) - Curve.transition_in = Curve.transition_out = 0.0; + { + Curve.transition_in = 0.0; + Curve.transition_out = 0.0; + } Curve.radius = smallest; std::vector arcs; double between{0.0}; @@ -2799,7 +2805,8 @@ void editor_track::move_straight(straight const &Line, glm::dvec3 const &Start, struct interval { - double from, to; + double from; + double to; bool rigid; }; std::vector intervals; @@ -2817,7 +2824,8 @@ void editor_track::move_straight(straight const &Line, glm::dvec3 const &Start, std::sort(intervals.begin(), intervals.end(), [](interval const &A, interval const &B) { return A.from < B.from; }); auto const scale{Line.length - rigidlength > 1e-6 ? (newlength - rigidlength) / (Line.length - rigidlength) : 1.0}; auto const remap = [&](double const Along) { - double mapped{0.0}, previous{0.0}; + double mapped{0.0}; + double previous{0.0}; for (auto const &span : intervals) { if (Along <= span.from) diff --git a/scene/scenelayers.cpp b/scene/scenelayers.cpp index aef7ac05..cda7972b 100644 --- a/scene/scenelayers.cpp +++ b/scene/scenelayers.cpp @@ -1108,7 +1108,8 @@ void node_layers::rebuilt(instance_handle const Instance) std::string scene::node_layers::check_sources() const { std::map files; - std::size_t good{0}, bad{0}; + std::size_t good{0}; + std::size_t bad{0}; std::string report; for (auto const &[node, source] : m_sources) {