2009-04-19 18:07:22 +00:00
#region = = = = = = = = = = = = = = = = = = Copyright ( c ) 2007 Pascal vd Heiden
/ *
* Copyright ( c ) 2007 Pascal vd Heiden , www . codeimp . com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* /
#endregion
#region = = = = = = = = = = = = = = = = = = Namespaces
using CodeImp.DoomBuilder.IO ;
#endregion
namespace CodeImp.DoomBuilder.Config
{
public struct MapLumpInfo
{
// Members
2014-11-11 11:47:10 +00:00
public readonly string Name ;
public readonly bool Required ;
public readonly bool BlindCopy ;
public readonly bool NodeBuild ;
public readonly bool AllowEmpty ;
public readonly bool ScriptBuild ; //mxd
2017-02-14 18:27:10 +00:00
public readonly bool Forbidden ; // [ZZ]
2014-11-11 11:47:10 +00:00
internal readonly ScriptConfiguration Script ;
2009-04-19 18:07:22 +00:00
// Construct from IDictionary
internal MapLumpInfo ( string name , Configuration cfg )
{
// Apply settings
2014-11-11 11:47:10 +00:00
this . Name = name ;
this . Script = null ;
this . Required = cfg . ReadSetting ( "maplumpnames." + name + ".required" , false ) ;
this . BlindCopy = cfg . ReadSetting ( "maplumpnames." + name + ".blindcopy" , false ) ;
this . NodeBuild = cfg . ReadSetting ( "maplumpnames." + name + ".nodebuild" , false ) ;
this . AllowEmpty = cfg . ReadSetting ( "maplumpnames." + name + ".allowempty" , false ) ;
this . ScriptBuild = cfg . ReadSetting ( "maplumpnames." + name + ".scriptbuild" , false ) ; //mxd
2017-02-14 18:27:10 +00:00
this . Forbidden = cfg . ReadSetting ( "maplumpnames." + name + ".forbidden" , false ) ; //mxd
string scriptconfig = ( this . ScriptBuild ? string . Empty : cfg . ReadSetting ( "maplumpnames." + name + ".script" , "" ) ) ; //mxd. Setting Script when "scriptbuild" is true can result in unexpected behaviour...
2009-04-19 18:07:22 +00:00
// Find script configuration
if ( scriptconfig . Length > 0 )
{
if ( General . ScriptConfigs . ContainsKey ( scriptconfig . ToLowerInvariant ( ) ) )
{
2014-11-11 11:47:10 +00:00
this . Script = General . ScriptConfigs [ scriptconfig . ToLowerInvariant ( ) ] ;
2009-04-19 18:07:22 +00:00
}
else
{
2016-02-22 08:04:06 +00:00
General . ErrorLogger . Add ( ErrorType . Warning , "Map lump \"" + name + "\" in the current game configuration specifies an unknown script configuration \"" + scriptconfig + "\". Using plain text instead." ) ;
2014-11-11 11:47:10 +00:00
this . Script = new ScriptConfiguration ( ) ;
2009-04-19 18:07:22 +00:00
}
}
}
2017-02-14 18:27:10 +00:00
}
2009-04-19 18:07:22 +00:00
}