mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Developer tools: Add vehicle fiz reload button
This commit is contained in:
@@ -5041,7 +5041,8 @@ TDynamicObject::radius() const {
|
||||
// McZapkie-250202
|
||||
// wczytywanie pliku z danymi multimedialnymi (dzwieki)
|
||||
void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string const &ReplacableSkin ) {
|
||||
|
||||
rTypeName = TypeName;
|
||||
rReplacableSkin = ReplacableSkin;
|
||||
Global.asCurrentDynamicPath = asBaseDir;
|
||||
std::string asFileName = asBaseDir + TypeName + ".mmd";
|
||||
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 int NextConnectedNo() const { return MoverParameters->Neighbours[ end::rear ].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
|
||||
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;
|
||||
void ABuCheckMyTrack();
|
||||
|
||||
std::string rTypeName; // nazwa typu pojazdu
|
||||
std::string rReplacableSkin; // nazwa tekstury pojazdu
|
||||
|
||||
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 HighBeamLights { false }; // status of the highbeam toggle
|
||||
|
||||
@@ -1070,6 +1070,8 @@ class TMoverParameters
|
||||
};
|
||||
|
||||
public:
|
||||
std::string chkPath;
|
||||
bool reload_FIZ();
|
||||
double dMoveLen = 0.0;
|
||||
/*---opis lokomotywy, wagonu itp*/
|
||||
/*--opis serii--*/
|
||||
|
||||
@@ -9443,6 +9443,7 @@ void TMoverParameters::BrakeSubsystemDecode()
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::LoadFIZ(std::string chkpath)
|
||||
{
|
||||
chkPath = chkpath; // assign class path for reloading
|
||||
const int param_ok = 1;
|
||||
const int wheels_ok = 2;
|
||||
const int dimensions_ok = 4;
|
||||
@@ -12476,6 +12477,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 {
|
||||
|
||||
weights_table Weights;
|
||||
|
||||
@@ -619,6 +619,7 @@ debug_panel::render() {
|
||||
render_section( "Camera", m_cameralines );
|
||||
render_section( "Gfx Renderer", m_rendererlines );
|
||||
render_section_settings();
|
||||
render_section_developer(); // Developer tools
|
||||
#ifdef WITH_UART
|
||||
if(true == render_section( "UART", m_uartlines)) {
|
||||
int ports_num = UartStatus.available_ports.size();
|
||||
@@ -1475,6 +1476,19 @@ debug_panel::render_section( std::vector<text_line> const &Lines ) {
|
||||
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
|
||||
debug_panel::render_section_settings() {
|
||||
|
||||
|
||||
@@ -104,7 +104,8 @@ private:
|
||||
bool render_section_uart();
|
||||
#endif
|
||||
bool render_section_settings();
|
||||
// members
|
||||
bool render_section_developer();
|
||||
// members
|
||||
std::array<char, 1024> m_buffer;
|
||||
std::array<char, 128> m_eventsearch;
|
||||
input_data m_input;
|
||||
|
||||
Reference in New Issue
Block a user