mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 01:39:20 +02:00
feat(scenery): models laid along curves (sweep nodes), bent to follow the paths or repeated along them, loaded and saved with the scenery; trainsets put on a path while the simulation runs; trainset turned around by reversed after its header: the first vehicle stays at the offset and leads towards point 1, the rest stands behind it; launcher keeps reversed trainsets and can turn one around; memory cells saved with the new name of the path they name; events tell their targets and the events of a multiple event; renderer tells whether the cursor is over a surface; vehicle placed in the editor entered when the driving goes on
This commit is contained in:
@@ -119,6 +119,10 @@ void ui::scenerylist_panel::draw_launch_box()
|
||||
|
||||
ImGui::TextWrapped(selected_trainset->description.c_str());
|
||||
|
||||
ImGui::Checkbox(STR_C("Trainset turned around"), &selected_trainset->reversed);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("%s", STR_C("The first vehicle stays where the trainset starts and leads the other way,\nthe rest of the trainset stands behind it"));
|
||||
|
||||
if (ImGui::Button(STR_C("Launch"), ImVec2(-1, 0))) {
|
||||
if (!launch_simulation())
|
||||
ImGui::OpenPopup("missing_driver");
|
||||
@@ -163,7 +167,7 @@ void ui::scenerylist_panel::add_replace_entry(const trainset_desc &trainset)
|
||||
set += trainset.name + " ";
|
||||
set += trainset.track + " ";
|
||||
set += std::to_string(trainset.offset) + " ";
|
||||
set += std::to_string(trainset.velocity) + "\n";
|
||||
set += std::to_string(trainset.velocity) + (trainset.reversed ? " reversed\n" : "\n");
|
||||
for (const auto &veh : trainset.vehicles) {
|
||||
if (!veh.skin) {
|
||||
ErrorLog("trainset contains invalid vehicle " + veh.name);
|
||||
|
||||
@@ -95,6 +95,10 @@ void scenery_scanner::parse_trainset(cParser &parser)
|
||||
parser >> trainset.name >> trainset.track >> trainset.offset >> trainset.velocity;
|
||||
|
||||
parser.getTokens();
|
||||
if (parser.peek() == "reversed") {
|
||||
trainset.reversed = true;
|
||||
parser.getTokens();
|
||||
}
|
||||
while (parser.peek() == "node") {
|
||||
trainset.vehicles.emplace_back();
|
||||
dynamic_desc &dyn = trainset.vehicles.back();
|
||||
|
||||
@@ -30,6 +30,7 @@ struct trainset_desc {
|
||||
|
||||
float offset { 0.f };
|
||||
float velocity { 0.f };
|
||||
bool reversed { false };
|
||||
|
||||
std::vector<dynamic_desc> vehicles;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user