diff --git a/application/editormode.h b/application/editormode.h index f8d3e547..987ba5d3 100644 --- a/application/editormode.h +++ b/application/editormode.h @@ -1419,6 +1419,7 @@ class editor_mode : public application_mode, private editor_track::observer, pri std::vector lay_pieces(std::vector const &Points, editor_track::snap_target const &End, double &Length, std::string &Error) const; alignment::result lay_shape(std::vector const &Points, glm::dvec2 const &Startdirection, glm::dvec2 const &Enddirection, alignment::design &Design) const; void render_switch_ui(); + void render_switch_timbers(); void render_rail_profile_hint(TTrack &Track); bool start_switch_placement(); void finish_switch_placement(); @@ -1821,6 +1822,9 @@ class editor_mode : public application_mode, private editor_track::observer, pri void select_tracks(std::vector const &Tracks); // changes each track which can be changed, in one step of the undo; false from Change: the track stays as it was std::size_t tracks_apply(std::vector const &Tracks, std::function const &Change, bool const Rebuild, char const *What); + // the model of the timbers, with the fastenings where it has them, set on all the switches and crossings of the scenery, in one + // step of the undo; empty: the one of eu07.ini. returns: the tracks changed + std::size_t set_switch_timbers(std::string const &Model); int track_property_index(std::string const &Key) const; std::size_t track_property_apply(int const Property, std::vector const &Tracks, std::string const &Text); void track_field_settle(); diff --git a/application/editormodeselftest.cpp b/application/editormodeselftest.cpp index 3617b307..749ad391 100644 --- a/application/editormodeselftest.cpp +++ b/application/editormodeselftest.cpp @@ -71,6 +71,7 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c // railtime lays out the rails of every track, as when its geometry is made, and logs how long it took // throw <0|1> sets every switch to the path and moves its blades there at once // crossings [name] logs where rails of tracks cross rails of other tracks and of what kind (acute, obtuse, middle acute or obtuse, wide), checks that each acute crossing has one partner and one nose +// switchtimbers the model of the timbers set on all the switches and crossings, as the buttons of the switch tool do it // frogkey name [on|off] sets or clears the frogs key of a switch (one undo step); logs the key, whether it is written, the frog and the crossings // geomhash [name] logs the number of vertices and a hash of the drawn geometry of each rail track (rails, trackbed, cut faces), to compare builds; exact: the bits of every value, userdata and tread materials too // sweep =... model, params (separated by commas), lateral, height, side (origin, near, far, diff --git a/application/editormodeselftestrails.cpp b/application/editormodeselftestrails.cpp index 86d69280..ee1e7b4f 100644 --- a/application/editormodeselftestrails.cpp +++ b/application/editormodeselftestrails.cpp @@ -324,6 +324,15 @@ editor_mode::selftest_result editor_mode::selftest_rails(std::string const &comm WriteLog(format("SELFTEST geom total: tracks %d, vertices %zu, hash %016llx, exact %016llx", tracks, vertices, static_cast(total), static_cast(exacttotal))); return selftest_result::handled; } + if (command == "switchtimbers") + { + std::string model; + words >> model; + if (model == "none") + model.clear(); + WriteLog(format("SELFTEST switchtimbers %s: %zu tracks", model.c_str(), set_switch_timbers(model))); + return selftest_result::handled; + } if (command == "frogkey") { std::string name, value; diff --git a/application/editormodeswitchtool.cpp b/application/editormodeswitchtool.cpp index 169dde34..41f163a5 100644 --- a/application/editormodeswitchtool.cpp +++ b/application/editormodeswitchtool.cpp @@ -19,6 +19,7 @@ http://mozilla.org/MPL/2.0/. #include "simulation/simulation.h" #include "utilities/translation.h" #include "world/Track.h" +#include "world/TrackSleepers.h" #include "imgui/imgui.h" #include @@ -390,6 +391,7 @@ void editor_mode::render_switch_ui() arm_switch(); } item_tooltip("Looks for the switches of the scenery, to use their shapes as the templates"); + render_switch_timbers(); ImGui::TreePop(); } ImGui::PopID(); @@ -405,6 +407,35 @@ void editor_mode::render_switch_ui() item_tooltip("Own switch templates: diverging tracks of straights, arcs and transition curves, double switches"); } +// the timbers of all the switches and crossings of the scenery at once: a button for each model of timbers of the scenery data +void editor_mode::render_switch_timbers() +{ + ImGui::TextDisabled("%s", STR_C("Timbers of all the switches")); + auto first{true}; + auto const button = [&](std::string const &Model, std::string const &Label) { + if (false == first) + ImGui::SameLine(); + first = false; + if (ImGui::Button((Label + "##switchtimbers" + Model).c_str())) + m_switch.status = format(STR_C("Timbers %s set on %d tracks"), Label.c_str(), static_cast(set_switch_timbers(Model))); + item_tooltip("Sets the model of the timbers, with the fastenings where it has them, on all the switches and crossings of the scenery, in one step of the undo"); + }; + for (auto const &model : track_sleepers::pack_models()) + if (model.timber) + button(model.name, model.name.substr(model.name.find_last_of('/') + 1)); + button({}, STR_C("As in eu07.ini")); +} + +std::size_t editor_mode::set_switch_timbers(std::string const &Model) +{ + std::vector tracks; + for (auto *track : simulation::Paths.sequence()) + if (track != nullptr && false == track->m_editorremoved && (track->iCategoryFlag & 15) == 1 && (track->eType == tt_Switch || false == track->m_crossings.empty()) + && track->m_timber_model_name != Model) + tracks.push_back(track); + return tracks_apply(tracks, [&](TTrack &Track) { Track.m_timber_model_name = Model; return true; }, true, "Timber model"); +} + // a track with no rail profile, as the sceneries of the older editors have them: the templates of all the rails are offered. // the profile set at once on all the tracks laid with the same rails and no profile, so a scenery is put right in a few clicks void editor_mode::render_rail_profile_hint(TTrack &Track) diff --git a/lang/editor_pl.po b/lang/editor_pl.po index 3f277d7a..f1e8205d 100644 --- a/lang/editor_pl.po +++ b/lang/editor_pl.po @@ -11627,3 +11627,138 @@ msgid_plural "Applies the preset on %d selected tracks" msgstr[0] "Stosuje zestaw na %d zaznaczonym torze" msgstr[1] "Stosuje zestaw na %d zaznaczonych torach" msgstr[2] "Stosuje zestaw na %d zaznaczonych torach" + +# scenery editor: texture blending of the tracks + +msgid "Texture blending" +msgstr "Mieszanie tekstur" + +msgid "Ballast blending at p1 (m)" +msgstr "Mieszanie podsypki przy p1 (m)" + +msgid "Ballast blending at p2 (m)" +msgstr "Mieszanie podsypki przy p2 (m)" + +msgid "Ballast blending at p4 (m)" +msgstr "Mieszanie podsypki przy p4 (m)" + +msgid "Rails blending at p1 (m)" +msgstr "Mieszanie szyn przy p1 (m)" + +msgid "Rails blending at p2 (m)" +msgstr "Mieszanie szyn przy p2 (m)" + +msgid "How far from the end p1 the ballast fades into that of the track joined there, where their textures differ; 0: the joint stays sharp, whatever the track joined there has" +msgstr "Na jakiej długości od końca p1 podsypka płynnie przechodzi w podsypkę toru tam dołączonego, gdy ich tekstury są różne; 0: ostra granica na styku, niezależnie od ustawienia toru tam dołączonego" + +msgid "How far from the end p2 the ballast fades into that of the track joined there, where their textures differ; 0: the joint stays sharp, whatever the track joined there has" +msgstr "Na jakiej długości od końca p2 podsypka płynnie przechodzi w podsypkę toru tam dołączonego, gdy ich tekstury są różne; 0: ostra granica na styku, niezależnie od ustawienia toru tam dołączonego" + +msgid "How far from the end p4 of the switch its trackbed fades into the ballast of the track joined there, where their textures differ; 0: the joint stays sharp, whatever the track joined there has" +msgstr "Na jakiej długości od końca p4 rozjazdu jego podsypka płynnie przechodzi w podsypkę toru tam dołączonego, gdy ich tekstury są różne; 0: ostra granica na styku, niezależnie od ustawienia toru tam dołączonego" + +msgid "How far from the end p1 the rails fade into those of the track joined there, where their textures differ; 0: the joint stays sharp, whatever the track joined there has" +msgstr "Na jakiej długości od końca p1 szyny płynnie przechodzą w szyny toru tam dołączonego, gdy ich tekstury są różne; 0: ostra granica na styku, niezależnie od ustawienia toru tam dołączonego" + +msgid "How far from the end p2 the rails fade into those of the track joined there, where their textures differ; 0: the joint stays sharp, whatever the track joined there has" +msgstr "Na jakiej długości od końca p2 szyny płynnie przechodzą w szyny toru tam dołączonego, gdy ich tekstury są różne; 0: ostra granica na styku, niezależnie od ustawienia toru tam dołączonego" + +# scenery editor: level crossings told by memory cells + +msgid "Memory cell" +msgstr "Komórka pamięci" + +msgid "(named after the crossing)" +msgstr "(nazwana od przejazdu)" + +msgid "Events of the scenery close the entry onto the crossing with the first value of this memory cell:\nabove 0 the vehicles heading for the crossing are stopped, below 0 it's kept open whatever comes by the rails,\n0 leaves it to the trains. The vehicles past the stops, on the crossing or leaving it, drive on.\nThe crossing sets the second value: 1 while the entry is closed, 0 while it's open.\nLeft empty, the cell is the one named after the crossing with \":block\" added, made if the scenery doesn't have it" +msgstr "Eventy scenerii zamykają wjazd na przejazd pierwszą wartością tej komórki pamięci:\npowyżej 0 pojazdy jadące na przejazd są zatrzymywane, poniżej 0 jest on otwarty bez względu na to, co jedzie po torach,\n0 zostawia to pociągom. Pojazdy za miejscami zatrzymania, na przejeździe albo zjeżdżające z niego, jadą dalej.\nPrzejazd ustawia drugą wartość: 1, gdy wjazd jest zamknięty, 0, gdy jest otwarty.\nGdy pole jest puste, jest to komórka nazwana od przejazdu z dodanym \":block\", tworzona, jeśli sceneria jej nie ma" + +msgid "The crossing has no name, so there's no memory cell to tell it by" +msgstr "Przejazd nie ma nazwy, więc nie ma komórki pamięci, którą można nim sterować" + +msgid "The entry is closed" +msgstr "Wjazd zamknięty" + +msgid "The entry is open" +msgstr "Wjazd otwarty" + +msgid "By the trains" +msgstr "Według pociągów" + +msgid "Closed" +msgstr "Zamknięty" + +msgid "Kept open" +msgstr "Otwarty" + +msgid "Sets the first value of the memory cell, the way an event of the scenery would. It isn't saved with the scenery" +msgstr "Ustawia pierwszą wartość komórki pamięci, tak jak zrobiłby to event scenerii. Nie jest zapisywane w scenerii" + +# scenery editor: memory cells window + +msgid "Debug" +msgstr "Debugowanie" + +msgid "Memory cells" +msgstr "Komórki pamięci" + +msgid "Looks up the memory cells of the scenery, shows what's in them and sets it by hand" +msgstr "Wyszukuje komórki pamięci scenerii, pokazuje ich zawartość i pozwala ją ustawić ręcznie" + +msgid "In the texts too" +msgstr "Także w tekstach" + +msgid "Log all" +msgstr "Wszystkie do logu" + +msgid "Writes the content of all memory cells to the log" +msgstr "Zapisuje zawartość wszystkich komórek pamięci do logu" + +msgid "Memory cells: %d, shown: %d" +msgstr "Komórek pamięci: %d, pokazanych: %d" + +msgid "Text" +msgstr "Tekst" + +msgid "Value 1" +msgstr "Wartość 1" + +msgid "Value 2" +msgstr "Wartość 2" + +msgid "Made by the simulator, it isn't saved with the scenery" +msgstr "Utworzona przez symulator, nie jest zapisywana w scenerii" + +msgid "Pick a memory cell from the list to set what's in it. A double click shows where it is" +msgstr "Wybierz komórkę pamięci z listy, aby ustawić jej zawartość. Podwójne kliknięcie pokazuje, gdzie jest" + +msgid "\"%s\": %s %g %g" +msgstr "\"%s\": %s %g %g" + +msgid "At %.1f %.1f %.1f" +msgstr "Położenie %.1f %.1f %.1f" + +msgid "Puts the ticked fields in the cell, the way an UpdateValues event does. The scenery files aren't changed" +msgstr "Wpisuje zaznaczone pola do komórki, tak jak event UpdateValues. Pliki scenerii nie są zmieniane" + +msgid "Add to the values" +msgstr "Dodaj do wartości" + +msgid "Read again" +msgstr "Odczytaj ponownie" + +msgid "Pick a memory cell from the list to set what's in it" +msgstr "Wybierz komórkę pamięci z listy, aby ustawić jej zawartość" + +msgid "Timbers of all the switches" +msgstr "Podrozjazdnice wszystkich rozjazdów" + +msgid "Timbers %s set on %d tracks" +msgstr "Podrozjazdnice %s ustawione na %d torach" + +msgid "As in eu07.ini" +msgstr "Jak w eu07.ini" + +msgid "Sets the model of the timbers, with the fastenings where it has them, on all the switches and crossings of the scenery, in one step of the undo" +msgstr "Ustawia model podrozjazdnic, razem z przytwierdzeniami tam, gdzie je ma, na wszystkich rozjazdach i skrzyżowaniach scenerii, jednym krokiem cofania"