Linedef Edit Form, UDMF: a waring is now shown when trying to apply a non-zero action without any activation flags.

Program Configuration: selected test engine index was not saved when applying the form.
Program Configuration: selected test engine index was not pasted when pasting a game configuration or test engines.
Program Configuration: in some cases current test engine name was not saved when applying the form.
Program Configuration: fixed broken logic when trying to add a test engine with the same file name as already existing one.
This commit is contained in:
MaxED 2014-09-08 21:26:30 +00:00
parent 697069e27b
commit 1521f9ba20
3 changed files with 41 additions and 10 deletions

View file

@ -391,6 +391,7 @@ namespace CodeImp.DoomBuilder.Config
this.nodebuildersave = ci.nodebuildersave; this.nodebuildersave = ci.nodebuildersave;
this.nodebuildertest = ci.nodebuildertest; this.nodebuildertest = ci.nodebuildertest;
this.formatinterface = ci.formatinterface; //mxd this.formatinterface = ci.formatinterface; //mxd
this.currentEngineIndex = ci.currentEngineIndex; //mxd
this.resources = new DataLocationList(); this.resources = new DataLocationList();
this.resources.AddRange(ci.resources); this.resources.AddRange(ci.resources);
@ -472,8 +473,10 @@ namespace CodeImp.DoomBuilder.Config
//mxd //mxd
internal void PasteTestEnginesFrom(ConfigurationInfo source) internal void PasteTestEnginesFrom(ConfigurationInfo source)
{ {
currentEngineIndex = source.currentEngineIndex;
testEngines = new List<EngineInfo>(); testEngines = new List<EngineInfo>();
foreach(EngineInfo info in source.testEngines) testEngines.Add(new EngineInfo(info)); foreach(EngineInfo info in source.testEngines) testEngines.Add(new EngineInfo(info));
if(currentEngineIndex >= testEngines.Count) currentEngineIndex = testEngines.Count - 1;
changed = true; changed = true;
} }
@ -491,12 +494,14 @@ namespace CodeImp.DoomBuilder.Config
{ {
nodebuildersave = source.nodebuildersave; nodebuildersave = source.nodebuildersave;
nodebuildertest = source.nodebuildertest; nodebuildertest = source.nodebuildertest;
currentEngineIndex = source.currentEngineIndex;
resources = new DataLocationList(); resources = new DataLocationList();
resources.AddRange(source.resources); resources.AddRange(source.resources);
testEngines = new List<EngineInfo>(); testEngines = new List<EngineInfo>();
foreach(EngineInfo info in source.testEngines) foreach(EngineInfo info in source.testEngines)
testEngines.Add(new EngineInfo(info)); if(currentEngineIndex >= testEngines.Count) currentEngineIndex = testEngines.Count - 1; testEngines.Add(new EngineInfo(info));
if(currentEngineIndex >= testEngines.Count) currentEngineIndex = testEngines.Count - 1;
linedefColorPresets = new LinedefColorPreset[source.linedefColorPresets.Length]; linedefColorPresets = new LinedefColorPreset[source.linedefColorPresets.Length];
for(int i = 0; i < source.linedefColorPresets.Length; i++) for(int i = 0; i < source.linedefColorPresets.Length; i++)
linedefColorPresets[i] = new LinedefColorPreset(source.linedefColorPresets[i]); linedefColorPresets[i] = new LinedefColorPreset(source.linedefColorPresets[i]);

View file

@ -309,7 +309,7 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. Update engine name if needed //mxd. Update engine name if needed
configinfo.TestEngines[configinfo.CurrentEngineIndex].CheckProgramName(false); configinfo.TestEngines[configinfo.CurrentEngineIndex].CheckProgramName(false);
cbEngineSelector.Text = configinfo.TestProgramName; cbEngineSelector.Items[cbEngineSelector.SelectedIndex] = configinfo.TestProgramName;
} }
// Test parameters changed // Test parameters changed
@ -337,11 +337,26 @@ namespace CodeImp.DoomBuilder.Windows
} }
} }
//mxd
private void ApplyTestEngineNameChange()
{
int index = (int)cbEngineSelector.Tag;
if(index != -1 && cbEngineSelector.Text != cbEngineSelector.Items[index].ToString()) {
cbEngineSelector.Items[index] = cbEngineSelector.Text;
configinfo.TestProgramName = cbEngineSelector.Text;
configinfo.Changed = true; //mxd
}
}
// OK clicked // OK clicked
private void apply_Click(object sender, EventArgs e) private void apply_Click(object sender, EventArgs e)
{ {
ConfigurationInfo ci; ConfigurationInfo ci;
//mxd. Apply changes of current test engine name, if there are any
//TODO: move engine selector stuff into separate component!
if(configinfo != null) ApplyTestEngineNameChange();
//mxd. Apply configuration items. They should be in the same order, riiiight? //mxd. Apply configuration items. They should be in the same order, riiiight?
for(int i = 0; i < listconfigs.Items.Count; i++) { for(int i = 0; i < listconfigs.Items.Count; i++) {
// Get configuration item // Get configuration item
@ -389,7 +404,6 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. Update engine name //mxd. Update engine name
configinfo.TestEngines[configinfo.CurrentEngineIndex].CheckProgramName(true); configinfo.TestEngines[configinfo.CurrentEngineIndex].CheckProgramName(true);
configinfo.Changed = true; configinfo.Changed = true;
cbEngineSelector.Text = configinfo.TestProgramName;
} }
} }
@ -725,13 +739,7 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
private void cbEngineSelector_DropDown(object sender, EventArgs e) { private void cbEngineSelector_DropDown(object sender, EventArgs e) {
int index = (int)cbEngineSelector.Tag; ApplyTestEngineNameChange();
if(index != -1 && cbEngineSelector.Text != cbEngineSelector.Items[index].ToString()) {
cbEngineSelector.Items[index] = cbEngineSelector.Text;
configinfo.TestProgramName = cbEngineSelector.Text;
configinfo.Changed = true; //mxd
}
} }
//mxd //mxd

View file

@ -700,6 +700,24 @@ namespace CodeImp.DoomBuilder.Windows
return; return;
} }
// Check if we have at least one activation flag when there's an action in UDMF map format (mxd)
if (General.Map.UDMF && !action.Empty)
{
bool haveactivationflag = false;
foreach (CheckBox c in udmfactivates.Checkboxes)
{
if (c.CheckState != CheckState.Unchecked)
{
haveactivationflag = true;
break;
}
}
if (!haveactivationflag &&
General.ShowWarningMessage("You are setting an action without any activation flags.\nIs that OK?", MessageBoxButtons.YesNo) == DialogResult.No)
return;
}
//mxd //mxd
bool hasAcs = !action.Empty && Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1; bool hasAcs = !action.Empty && Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1;
int lockNum = lockNumber.GetResult(0); int lockNum = lockNumber.GetResult(0);