mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
refactor: create paths namespace instead of global variables
This commit is contained in:
@@ -1654,7 +1654,7 @@ animation_event::deserialize_( cParser &Input, scene::scratch_data &Scratchpad )
|
||||
{ // animacja z pliku VMD
|
||||
{
|
||||
m_animationfilename = token;
|
||||
std::ifstream file( szModelPath + m_animationfilename, std::ios::binary | std::ios::ate ); file.unsetf( std::ios::skipws );
|
||||
std::ifstream file( paths::models + m_animationfilename, std::ios::binary | std::ios::ate ); file.unsetf( std::ios::skipws );
|
||||
auto size = file.tellg(); // ios::ate already positioned us at the end of the file
|
||||
file.seekg( 0, std::ios::beg ); // rewind the caret afterwards
|
||||
// animation size, previously held in param 7
|
||||
|
||||
@@ -2266,9 +2266,9 @@ TTrack::export_as_text_( std::ostream &Output ) const {
|
||||
m_material1 != null_handle ?
|
||||
GfxRenderer->Material( m_material1 )->GetName() :
|
||||
"none" ) };
|
||||
if( texturefile.find( szTexturePath ) == 0 ) {
|
||||
if( texturefile.find( paths::textures ) == 0 ) {
|
||||
// don't include 'textures/' in the path
|
||||
texturefile.erase( 0, std::string{ szTexturePath }.size() );
|
||||
texturefile.erase( 0, std::string{ paths::textures }.size() );
|
||||
}
|
||||
Output
|
||||
<< texturefile << ' '
|
||||
@@ -2278,9 +2278,9 @@ TTrack::export_as_text_( std::ostream &Output ) const {
|
||||
m_material2 != null_handle ?
|
||||
GfxRenderer->Material( m_material2 )->GetName() :
|
||||
"none" );
|
||||
if( texturefile.find( szTexturePath ) == 0 ) {
|
||||
if( texturefile.find( paths::textures ) == 0 ) {
|
||||
// don't include 'textures/' in the path
|
||||
texturefile.erase( 0, std::string{ szTexturePath }.size() );
|
||||
texturefile.erase( 0, std::string{ paths::textures }.size() );
|
||||
}
|
||||
Output << texturefile << ' ';
|
||||
|
||||
@@ -2351,9 +2351,9 @@ TTrack::export_as_text_( std::ostream &Output ) const {
|
||||
if( ( eType == tt_Switch )
|
||||
&& ( SwitchExtension->m_material3 != null_handle ) ) {
|
||||
auto texturefile { GfxRenderer->Material( m_material2 )->GetName() };
|
||||
if( texturefile.find( szTexturePath ) == 0 ) {
|
||||
if( texturefile.find( paths::textures ) == 0 ) {
|
||||
// don't include 'textures/' in the path
|
||||
texturefile.erase( 0, std::string{ szTexturePath }.size() );
|
||||
texturefile.erase( 0, std::string{ paths::textures }.size() );
|
||||
}
|
||||
Output << "trackbed " << texturefile << ' ';
|
||||
}
|
||||
@@ -2384,7 +2384,7 @@ std::string TTrack::tooltip() const
|
||||
std::pair<std::string, int>
|
||||
TTrack::fetch_track_rail_profile( std::string const &Profile ) {
|
||||
|
||||
auto const railprofilepath { std::string( szModelPath ) + "tory/railprofile_" };
|
||||
auto const railprofilepath { std::string( paths::models ) + "tory/railprofile_" };
|
||||
auto const railkeyprefix { std::string( "rail_" ) };
|
||||
|
||||
if( m_profiles.empty() ) {
|
||||
@@ -2414,7 +2414,7 @@ TTrack::fetch_default_profiles() {
|
||||
|
||||
if( false == m_profiles.empty() ) { return; }
|
||||
|
||||
auto const railprofilepath { std::string( szModelPath ) + "tory/railprofile_" };
|
||||
auto const railprofilepath { std::string( paths::models ) + "tory/railprofile_" };
|
||||
auto const railkeyprefix { std::string( "rail_" ) };
|
||||
|
||||
m_profiles.emplace_back( deserialize_profile( railprofilepath + "default" ) );
|
||||
|
||||
@@ -617,7 +617,7 @@ TTrainParameters::load_sounds() {
|
||||
|
||||
auto const lookup {
|
||||
FileExists(
|
||||
{ Global.asCurrentSceneryPath + stationname, std::string{ szSoundPath } + "sip/" + stationname },
|
||||
{ Global.asCurrentSceneryPath + stationname, std::string{ paths::sounds } + "sip/" + stationname },
|
||||
{ ".ogg", ".flac", ".wav" } ) };
|
||||
if( lookup.first.empty() ) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user