editor validate the debug party preference
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Import("env platform common_sources install_dir")
|
Import("env platform common_sources party_classes install_dir")
|
||||||
|
|
||||||
scened_sources = Split("""
|
scened_sources = Split("""
|
||||||
scen.actions.cpp
|
scen.actions.cpp
|
||||||
@@ -11,6 +11,7 @@ scened_sources = Split("""
|
|||||||
scen.main.cpp
|
scen.main.cpp
|
||||||
scen.townout.cpp
|
scen.townout.cpp
|
||||||
../view_dialogs.cpp
|
../view_dialogs.cpp
|
||||||
|
../fileio/fileio_party.cpp
|
||||||
""")
|
""")
|
||||||
|
|
||||||
if str(platform) == "darwin":
|
if str(platform) == "darwin":
|
||||||
@@ -30,7 +31,7 @@ elif str(platform) == "posix":
|
|||||||
scen.menu.cpp
|
scen.menu.cpp
|
||||||
"""))
|
"""))
|
||||||
|
|
||||||
scened = env.Program("#build/bin/BoE Scenario Editor", scened_sources + common_sources)
|
scened = env.Program("#build/bin/BoE Scenario Editor", scened_sources + common_sources + party_classes)
|
||||||
debug_symbols = None
|
debug_symbols = None
|
||||||
if str(platform) == "win32" and 'msvc' in env["TOOLS"] and not env['release']:
|
if str(platform) == "win32" and 'msvc' in env["TOOLS"] and not env['release']:
|
||||||
debug_symbols = scened[0].abspath.replace('.exe', '.pdb')
|
debug_symbols = scened[0].abspath.replace('.exe', '.pdb')
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
#include "tools/event_listener.hpp"
|
#include "tools/event_listener.hpp"
|
||||||
#include "tools/drawable_manager.hpp"
|
#include "tools/drawable_manager.hpp"
|
||||||
#include "tools/keymods.hpp"
|
#include "tools/keymods.hpp"
|
||||||
|
#include "universe/universe.hpp"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
short menuChoiceId=-1;
|
short menuChoiceId=-1;
|
||||||
@@ -864,6 +865,21 @@ void pick_preferences() {
|
|||||||
cTextField& default_party_field = dynamic_cast<cTextField&>(prefsDlog["party-path"]);
|
cTextField& default_party_field = dynamic_cast<cTextField&>(prefsDlog["party-path"]);
|
||||||
default_party_field.setText(get_string_pref("DefaultPartyPath"));
|
default_party_field.setText(get_string_pref("DefaultPartyPath"));
|
||||||
|
|
||||||
|
default_party_field.attachFocusHandler([](cDialog& me, std::string id, bool losing) -> bool {
|
||||||
|
if(!losing) return true;
|
||||||
|
std::string debug_party = me[id].getText();
|
||||||
|
// Validate the debug party
|
||||||
|
if(!debug_party.empty()){
|
||||||
|
cUniverse univ;
|
||||||
|
if(!load_party(debug_party, univ)){
|
||||||
|
showError("Your chosen debug party could not be loaded.", "", &me);
|
||||||
|
me[id].setText(get_string_pref("DefaultPartyPath"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
cButton& choose_button = dynamic_cast<cButton&>(prefsDlog["choose-party"]);
|
cButton& choose_button = dynamic_cast<cButton&>(prefsDlog["choose-party"]);
|
||||||
choose_button.attachClickHandler([&default_party_field](cDialog& me, std::string, eKeyMod) -> bool {
|
choose_button.attachClickHandler([&default_party_field](cDialog& me, std::string, eKeyMod) -> bool {
|
||||||
fs::path new_path = nav_get_party();
|
fs::path new_path = nav_get_party();
|
||||||
|
Reference in New Issue
Block a user