17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-22 01:46:26 +02:00

feat(editor): texture of the rails of path 2 of a switch set apart

This commit is contained in:
2026-10-21 15:50:00 +02:00
parent 30cb83584d
commit 16c77ab6fb
3 changed files with 29 additions and 4 deletions

View File

@@ -379,7 +379,7 @@ std::vector<track_property> make_properties()
// look
{
auto &property{add(list, "rails", field::texture, section::look, group::rails, "Rails", "Texture of the rails; of both paths of a switch.\nA material dragged from the texture browser can be dropped here")};
auto &property{add(list, "rails", field::texture, section::look, group::rails, "Rails", "Texture of the rails; of both paths of a switch, those of its path 2 can then be set apart.\nA material dragged from the texture browser can be dropped here")};
property.rebuild = true;
property.texture = 0;
property.empty = "No texture";
@@ -394,6 +394,24 @@ std::vector<track_property> make_properties()
return true;
};
}
{
// a switch keeps the rails of its path 2 in its second texture, its trackbed is m_material3
auto &property{add(list, "rails2", field::texture, section::look, group::rails, "Rails of path 2",
"Texture of the rails of path 2 of the switch, from p3 to p4, usually the diverging track.\nPath 1, from p1 to p2, keeps the texture of the rails above.\nA material dragged from the texture browser can be dropped here")};
property.rebuild = true;
property.late = true; // after the rails, which set both paths
property.texture = 0;
property.empty = "No texture";
property.applies = [](TTrack const &Track) { return Track.m_visible && Track.eType == tt_Switch; };
property.get = [](TTrack const &Track) { return editor_track::material_name(Track.m_material2); };
property.set = [](TTrack &Track, std::string const &Text) {
auto const material{editor_track::fetch_material(Text)};
if (Track.eType != tt_Switch || material == Track.m_material2)
return false;
Track.m_material2 = material;
return true;
};
}
{
// the profiles of the rails the game has (models/tory/railprofile_*), the first: none, the default shape
static char const *const profiles[] = {"", "s60", "uic60", "s49", "s42", "s39", "s30pn", "s30din", "s24", "s20", "s18", "s14", "s10", "r-65", "ri60n", "lk1"};

View File

@@ -3077,7 +3077,8 @@ TTrack *editor_track::create_switch(switch_template const &Template, std::vector
{
std::ostringstream text;
text.precision(std::numeric_limits<double>::digits10);
write_header(text, "switch", Template.length, 10.0, Style, Style.m_material1);
// a switch styled after a switch keeps the rails of its path 2
write_header(text, "switch", Template.length, 10.0, Style, Style.eType == tt_Switch ? Style.m_material2 : Style.m_material1);
write_points(text, Paths[0]);
write_points(text, Paths[1]);
if (auto const trackbed{ballast_of(Style)}; trackbed != null_handle)

View File

@@ -5534,8 +5534,14 @@ msgstr "Ograniczenie prędkości pociągów z opuszczonymi pantografami"
msgid "Names of the track circuits (isolated) the track belongs to, separated by spaces.\nA name which doesn't exist yet makes a new circuit. Tracks with vehicles on them keep theirs"
msgstr "Nazwy odcinków izolowanych, do których należy tor, rozdzielone spacjami.\nNazwa, której jeszcze nie ma, tworzy nowy odcinek izolowany. Tory z pojazdami zachowują swoje"
msgid "Texture of the rails; of both paths of a switch.\nA material dragged from the texture browser can be dropped here"
msgstr "Tekstura szyn; na rozjeździe obu jego torów.\nMożna tu upuścić materiał przeciągnięty z przeglądarki tekstur"
msgid "Texture of the rails; of both paths of a switch, those of its path 2 can then be set apart.\nA material dragged from the texture browser can be dropped here"
msgstr "Tekstura szyn; na rozjeździe obu jego torów, szyny toru 2 można potem ustawić osobno.\nMożna tu upuścić materiał przeciągnięty z przeglądarki tekstur"
msgid "Rails of path 2"
msgstr "Szyny toru 2"
msgid "Texture of the rails of path 2 of the switch, from p3 to p4, usually the diverging track.\nPath 1, from p1 to p2, keeps the texture of the rails above.\nA material dragged from the texture browser can be dropped here"
msgstr "Tekstura szyn toru 2 rozjazdu, od p3 do p4, zwykle toru zwrotnego.\nTor 1, od p1 do p2, zachowuje teksturę szyn podaną wyżej.\nMożna tu upuścić materiał przeciągnięty z przeglądarki tekstur"
msgid "Texture of the trackbed (ballast) under the rails.\nA material dragged from the texture browser can be dropped here"
msgstr "Tekstura podsypki (tłucznia) pod szynami.\nMożna tu upuścić materiał przeciągnięty z przeglądarki tekstur"