mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 20:59:19 +02:00
Developer tools: Add vehicle fiz reload button
This commit is contained in:
@@ -5041,7 +5041,8 @@ TDynamicObject::radius() const {
|
|||||||
// McZapkie-250202
|
// McZapkie-250202
|
||||||
// wczytywanie pliku z danymi multimedialnymi (dzwieki)
|
// wczytywanie pliku z danymi multimedialnymi (dzwieki)
|
||||||
void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string const &ReplacableSkin ) {
|
void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string const &ReplacableSkin ) {
|
||||||
|
rTypeName = TypeName;
|
||||||
|
rReplacableSkin = ReplacableSkin;
|
||||||
Global.asCurrentDynamicPath = asBaseDir;
|
Global.asCurrentDynamicPath = asBaseDir;
|
||||||
std::string asFileName = asBaseDir + TypeName + ".mmd";
|
std::string asFileName = asBaseDir + TypeName + ".mmd";
|
||||||
std::string asAnimName;
|
std::string asAnimName;
|
||||||
|
|||||||
9
DynObj.h
9
DynObj.h
@@ -209,7 +209,11 @@ public:
|
|||||||
inline TDynamicObject *PrevConnected() const { return MoverParameters->Neighbours[ end::front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
|
inline TDynamicObject *PrevConnected() const { return MoverParameters->Neighbours[ end::front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
|
||||||
inline int NextConnectedNo() const { return MoverParameters->Neighbours[ end::rear ].vehicle_end; }
|
inline int NextConnectedNo() const { return MoverParameters->Neighbours[ end::rear ].vehicle_end; }
|
||||||
inline int PrevConnectedNo() const { return MoverParameters->Neighbours[ end::front ].vehicle_end; }
|
inline int PrevConnectedNo() const { return MoverParameters->Neighbours[ end::front ].vehicle_end; }
|
||||||
// double fTrackBlock; // odległość do przeszkody do dalszego ruchu (wykrywanie kolizji z innym pojazdem)
|
|
||||||
|
// Dev tools
|
||||||
|
void Reload();
|
||||||
|
|
||||||
|
// double fTrackBlock; // odległość do przeszkody do dalszego ruchu (wykrywanie kolizji z innym pojazdem)
|
||||||
|
|
||||||
// modele składowe pojazdu
|
// modele składowe pojazdu
|
||||||
TModel3d *mdModel; // model pudła
|
TModel3d *mdModel; // model pudła
|
||||||
@@ -573,6 +577,9 @@ private:
|
|||||||
TDynamicObject *ABuFindObject( int &Foundcoupler, double &Distance, TTrack const *Track, int const Direction, int const Mycoupler ) const;
|
TDynamicObject *ABuFindObject( int &Foundcoupler, double &Distance, TTrack const *Track, int const Direction, int const Mycoupler ) const;
|
||||||
void ABuCheckMyTrack();
|
void ABuCheckMyTrack();
|
||||||
|
|
||||||
|
std::string rTypeName; // nazwa typu pojazdu
|
||||||
|
std::string rReplacableSkin; // nazwa tekstury pojazdu
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool DimHeadlights{ false }; // status of the headlight dimming toggle. NOTE: single toggle for all lights is a simplification. TODO: separate per-light switches
|
bool DimHeadlights{ false }; // status of the headlight dimming toggle. NOTE: single toggle for all lights is a simplification. TODO: separate per-light switches
|
||||||
bool HighBeamLights { false }; // status of the highbeam toggle
|
bool HighBeamLights { false }; // status of the highbeam toggle
|
||||||
|
|||||||
@@ -1069,6 +1069,8 @@ class TMoverParameters
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
std::string chkPath;
|
||||||
|
bool reload_FIZ();
|
||||||
double dMoveLen = 0.0;
|
double dMoveLen = 0.0;
|
||||||
/*---opis lokomotywy, wagonu itp*/
|
/*---opis lokomotywy, wagonu itp*/
|
||||||
/*--opis serii--*/
|
/*--opis serii--*/
|
||||||
|
|||||||
@@ -9444,6 +9444,7 @@ void TMoverParameters::BrakeSubsystemDecode()
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::LoadFIZ(std::string chkpath)
|
bool TMoverParameters::LoadFIZ(std::string chkpath)
|
||||||
{
|
{
|
||||||
|
chkPath = chkpath; // assign class path for reloading
|
||||||
const int param_ok = 1;
|
const int param_ok = 1;
|
||||||
const int wheels_ok = 2;
|
const int wheels_ok = 2;
|
||||||
const int dimensions_ok = 4;
|
const int dimensions_ok = 4;
|
||||||
@@ -12473,6 +12474,24 @@ double TMoverParameters::ShowCurrentP(int AmpN) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMoverParameters::reload_FIZ() {
|
||||||
|
WriteLog("[DEV] Reloading FIZ for " + Name);
|
||||||
|
// pause simulation
|
||||||
|
Global.iPause |= 0b1000;
|
||||||
|
bool result = LoadFIZ(chkPath);
|
||||||
|
if (result == true)
|
||||||
|
{
|
||||||
|
// jesli sie udalo przeladowac FIZ
|
||||||
|
Global.iPause &= 0b0111;
|
||||||
|
WriteLog("[DEV] FIZ reloaded for " + Name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// failed to reload - exit simulator
|
||||||
|
ErrorLog("[DEV] Failed to reload fiz for vehicle " + Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
namespace simulation {
|
namespace simulation {
|
||||||
|
|
||||||
weights_table Weights;
|
weights_table Weights;
|
||||||
|
|||||||
@@ -622,6 +622,7 @@ debug_panel::render() {
|
|||||||
render_section( "Camera", m_cameralines );
|
render_section( "Camera", m_cameralines );
|
||||||
render_section( "Gfx Renderer", m_rendererlines );
|
render_section( "Gfx Renderer", m_rendererlines );
|
||||||
render_section_settings();
|
render_section_settings();
|
||||||
|
render_section_developer(); // Developer tools
|
||||||
#ifdef WITH_UART
|
#ifdef WITH_UART
|
||||||
if(true == render_section( "UART", m_uartlines)) {
|
if(true == render_section( "UART", m_uartlines)) {
|
||||||
int ports_num = UartStatus.available_ports.size();
|
int ports_num = UartStatus.available_ports.size();
|
||||||
@@ -1492,6 +1493,19 @@ debug_panel::render_section( std::vector<text_line> const &Lines ) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool debug_panel::render_section_developer()
|
||||||
|
{
|
||||||
|
if (false == ImGui::CollapsingHeader("Developer tools"))
|
||||||
|
return false;
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, {Global.UITextColor.r, Global.UITextColor.g, Global.UITextColor.b, Global.UITextColor.a});
|
||||||
|
ImGui::TextUnformatted("Warning! These tools are only for developers.\nDo not use them if you are NOT sure what they do!");
|
||||||
|
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "These settings may crash your simulator!");
|
||||||
|
if (ImGui::Button("Reload current vehicle .fiz") == true)
|
||||||
|
{
|
||||||
|
m_input.vehicle->MoverParameters->reload_FIZ(); // reload fiz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
debug_panel::render_section_settings() {
|
debug_panel::render_section_settings() {
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ private:
|
|||||||
bool render_section_uart();
|
bool render_section_uart();
|
||||||
#endif
|
#endif
|
||||||
bool render_section_settings();
|
bool render_section_settings();
|
||||||
// members
|
bool render_section_developer();
|
||||||
|
// members
|
||||||
std::array<char, 1024> m_buffer;
|
std::array<char, 1024> m_buffer;
|
||||||
std::array<char, 128> m_eventsearch;
|
std::array<char, 128> m_eventsearch;
|
||||||
input_data m_input;
|
input_data m_input;
|
||||||
|
|||||||
Reference in New Issue
Block a user