From 38f398caa5fb536873cb31d6e56158c6ab6700d5 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Wed, 7 Jan 2015 17:20:49 -0500 Subject: [PATCH] Several little fixes - Save As not working when not in a scenario - Recuperation trait not selectable - (Mac) Reverse domain applied as file extension - (Windows) File extension not auto-appended - (Windows) Dialogs sometimes fell behind main window after exiting sub-dialog --- src/boe.actions.cpp | 2 +- src/pcedit/pc.editors.cpp | 2 +- src/tools/fileio.cpp | 7 +++++++ src/tools/winutil.mac.mm | 8 ++++---- src/tools/winutil.win.cpp | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/boe.actions.cpp b/src/boe.actions.cpp index 59d689ee..8866dfd7 100644 --- a/src/boe.actions.cpp +++ b/src/boe.actions.cpp @@ -2180,7 +2180,7 @@ void post_load() { //mode; // 0 - normal 1 - save as void do_save(short mode) { - if(overall_mode > MODE_TOWN) { + if(overall_mode > MODE_TOWN && overall_mode != MODE_STARTUP) { add_string_to_buf("Save: Only while outdoors, or in "); add_string_to_buf(" town and not looking/casting. "); print_buf(); diff --git a/src/pcedit/pc.editors.cpp b/src/pcedit/pc.editors.cpp index 629caa47..76dbc9b2 100644 --- a/src/pcedit/pc.editors.cpp +++ b/src/pcedit/pc.editors.cpp @@ -269,7 +269,7 @@ static bool pick_race_select_led(cDialog& me, std::string item_hit, bool losing, display_traits_graphics(me); abil_str = 22 + hit * 2; } else if(item_hit.substr(0,4) == "good") { - int hit = item_hit[4] - '1'; + int hit = boost::lexical_cast(item_hit.substr(4)) - 1; eTrait trait = eTrait(hit); if(store_trait_mode != 1) pc->traits[trait] = !pc->traits[trait]; diff --git a/src/tools/fileio.cpp b/src/tools/fileio.cpp index 540c6da9..c2e2f235 100644 --- a/src/tools/fileio.cpp +++ b/src/tools/fileio.cpp @@ -890,6 +890,13 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bo bool save_party(fs::path dest_file, const cUniverse& univ) { if(!fs::exists(tempDir)) fs::create_directories(tempDir); + // Make sure it has the proper file extension + std::string fname = dest_file.filename().string(); + size_t dot = fname.find_last_of('.'); + if(dot == std::string::npos || fname.substr(dot) != ".exg") + fname += ".exg"; + dest_file = dest_file.parent_path()/fname; + bool in_scen = univ.party.scen_name != ""; bool in_town = univ.town.num < 200; bool save_maps = !univ.party.stuff_done[306][0]; diff --git a/src/tools/winutil.mac.mm b/src/tools/winutil.mac.mm index 138d82bf..d3198104 100644 --- a/src/tools/winutil.mac.mm +++ b/src/tools/winutil.mac.mm @@ -207,25 +207,25 @@ extern sf::RenderWindow mainPtr; void init_fileio(){ dlg_get_scen = [NSOpenPanel openPanel]; - [dlg_get_scen setAllowedFileTypes: [NSArray arrayWithObjects: @"com.spidweb.bladesofexile.scenario", @"exs", @"boes", nil]]; + [dlg_get_scen setAllowedFileTypes: [NSArray arrayWithObjects: @"exs", @"boes", nil]]; [dlg_get_scen setMessage: @"Select a scenario to edit:"]; [dlg_get_scen setTitle: @"Load Scenario"]; [dlg_get_scen retain]; dlg_get_game = [NSOpenPanel openPanel]; - [dlg_get_game setAllowedFileTypes: [NSArray arrayWithObjects: @"com.spidweb.bladesofexile.savegame", @"com.spidweb.bladesofexile.oldmacsave", @"com.spidweb.bladesofexile.oldwinsave", @"exg", @"boe", @"SAV", @"mac", nil]]; + [dlg_get_game setAllowedFileTypes: [NSArray arrayWithObjects: @"exg", @"boe", @"SAV", @"mac", nil]]; [dlg_get_game setMessage: @"Select a saved game to resume:"]; [dlg_get_game setTitle: @"Load Game"]; [dlg_get_game retain]; dlg_put_scen = [NSSavePanel savePanel]; - [dlg_put_scen setAllowedFileTypes: [NSArray arrayWithObjects: @"com.spidweb.bladesofexile.scenario", @"boes", nil]]; + [dlg_put_scen setAllowedFileTypes: [NSArray arrayWithObjects: @"boes", nil]]; [dlg_put_scen setMessage: @"Select a location to save the scenario:"]; [dlg_put_scen setTitle: @"Save Scenario"]; [dlg_put_scen retain]; dlg_put_game = [NSSavePanel savePanel]; - [dlg_put_game setAllowedFileTypes: [NSArray arrayWithObjects: @"com.spidweb.bladesofexile.savegame", @"exg", nil]]; + [dlg_put_game setAllowedFileTypes: [NSArray arrayWithObjects: @"exg", nil]]; [dlg_put_game setMessage: @"Select a location to save your game:"]; [dlg_put_game setTitle: @"Save Game"]; [dlg_put_game retain]; diff --git a/src/tools/winutil.win.cpp b/src/tools/winutil.win.cpp index 06d6d947..d7fc3e13 100644 --- a/src/tools/winutil.win.cpp +++ b/src/tools/winutil.win.cpp @@ -231,6 +231,7 @@ ModalSession::ModalSession(sf::Window& win, sf::Window& p) : parent(&p) { ModalSession::~ModalSession() { HWND win_handle = (HWND)session; EnableWindow(parent->getSystemHandle(), true); + makeFrontWindow(parent); RedrawWindow(parent->getSystemHandle(), NULL, NULL, RDW_NOCHILDREN | RDW_UPDATENOW); }