Skip to content

Commit

Permalink
Got rid of 'preload world defaults' dialog on making a new world
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Jun 28, 2011
1 parent c295f84 commit 579afc0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 75 deletions.
74 changes: 0 additions & 74 deletions doc_construct.cpp
Expand Up @@ -664,80 +664,6 @@ BOOL CMUSHclientDoc::OnNewDocument()
SetDefaults (false); // set up numeric/boolean defaults
SetAlphaDefaults (false); // set up alpha defaults

if (App.m_TypeOfNewDocument == App.eNormalNewDocument) // only ask on normal new world
{
int i = ::TMessageBox ("Preload world defaults from an existing world?",
MB_YESNOCANCEL | MB_ICONQUESTION);

if (i == IDCANCEL)
return FALSE;

if (i == IDYES)
while (TRUE) // loop until successful read of file, or cancel
{
// Get file
CString strFilter(MAKEINTRESOURCE(IDS_OPEN_WORLD_FILTER));
CString strTitle(MAKEINTRESOURCE(IDS_OPEN_WORLD_TITLE));
CFileDialog dlg(TRUE, // TRUE for FileOpen
NULL, // default extension
NULL, // no initial file name
OFN_HIDEREADONLY|OFN_FILEMUSTEXIST,
strFilter);
dlg.m_ofn.lpstrTitle = strTitle;

// use default world file directory
dlg.m_ofn.lpstrInitialDir = Make_Absolute_Path (App.m_strDefaultWorldFileDirectory);

ChangeToFileBrowsingDirectory ();
int nResult = dlg.DoModal();
ChangeToStartupDirectory ();

if (nResult != IDOK)
break;
CString strFileName = dlg.GetPathName();

CWaitCursor wait;

try
{

// Open existing world file
CFile fileWorld(strFileName, CFile::modeRead|CFile::shareDenyWrite);

CArchive ar(&fileWorld, CArchive::load);

try
{
Serialize (ar);
}
catch(CException* e)
{
::TMessageBox ("Unexpected file format - invalid world file", MB_ICONEXCLAMATION);
e->Delete();
ar.Close();
continue;
}

ar.Close();

}
catch(CException* e)
{
::TMessageBox ("Unable to open world file", MB_ICONEXCLAMATION);
e->Delete();
continue;
}

// if we got here, we successfully loaded the world!

SetModifiedFlag ();
m_strWorldID = GetUniqueID (); // new world ID

break;

} // end of preloading defaults
} // end of normal new world

// if defaults are wanted, overwrite what we loaded with them :)

if (m_bLoaded)
Expand Down
2 changes: 1 addition & 1 deletion xml/xml_serialize.cpp
Expand Up @@ -46,7 +46,7 @@ void CMUSHclientDoc::Serialize_World_XML (CArchive& ar)
m_CurrentPlugin = pSavedPlugin;
}
else
{ // loaidng
{ // loading
Load_World_XML (ar, (unsigned long) ~(XML_PLUGINS | XML_NO_PLUGINS)); // load all options, except plugins
m_bLoaded = true; // this world has been loaded from disk
}
Expand Down

0 comments on commit 579afc0

Please sign in to comment.