mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-24 00:49:18 +02: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 };
|
TModel3d *loadmodel { nullptr };
|
||||||
|
|
||||||
// check if we don't have model override for this load type
|
// check if we don't have model override for this load type
|
||||||
auto const lookup { LoadModelOverrides.find( Name ) };
|
{
|
||||||
if( lookup != LoadModelOverrides.end() ) {
|
auto const lookup { LoadModelOverrides.find( Name ) };
|
||||||
loadmodel = TModelsManager::GetModel( asBaseDir + lookup->second, true );
|
if( lookup != LoadModelOverrides.end() ) {
|
||||||
// if the override was succesfully loaded call it a day
|
loadmodel = TModelsManager::GetModel( asBaseDir + lookup->second, true );
|
||||||
if( loadmodel != nullptr ) { return loadmodel; }
|
// 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
|
// regular routine if there's no override or it couldn't be loaded
|
||||||
// try first specialized version of the load model, vehiclename_loadname
|
// try first specialized version of the load model, vehiclename_loadname
|
||||||
auto const specializedloadfilename { asBaseDir + MoverParameters->TypeName + "_" + Name };
|
{
|
||||||
if( ( true == FileExists( specializedloadfilename + ".e3d" ) )
|
auto const specializedloadfilename { asBaseDir + MoverParameters->TypeName + "_" + Name };
|
||||||
|| ( true == FileExists( specializedloadfilename + ".t3d" ) ) ) {
|
loadmodel = TModelsManager::GetModel( specializedloadfilename, true, false );
|
||||||
loadmodel = TModelsManager::GetModel( specializedloadfilename, true );
|
if( loadmodel != nullptr ) { return loadmodel; }
|
||||||
}
|
}
|
||||||
if( loadmodel == nullptr ) {
|
// try generic version of the load model next, loadname
|
||||||
// if this fails, try generic load model
|
{
|
||||||
loadmodel = TModelsManager::GetModel( asBaseDir + Name, true );
|
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;
|
return loadmodel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ TModelsManager::LoadModel(std::string const &Name, bool dynamic) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TModel3d *
|
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
|
{ // model może być we wpisie "node...model" albo "node...dynamic", a także być dodatkowym w dynamic
|
||||||
// (kabina, wnętrze, ładunek)
|
// (kabina, wnętrze, ładunek)
|
||||||
// dla "node...dynamic" mamy podaną ścieżkę w "\dynamic\" i musi być co najmniej 1 poziom, zwkle
|
// 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 {
|
else {
|
||||||
// there's nothing matching in the databank nor on the disk, report failure...
|
// 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
|
// ...and link it with the error model slot
|
||||||
m_modelsmap.emplace( filename, null_handle );
|
m_modelsmap.emplace( filename, null_handle );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ private:
|
|||||||
class TModelsManager {
|
class TModelsManager {
|
||||||
public:
|
public:
|
||||||
// McZapkie: dodalem sciezke, notabene Path!=Patch :)
|
// 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:
|
private:
|
||||||
// types:
|
// 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( Command.action == GLFW_PRESS ) {
|
||||||
|
|
||||||
if( Train->mvOccupied->Doors.has_autowarning ) {
|
if( Train->mvOccupied->Doors.has_autowarning ) {
|
||||||
// automatic departure signal delays actual door closing until the button is released
|
|
||||||
Train->mvOccupied->signal_departure( true );
|
Train->mvOccupied->signal_departure( true );
|
||||||
}
|
}
|
||||||
else {
|
Train->mvOccupied->OperateDoors( side::right, false );
|
||||||
Train->mvOccupied->OperateDoors( side::right, false );
|
Train->mvOccupied->OperateDoors( side::left, false );
|
||||||
Train->mvOccupied->OperateDoors( side::left, false );
|
|
||||||
}
|
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggDoorLeftButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggDoorLeftButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
Train->ggDoorRightButton.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 ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// release the button
|
// release the button
|
||||||
if( Train->mvOccupied->Doors.has_autowarning ) {
|
if( Train->mvOccupied->Doors.has_autowarning ) {
|
||||||
// automatic departure signal delays actual door closing until the button is released
|
|
||||||
Train->mvOccupied->signal_departure( false );
|
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
|
// visual feedback
|
||||||
if( Train->ggDoorAllOffButton.SubModel )
|
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
|
candeparture ? readycolor : // czas minął i odjazd był, to nazwa stacji będzie na zielono
|
||||||
isatpassengerstop ? waitcolor :
|
isatpassengerstop ? waitcolor :
|
||||||
Global.UITextColor ) };
|
Global.UITextColor ) };
|
||||||
|
auto const trackcount{ ( tableline->TrackNo == 1 ? u8" ┃ " : u8" ║ " ) };
|
||||||
m_tablelines.emplace_back(
|
m_tablelines.emplace_back(
|
||||||
( u8"│ " + vmax + u8" │ " + station + u8" │ " + arrival + u8" │ " + traveltime + u8" │" ),
|
( u8"│ " + vmax + u8" │ " + station + trackcount + arrival + u8" │ " + traveltime + u8" │" ),
|
||||||
linecolor );
|
linecolor );
|
||||||
m_tablelines.emplace_back(
|
m_tablelines.emplace_back(
|
||||||
( u8"│ │ " + location + tableline->StationWare + u8" │ " + departure + u8" │ │" ),
|
( u8"│ │ " + location + tableline->StationWare + trackcount + departure + u8" │ │" ),
|
||||||
linecolor );
|
linecolor );
|
||||||
// divider/footer
|
// divider/footer
|
||||||
if( i < table->StationCount ) {
|
if( i < table->StationCount ) {
|
||||||
auto const *nexttableline { tableline + 1 };
|
auto const *nexttableline { tableline + 1 };
|
||||||
if( tableline->vmax == nexttableline->vmax ) {
|
std::string const vmaxnext{ ( tableline->vmax == nexttableline->vmax ? u8"│ ├" : u8"├─────┼" ) };
|
||||||
m_tablelines.emplace_back( u8"│ ├────────────────────────────────────┼─────────┼─────┤", Global.UITextColor );
|
auto const trackcountnext{ ( nexttableline->TrackNo == 1 ? u8"╂" : u8"╫" ) };
|
||||||
}
|
m_tablelines.emplace_back(
|
||||||
else {
|
vmaxnext + u8"────────────────────────────────────" + trackcountnext + u8"─────────┼─────┤",
|
||||||
m_tablelines.emplace_back( u8"├─────┼────────────────────────────────────┼─────────┼─────┤", Global.UITextColor );
|
Global.UITextColor );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
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 + "am" ), timetableline.Am );
|
||||||
Output->insert( ( stationlabel + "dh" ), timetableline.Dh );
|
Output->insert( ( stationlabel + "dh" ), timetableline.Dh );
|
||||||
Output->insert( ( stationlabel + "dm" ), timetableline.Dm );
|
Output->insert( ( stationlabel + "dm" ), timetableline.Dm );
|
||||||
|
Output->insert( ( stationlabel + "tracks" ), timetableline.TrackNo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user