mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-31 00:50:29 +01:00
feat(editor): switch drive placed with a switch leans with the grade and the cant of the track at the points, raised as the simulation raises a canted track
This commit is contained in:
@@ -644,7 +644,7 @@ std::string compose_directive(std::string const &File, std::vector<std::string>
|
||||
return text + " end";
|
||||
}
|
||||
|
||||
std::string directive(std::string const &File, include_info const &Info, int const Parameters, glm::dvec3 const &Location, std::optional<float> Yaw, std::string const &Track)
|
||||
std::string directive(std::string const &File, include_info const &Info, int const Parameters, glm::dvec3 const &Location, std::optional<float> Yaw, std::string const &Track, glm::dvec2 const &Tilt)
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
for (auto id = 1; id <= Parameters; ++id)
|
||||
@@ -668,6 +668,14 @@ std::string directive(std::string const &File, include_info const &Info, int con
|
||||
{
|
||||
value = number(*Yaw);
|
||||
}
|
||||
else if (role == "rot.x" && Tilt.x != 0.0)
|
||||
{
|
||||
value = number(Tilt.x);
|
||||
}
|
||||
else if (role == "rot.z" && Tilt.y != 0.0)
|
||||
{
|
||||
value = number(Tilt.y);
|
||||
}
|
||||
else if (role.starts_with("rot.") && value.empty())
|
||||
{
|
||||
value = "0";
|
||||
|
||||
@@ -71,7 +71,7 @@ bool complete(include_info const &Info, int Parameters, std::string *Issue = nul
|
||||
// builds include directive which places specified template. Location and Yaw are the placement to pass through
|
||||
// the parameters with matching roles, in the coordinates of the place the directive goes to; without Yaw the
|
||||
// rotation parameters receive their default values
|
||||
std::string directive(std::string const &File, include_info const &Info, int Parameters, glm::dvec3 const &Location, std::optional<float> Yaw, std::string const &Track = {});
|
||||
std::string directive(std::string const &File, include_info const &Info, int Parameters, glm::dvec3 const &Location, std::optional<float> Yaw, std::string const &Track = {}, glm::dvec2 const &Tilt = glm::dvec2{0.0});
|
||||
|
||||
// splits include directive into the name of the included file and the values of the parameters, both as they're
|
||||
// written. returns: false if the text isn't a complete include directive
|
||||
|
||||
Reference in New Issue
Block a user