mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
timetable ui panel enhancement, door cab control logic fix, load visualization model loading error logging tweak
This commit is contained in:
29
DynObj.cpp
29
DynObj.cpp
@@ -5769,23 +5769,28 @@ TDynamicObject::LoadMMediaFile_mdload( std::string const &Name ) const {
|
||||
TModel3d *loadmodel { nullptr };
|
||||
|
||||
// check if we don't have model override for this load type
|
||||
auto const lookup { LoadModelOverrides.find( Name ) };
|
||||
if( lookup != LoadModelOverrides.end() ) {
|
||||
loadmodel = TModelsManager::GetModel( asBaseDir + lookup->second, true );
|
||||
// if the override was succesfully loaded call it a day
|
||||
if( loadmodel != nullptr ) { return loadmodel; }
|
||||
{
|
||||
auto const lookup { LoadModelOverrides.find( Name ) };
|
||||
if( lookup != LoadModelOverrides.end() ) {
|
||||
loadmodel = TModelsManager::GetModel( asBaseDir + lookup->second, true );
|
||||
// if the override was succesfully loaded call it a day
|
||||
if( loadmodel != nullptr ) { return loadmodel; }
|
||||
}
|
||||
}
|
||||
// regular routine if there's no override or it couldn't be loaded
|
||||
// try first specialized version of the load model, vehiclename_loadname
|
||||
auto const specializedloadfilename { asBaseDir + MoverParameters->TypeName + "_" + Name };
|
||||
if( ( true == FileExists( specializedloadfilename + ".e3d" ) )
|
||||
|| ( true == FileExists( specializedloadfilename + ".t3d" ) ) ) {
|
||||
loadmodel = TModelsManager::GetModel( specializedloadfilename, true );
|
||||
{
|
||||
auto const specializedloadfilename { asBaseDir + MoverParameters->TypeName + "_" + Name };
|
||||
loadmodel = TModelsManager::GetModel( specializedloadfilename, true, false );
|
||||
if( loadmodel != nullptr ) { return loadmodel; }
|
||||
}
|
||||
if( loadmodel == nullptr ) {
|
||||
// if this fails, try generic load model
|
||||
loadmodel = TModelsManager::GetModel( asBaseDir + Name, true );
|
||||
// try generic version of the load model next, loadname
|
||||
{
|
||||
auto const genericloadfilename { asBaseDir + Name };
|
||||
loadmodel = TModelsManager::GetModel( genericloadfilename, true, false );
|
||||
if( loadmodel != nullptr ) { return loadmodel; }
|
||||
}
|
||||
// if we're still here, give up
|
||||
return loadmodel;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ TModelsManager::LoadModel(std::string const &Name, bool dynamic) {
|
||||
}
|
||||
|
||||
TModel3d *
|
||||
TModelsManager::GetModel(std::string const &Name, bool const Dynamic)
|
||||
TModelsManager::GetModel(std::string const &Name, bool const Dynamic, bool const Logerrors )
|
||||
{ // model może być we wpisie "node...model" albo "node...dynamic", a także być dodatkowym w dynamic
|
||||
// (kabina, wnętrze, ładunek)
|
||||
// dla "node...dynamic" mamy podaną ścieżkę w "\dynamic\" i musi być co najmniej 1 poziom, zwkle
|
||||
@@ -107,7 +107,9 @@ TModelsManager::GetModel(std::string const &Name, bool const Dynamic)
|
||||
}
|
||||
else {
|
||||
// there's nothing matching in the databank nor on the disk, report failure...
|
||||
ErrorLog( "Bad file: failed do locate 3d model file \"" + filename + "\"", logtype::file );
|
||||
if( Logerrors ) {
|
||||
ErrorLog( "Bad file: failed do locate 3d model file \"" + filename + "\"", logtype::file );
|
||||
}
|
||||
// ...and link it with the error model slot
|
||||
m_modelsmap.emplace( filename, null_handle );
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ private:
|
||||
class TModelsManager {
|
||||
public:
|
||||
// McZapkie: dodalem sciezke, notabene Path!=Patch :)
|
||||
static TModel3d *GetModel( std::string const &Name, bool dynamic = false );
|
||||
static TModel3d *GetModel( std::string const &Name, bool const dynamic = false, bool const Logerrors = true );
|
||||
|
||||
private:
|
||||
// types:
|
||||
|
||||
11
Train.cpp
11
Train.cpp
@@ -4719,13 +4719,10 @@ void TTrain::OnCommand_doorcloseall( TTrain *Train, command_data const &Command
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
|
||||
if( Train->mvOccupied->Doors.has_autowarning ) {
|
||||
// automatic departure signal delays actual door closing until the button is released
|
||||
Train->mvOccupied->signal_departure( true );
|
||||
}
|
||||
else {
|
||||
Train->mvOccupied->OperateDoors( side::right, false );
|
||||
Train->mvOccupied->OperateDoors( side::left, false );
|
||||
}
|
||||
Train->mvOccupied->OperateDoors( side::right, false );
|
||||
Train->mvOccupied->OperateDoors( side::left, false );
|
||||
// visual feedback
|
||||
Train->ggDoorLeftButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
Train->ggDoorRightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
@@ -4735,11 +4732,7 @@ void TTrain::OnCommand_doorcloseall( TTrain *Train, command_data const &Command
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
// release the button
|
||||
if( Train->mvOccupied->Doors.has_autowarning ) {
|
||||
// automatic departure signal delays actual door closing until the button is released
|
||||
Train->mvOccupied->signal_departure( false );
|
||||
// now we can actually close the door
|
||||
Train->mvOccupied->OperateDoors( side::right, false );
|
||||
Train->mvOccupied->OperateDoors( side::left, false );
|
||||
}
|
||||
// visual feedback
|
||||
if( Train->ggDoorAllOffButton.SubModel )
|
||||
|
||||
@@ -377,24 +377,26 @@ timetable_panel::update() {
|
||||
candeparture ? readycolor : // czas minął i odjazd był, to nazwa stacji będzie na zielono
|
||||
isatpassengerstop ? waitcolor :
|
||||
Global.UITextColor ) };
|
||||
auto const trackcount{ ( tableline->TrackNo == 1 ? u8" ┃ " : u8" ║ " ) };
|
||||
m_tablelines.emplace_back(
|
||||
( u8"│ " + vmax + u8" │ " + station + u8" │ " + arrival + u8" │ " + traveltime + u8" │" ),
|
||||
( u8"│ " + vmax + u8" │ " + station + trackcount + arrival + u8" │ " + traveltime + u8" │" ),
|
||||
linecolor );
|
||||
m_tablelines.emplace_back(
|
||||
( u8"│ │ " + location + tableline->StationWare + u8" │ " + departure + u8" │ │" ),
|
||||
( u8"│ │ " + location + tableline->StationWare + trackcount + departure + u8" │ │" ),
|
||||
linecolor );
|
||||
// divider/footer
|
||||
if( i < table->StationCount ) {
|
||||
auto const *nexttableline { tableline + 1 };
|
||||
if( tableline->vmax == nexttableline->vmax ) {
|
||||
m_tablelines.emplace_back( u8"│ ├────────────────────────────────────┼─────────┼─────┤", Global.UITextColor );
|
||||
}
|
||||
else {
|
||||
m_tablelines.emplace_back( u8"├─────┼────────────────────────────────────┼─────────┼─────┤", Global.UITextColor );
|
||||
}
|
||||
std::string const vmaxnext{ ( tableline->vmax == nexttableline->vmax ? u8"│ ├" : u8"├─────┼" ) };
|
||||
auto const trackcountnext{ ( nexttableline->TrackNo == 1 ? u8"╂" : u8"╫" ) };
|
||||
m_tablelines.emplace_back(
|
||||
vmaxnext + u8"────────────────────────────────────" + trackcountnext + u8"─────────┼─────┤",
|
||||
Global.UITextColor );
|
||||
}
|
||||
else {
|
||||
m_tablelines.emplace_back( u8"└─────┴────────────────────────────────────┴─────────┴─────┘", Global.UITextColor );
|
||||
m_tablelines.emplace_back(
|
||||
u8"└─────┴────────────────────────────────────┴─────────┴─────┘",
|
||||
Global.UITextColor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,6 +549,7 @@ void TTrainParameters::serialize( dictionary_source *Output ) const {
|
||||
Output->insert( ( stationlabel + "am" ), timetableline.Am );
|
||||
Output->insert( ( stationlabel + "dh" ), timetableline.Dh );
|
||||
Output->insert( ( stationlabel + "dm" ), timetableline.Dm );
|
||||
Output->insert( ( stationlabel + "tracks" ), timetableline.TrackNo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user