summary refs log tree commit diff stats
path: root/tools/mapedit/src/frame.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-03-16 17:20:03 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-03-16 17:20:03 -0400
commit8b61d93fc869ea39a78cdc134002ef11bf3e69d3 (patch)
treec2aca3668c058cbdc7dfd9537802750f9c4f6600 /tools/mapedit/src/frame.cpp
parent82fb304e61191f27403b5dbfaa90f24d625dee87 (diff)
downloadtherapy-8b61d93fc869ea39a78cdc134002ef11bf3e69d3.tar.gz
therapy-8b61d93fc869ea39a78cdc134002ef11bf3e69d3.tar.bz2
therapy-8b61d93fc869ea39a78cdc134002ef11bf3e69d3.zip
Opening a file in the map editor closes the current window if the current window is a blank slate
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)