Fixed map lumps duplication when saving the map several times after converting the map from/to UDMF map format by changing it in the Map Options window.

Fixed, cosmetic: in some cases incorrect resource loading time was displayed after saving the map.
This commit is contained in:
MaxED 2016-11-10 19:18:06 +00:00 committed by spherallic
parent c930ba17c2
commit 66fb6c39b7
4 changed files with 17 additions and 3 deletions

View file

@ -560,6 +560,12 @@ namespace CodeImp.DoomBuilder.Data
internalsprites = null; internalsprites = null;
mapinfo = null; //mxd mapinfo = null; //mxd
} }
//mxd. Called before Clock is reset
internal void OnBeforeClockReset()
{
if(loadstarttime > 0) loadstarttime -= Clock.CurrentTime;
}
#endregion #endregion
@ -745,6 +751,7 @@ namespace CodeImp.DoomBuilder.Data
loadfinishtime = Clock.CurrentTime; loadfinishtime = Clock.CurrentTime;
string deltatimesec = ((loadfinishtime - loadstarttime) / 1000.0f).ToString("########0.00"); string deltatimesec = ((loadfinishtime - loadstarttime) / 1000.0f).ToString("########0.00");
General.WriteLogLine("Resources loading took " + deltatimesec + " seconds"); General.WriteLogLine("Resources loading took " + deltatimesec + " seconds");
loadstarttime = 0; //mxd
//mxd. Show more detailed message //mxd. Show more detailed message
if(notifiedbusy) if(notifiedbusy)

View file

@ -1062,9 +1062,6 @@ namespace CodeImp.DoomBuilder
// Ask the user to save changes (if any) // Ask the user to save changes (if any)
if(AskSaveMap()) if(AskSaveMap())
{ {
//mxd. Reset the clock...
MainWindow.ResetClock();
// Open map options dialog // Open map options dialog
MapOptionsForm optionswindow = new MapOptionsForm(newoptions, true); MapOptionsForm optionswindow = new MapOptionsForm(newoptions, true);
if(optionswindow.ShowDialog(mainwindow) == DialogResult.OK) if(optionswindow.ShowDialog(mainwindow) == DialogResult.OK)
@ -1123,6 +1120,9 @@ namespace CodeImp.DoomBuilder
} }
else else
mainwindow.DisplayReady(); mainwindow.DisplayReady();
//mxd. Also reset the clock...
MainWindow.ResetClock();
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
} }

View file

@ -962,6 +962,9 @@ namespace CodeImp.DoomBuilder
{ {
ConfigurationInfo ci = General.GetConfigurationInfo(origmapconfigname); ConfigurationInfo ci = General.GetConfigurationInfo(origmapconfigname);
origcfg = new GameConfiguration(ci.Configuration); origcfg = new GameConfiguration(ci.Configuration);
// Needed only once!
origmapconfigname = configinfo.Filename;
} }
mapheaderindex = CopyAllLumpsExceptMap(origwad, targetwad, origcfg, origmapname); mapheaderindex = CopyAllLumpsExceptMap(origwad, targetwad, origcfg, origmapname);

View file

@ -4205,6 +4205,10 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
internal void ResetClock() internal void ResetClock()
{ {
// Let the data manager know...
if(General.Map != null && General.Map.Data != null)
General.Map.Data.OnBeforeClockReset();
Clock.Reset(); Clock.Reset();
lastupdatetime = 0; lastupdatetime = 0;