mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-30 07:31:36 +00:00
Changed: when using "Save map" action, only .dbs file is saved when map was not changed.
Cosmetic: changed Angle Control's outline color.
This commit is contained in:
parent
7235fa6394
commit
e849c04112
4 changed files with 49 additions and 6 deletions
|
@ -29,7 +29,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
//UI colors
|
||||
private readonly Color fillColor = SystemColors.Window;
|
||||
private readonly Color fillInactiveColor = SystemColors.Control;
|
||||
private readonly Color outlineColor = SystemColors.ActiveCaption;
|
||||
private readonly Color outlineColor = SystemColors.WindowFrame;
|
||||
private readonly Color outlineInactiveColor = SystemColors.ControlDarkDark;
|
||||
private readonly Color needleColor = SystemColors.ControlText;
|
||||
private readonly Color needleInactiveColor = SystemColors.ControlDarkDark;
|
||||
|
|
|
@ -1334,7 +1334,8 @@ namespace CodeImp.DoomBuilder
|
|||
if(map == null) return false;
|
||||
|
||||
//mxd
|
||||
if (map.Launcher.GameEngineRunning) {
|
||||
if (map.Launcher.GameEngineRunning)
|
||||
{
|
||||
ShowWarningMessage("Cannot save the map while game engine is running" + Environment.NewLine + "Please close '" + map.ConfigSettings.TestProgram + "' first.", MessageBoxButtons.OK);
|
||||
return false;
|
||||
}
|
||||
|
@ -1352,6 +1353,20 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
else
|
||||
{
|
||||
//mxd. Do we need to save the map?
|
||||
if (!map.MapSaveRequired(map.FilePathName, SavePurpose.Normal))
|
||||
{
|
||||
// Still save settings file
|
||||
result = map.SaveSettingsFile(map.FilePathName);
|
||||
|
||||
// Display status
|
||||
mainwindow.DisplayStatus(StatusType.Info, "Map is up to date. No saving required.");
|
||||
|
||||
// All done
|
||||
mainwindow.UpdateInterface();
|
||||
return result;
|
||||
}
|
||||
|
||||
// Display status
|
||||
mainwindow.DisplayStatus(StatusType.Busy, "Saving map file...");
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
@ -1397,8 +1412,9 @@ namespace CodeImp.DoomBuilder
|
|||
if(map == null) return false;
|
||||
|
||||
//mxd
|
||||
if(map.Launcher.GameEngineRunning) {
|
||||
ShowWarningMessage("Cannot save the map while game engine is running" + Environment.NewLine + "Please close '" + map.ConfigSettings.TestProgram + "' first.", MessageBoxButtons.OK);
|
||||
if(map.Launcher.GameEngineRunning)
|
||||
{
|
||||
ShowWarningMessage("Cannot save the map while a game engine is running" + Environment.NewLine + "Please close '" + map.ConfigSettings.TestProgram + "' first.", MessageBoxButtons.OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1476,7 +1492,8 @@ namespace CodeImp.DoomBuilder
|
|||
if(map == null) return false;
|
||||
|
||||
//mxd
|
||||
if(map.Launcher.GameEngineRunning) {
|
||||
if(map.Launcher.GameEngineRunning)
|
||||
{
|
||||
ShowWarningMessage("Cannot save the map while game engine is running" + Environment.NewLine + "Please close '" + map.ConfigSettings.TestProgram + "' first.", MessageBoxButtons.OK);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -744,7 +744,7 @@ namespace CodeImp.DoomBuilder {
|
|||
CopyLumpsByType(tempwad, TEMP_MAP_HEADER, targetwad, origmapname, true, true, includenodes, true);
|
||||
|
||||
// mxd. Was the map renamed?
|
||||
if(!string.IsNullOrEmpty(options.PreviousName) && options.PreviousName != options.CurrentName)
|
||||
if(options.LevelNameChanged)
|
||||
{
|
||||
if (purpose != SavePurpose.IntoFile)
|
||||
{
|
||||
|
@ -802,6 +802,31 @@ namespace CodeImp.DoomBuilder {
|
|||
return true;
|
||||
}
|
||||
|
||||
//mxd. Don't save the map if it was not changed
|
||||
internal bool MapSaveRequired(string newfilepathname, SavePurpose purpose)
|
||||
{
|
||||
return (changed || scriptschanged || CheckScriptChanged() || options.LevelNameChanged || newfilepathname != filepathname || purpose != SavePurpose.Normal);
|
||||
}
|
||||
|
||||
//mxd. Saves .dbs file
|
||||
internal bool SaveSettingsFile(string newfilepathname)
|
||||
{
|
||||
try
|
||||
{
|
||||
string settingsfile = newfilepathname.Substring(0, newfilepathname.Length - 4) + ".dbs";
|
||||
if(File.Exists(settingsfile)) File.Delete(settingsfile);
|
||||
options.WriteConfiguration(settingsfile);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
// Warning only
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "Could not write the map settings configuration file. " + e.GetType().Name + ": " + e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Nodebuild
|
||||
|
|
|
@ -104,6 +104,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
}
|
||||
}
|
||||
internal bool LevelNameChanged { get { return (!string.IsNullOrEmpty(previousname) && previousname != currentname); } } //mxd
|
||||
|
||||
public string LevelName { get { return currentname; } }
|
||||
public Dictionary<int, string> TagLabels { get { return tagLabels; } internal set { tagLabels = value; } } //mxd
|
||||
|
|
Loading…
Reference in a new issue