mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Improved scenery loading from SBT
When found SBT file, ignores "*_ter.scm" files
This commit is contained in:
86
parser.cpp
86
parser.cpp
@@ -247,17 +247,41 @@ std::string cParser::readToken( bool ToLower, const char *Break ) {
|
||||
if( expandIncludes && token == "include" ) {
|
||||
std::string includefile = allowRandomIncludes ? deserialize_random_set(*this) : readToken(ToLower); // nazwa pliku
|
||||
replace_slashes(includefile);
|
||||
if( ( true == LoadTraction )
|
||||
|| ( ( false == contains( includefile, "tr/" ) )
|
||||
&& ( false == contains( includefile, "tra/" ) ) ) ) {
|
||||
if (Global.ParserLogIncludes)
|
||||
WriteLog("including: " + includefile);
|
||||
if ((true == LoadTraction) ||
|
||||
((false == contains(includefile, "tr/")) && (false == contains(includefile, "tra/"))))
|
||||
{
|
||||
if (false == contains(includefile, "_ter.scm"))
|
||||
{
|
||||
if (Global.ParserLogIncludes)
|
||||
WriteLog("including: " + includefile);
|
||||
mIncludeParser = std::make_shared<cParser>( includefile, buffer_FILE, mPath, LoadTraction, readParameters( *this ) );
|
||||
mIncludeParser->allowRandomIncludes = allowRandomIncludes;
|
||||
mIncludeParser->autoclear( m_autoclear );
|
||||
if( mIncludeParser->mSize <= 0 ) {
|
||||
ErrorLog( "Bad include: can't open file \"" + includefile + "\"" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(true == Global.file_binary_terrain_state)
|
||||
{
|
||||
WriteLog("SBT found, ignoring: " + includefile);
|
||||
readParameters(*this);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Global.ParserLogIncludes)
|
||||
WriteLog("including terrain: " + includefile);
|
||||
mIncludeParser = std::make_shared<cParser>(includefile, buffer_FILE, mPath,
|
||||
LoadTraction, readParameters(*this));
|
||||
mIncludeParser->allowRandomIncludes = allowRandomIncludes;
|
||||
mIncludeParser->autoclear(m_autoclear);
|
||||
if (mIncludeParser->mSize <= 0)
|
||||
{
|
||||
ErrorLog("Bad include: can't open file \"" + includefile + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
while( token != "end" ) {
|
||||
@@ -272,18 +296,46 @@ std::string cParser::readToken( bool ToLower, const char *Break ) {
|
||||
includeparser.allowRandomIncludes = allowRandomIncludes;
|
||||
std::string includefile = allowRandomIncludes ? deserialize_random_set( includeparser ) : includeparser.readToken( ToLower ); // nazwa pliku
|
||||
replace_slashes(includefile);
|
||||
if( ( true == LoadTraction )
|
||||
|| ( ( false == contains( includefile, "tr/" ) )
|
||||
&& ( false == contains( includefile, "tra/" ) ) ) ) {
|
||||
if (Global.ParserLogIncludes)
|
||||
WriteLog("including: " + includefile);
|
||||
mIncludeParser = std::make_shared<cParser>( includefile, buffer_FILE, mPath, LoadTraction, readParameters( includeparser ) );
|
||||
mIncludeParser->allowRandomIncludes = allowRandomIncludes;
|
||||
mIncludeParser->autoclear( m_autoclear );
|
||||
if( mIncludeParser->mSize <= 0 ) {
|
||||
ErrorLog( "Bad include: can't open file \"" + includefile + "\"" );
|
||||
}
|
||||
}
|
||||
if ((true == LoadTraction) ||
|
||||
((false == contains(includefile, "tr/")) && (false == contains(includefile, "tra/"))))
|
||||
{
|
||||
if (false == contains(includefile, "_ter.scm"))
|
||||
{
|
||||
if (Global.ParserLogIncludes)
|
||||
WriteLog("including: " + includefile);
|
||||
mIncludeParser = std::make_shared<cParser>(
|
||||
includefile, buffer_FILE, mPath, LoadTraction, readParameters(includeparser));
|
||||
mIncludeParser->allowRandomIncludes = allowRandomIncludes;
|
||||
mIncludeParser->autoclear(m_autoclear);
|
||||
if (mIncludeParser->mSize <= 0)
|
||||
{
|
||||
ErrorLog("Bad include: can't open file \"" + includefile + "\"");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (true == Global.file_binary_terrain_state)
|
||||
{
|
||||
WriteLog("SBT found, ignoring: " + includefile);
|
||||
readParameters(includeparser);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Global.ParserLogIncludes)
|
||||
WriteLog("including terrain: " + includefile);
|
||||
mIncludeParser =
|
||||
std::make_shared<cParser>(includefile, buffer_FILE, mPath, LoadTraction,
|
||||
readParameters(includeparser));
|
||||
mIncludeParser->allowRandomIncludes = allowRandomIncludes;
|
||||
mIncludeParser->autoclear(m_autoclear);
|
||||
if (mIncludeParser->mSize <= 0)
|
||||
{
|
||||
ErrorLog("Bad include: can't open file \"" + includefile + "\"");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
token = readToken( ToLower, Break );
|
||||
}
|
||||
// all done
|
||||
|
||||
Reference in New Issue
Block a user