new map dialog now automatically sets default lump name when game configuration is selected an no lump name is given

This commit is contained in:
codeimp 2008-05-05 15:16:39 +00:00
parent cc51bad183
commit c6404db777
3 changed files with 17 additions and 6 deletions

View file

@ -36,6 +36,7 @@ namespace CodeImp.DoomBuilder.Config
private string name; private string name;
private string filename; private string filename;
private string settingskey; private string settingskey;
private string defaultlumpname;
private string nodebuildersave; private string nodebuildersave;
private string nodebuildertest; private string nodebuildertest;
private string nodebuilder3d; private string nodebuilder3d;
@ -49,6 +50,7 @@ namespace CodeImp.DoomBuilder.Config
public string Name { get { return name; } } public string Name { get { return name; } }
public string Filename { get { return filename; } } public string Filename { get { return filename; } }
public string DefaultLumpName { get { return defaultlumpname; } }
public string NodebuilderSave { get { return nodebuildersave; } set { nodebuildersave = value; } } public string NodebuilderSave { get { return nodebuildersave; } set { nodebuildersave = value; } }
public string NodebuilderTest { get { return nodebuildertest; } set { nodebuildertest = value; } } public string NodebuilderTest { get { return nodebuildertest; } set { nodebuildertest = value; } }
public string Nodebuilder3D { get { return nodebuilder3d; } set { nodebuilder3d = value; } } public string Nodebuilder3D { get { return nodebuilder3d; } set { nodebuilder3d = value; } }
@ -61,13 +63,16 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // Constructor
public ConfigurationInfo(string name, string filename) public ConfigurationInfo(Configuration cfg, string filename)
{ {
// Initialize // Initialize
this.name = name;
this.filename = filename; this.filename = filename;
this.settingskey = Path.GetFileNameWithoutExtension(filename).ToLower(); this.settingskey = Path.GetFileNameWithoutExtension(filename).ToLower();
// Load settings from game configuration
this.name = cfg.ReadSetting("game", "<unnamed game>");
this.defaultlumpname = cfg.ReadSetting("defaultlumpname", "");
// Load settings from program configuration // Load settings from program configuration
this.nodebuildersave = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildersave", ""); this.nodebuildersave = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildersave", "");
this.nodebuildertest = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildertest", ""); this.nodebuildertest = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildertest", "");

View file

@ -232,13 +232,12 @@ namespace CodeImp.DoomBuilder
cfg = LoadGameConfiguration(Path.GetFileName(filepath)); cfg = LoadGameConfiguration(Path.GetFileName(filepath));
if(cfg != null) if(cfg != null)
{ {
// Get name and filename
name = cfg.ReadSetting("game", "<unnamed game>");
fullfilename = Path.GetFileName(filepath); fullfilename = Path.GetFileName(filepath);
ConfigurationInfo cfginfo = new ConfigurationInfo(cfg, fullfilename);
// Add to lists // Add to lists
General.WriteLogLine("Registered game configuration '" + name + "' from '" + fullfilename + "'"); General.WriteLogLine("Registered game configuration '" + cfginfo.Name + "' from '" + fullfilename + "'");
configs.Add(new ConfigurationInfo(name, fullfilename)); configs.Add(cfginfo);
} }
} }

View file

@ -175,6 +175,13 @@ namespace CodeImp.DoomBuilder.Interface
// Get the info // Get the info
ci = (ConfigurationInfo)config.SelectedItem; ci = (ConfigurationInfo)config.SelectedItem;
// No lump name in the name field?
if(levelname.Text.Trim().Length == 0)
{
// Get default lump name from configuration
levelname.Text = ci.DefaultLumpName;
}
// Show resources // Show resources
datalocations.FixedResourceLocationList(ci.Resources); datalocations.FixedResourceLocationList(ci.Resources);
} }