17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 15:39:20 +02:00
Files
maszyna/widgets/vehiclelist.cpp
maj00r b8f040e6fd propagate template headers transitively, import Console where used
AnimModel.cpp reaches cParser through the simulation core, not a direct
import, so the previous pass missed it; the propagation now follows the
whole import closure. Train.cpp, drivermode.cpp and Globals.cpp call
Console:: inside _WIN32 guards without importing eu07.console - invisible
on Linux, where those blocks are skipped.
2026-09-10 01:41:24 +02:00

70 lines
1.8 KiB
C++

module;
#include <array>
#include <cstddef>
#include <deque>
#include <unordered_map>
#include <utility>
#include <vector>
#include <chrono>
#include <limits>
#include <mutex>
#include <ostream>
#include <sstream>
#include <type_traits>
#include "imgui/imgui.h"
#include "utilities/translation_macros.h"
#include <string>
#include "utilities/Globals_macros.h"
module eu07.widgets.vehiclelist;
import eu07.utilities.utilities;
import eu07.utilities.translation;
import eu07.utilities.globals;
import eu07.simulation.simulation;
import eu07.simcore;
import eu07.widgets.vehicleparams;
ui::vehiclelist_panel::vehiclelist_panel(ui_layer &parent)
: ui_panel(STR_C("Vehicle list"), false), m_parent(parent)
{
}
void ui::vehiclelist_panel::render_contents()
{
if (m_first_show && Global.gui_trainingdefault) {
for (TDynamicObject *vehicle : simulation::Vehicles.sequence())
{
if (!vehicle->Mechanik || vehicle->name() != ToLower(Global.local_start_vehicle))
continue;
ui_panel *panel = new vehicleparams_panel(vehicle->name());
m_parent.add_owned_panel(panel);
}
m_first_show = false;
is_open = false;
return;
}
for (TDynamicObject *vehicle : simulation::Vehicles.sequence())
{
if (!vehicle->Mechanik)
continue;
std::string name = vehicle->name();
double speed = vehicle->GetVelocity();
std::string timetable;
if (vehicle->Mechanik)
timetable = vehicle->Mechanik->TrainName() + ", ";
std::string label = std::string(name + ", " + timetable + std::to_string(speed) + " km/h###");
ImGui::PushID(vehicle);
if (ImGui::Button(label.c_str())) {
ui_panel *panel = new vehicleparams_panel(vehicle->name());
m_parent.add_owned_panel(panel);
}
ImGui::PopID();
}
}