summary refs log tree commit diff stats
path: root/tools/mapedit/src/frame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mapedit/src/frame.cpp')
-rw-r--r--tools/mapedit/src/frame.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/mapedit/src/frame.cpp b/tools/mapedit/src/frame.cpp index 934e0f8..94be15e 100644 --- a/tools/mapedit/src/frame.cpp +++ b/tools/mapedit/src/frame.cpp
@@ -265,7 +265,13 @@ void MapeditFrame::OnOpen(wxCommandEvent&)
265 return; 265 return;
266 } 266 }
267 267
268 OpenWorld(openFileDialog.GetPath().ToStdString()); 268 if (OpenWorld(openFileDialog.GetPath().ToStdString()))
269 {
270 if (world->getEmpty())
271 {
272 Close(true);
273 }
274 }
269} 275}
270 276
271void MapeditFrame::OnSave(wxCommandEvent&) 277void MapeditFrame::OnSave(wxCommandEvent&)
@@ -429,17 +435,21 @@ void MapeditFrame::NewWorld()
429 LaunchWindow(std::unique_ptr<World>(new World())); 435 LaunchWindow(std::unique_ptr<World>(new World()));
430} 436}
431 437
432void MapeditFrame::OpenWorld(std::string filename) 438bool MapeditFrame::OpenWorld(std::string filename)
433{ 439{
434 try 440 try
435 { 441 {
436 auto world = std::unique_ptr<World>(new World(filename)); 442 auto world = std::unique_ptr<World>(new World(filename));
437 443
438 LaunchWindow(std::move(world)); 444 LaunchWindow(std::move(world));
445
446 return true;
439 } catch (std::exception& ex) 447 } catch (std::exception& ex)
440 { 448 {
441 wxMessageBox(ex.what(), "Error loading world", wxOK | wxCENTRE | wxICON_ERROR); 449 wxMessageBox(ex.what(), "Error loading world", wxOK | wxCENTRE | wxICON_ERROR);
442 } 450 }
451
452 return false;
443} 453}
444 454
445void MapeditFrame::LaunchWindow(std::unique_ptr<World> world) 455void MapeditFrame::LaunchWindow(std::unique_ptr<World> world)