Don't ask for the addon again when using F5
This commit is contained in:
parent
542fd92744
commit
6fc627511c
5 changed files with 26 additions and 16 deletions
|
@ -64,6 +64,8 @@ static std::vector<std::string> saved_windows_;
|
|||
|
||||
namespace editor {
|
||||
|
||||
std::string editor_controller::current_addon_id_ = "";
|
||||
|
||||
editor_controller::editor_controller(const std::string& addon_id)
|
||||
: controller_base()
|
||||
, mouse_handler_base()
|
||||
|
@ -81,6 +83,8 @@ editor_controller::editor_controller(const std::string& addon_id)
|
|||
, quit_mode_(EXIT_ERROR)
|
||||
, music_tracks_()
|
||||
{
|
||||
editor_controller::current_addon_id_ = addon_id;
|
||||
|
||||
init_gui();
|
||||
toolkit_.reset(new editor_toolkit(*gui_.get(), key_, game_config_, *context_manager_.get()));
|
||||
help_manager_.reset(new help::help_manager(&game_config_));
|
||||
|
|
|
@ -239,6 +239,8 @@ class editor_controller : public controller_base,
|
|||
/* managers */
|
||||
public:
|
||||
const std::unique_ptr<context_manager> context_manager_;
|
||||
|
||||
static std::string current_addon_id_;
|
||||
private:
|
||||
std::unique_ptr<editor_toolkit> toolkit_;
|
||||
tooltips::manager tooltip_manager_;
|
||||
|
|
|
@ -83,27 +83,30 @@ void initialize_addon(const std::string& addon_id)
|
|||
}
|
||||
}
|
||||
|
||||
EXIT_STATUS start(const std::string& filename /* = "" */,
|
||||
bool take_screenshot /* = false */, const std::string& screenshot_filename /* = "map_screenshot.png" */)
|
||||
EXIT_STATUS start(bool clear_id, const std::string& filename, bool take_screenshot, const std::string& screenshot_filename)
|
||||
{
|
||||
EXIT_STATUS e = EXIT_ERROR;
|
||||
try {
|
||||
const hotkey::scope_changer h{hotkey::scope_editor};
|
||||
|
||||
std::string addon_id = "";
|
||||
while(true)
|
||||
{
|
||||
gui2::dialogs::editor_choose_addon choose(addon_id);
|
||||
if(choose.show()) {
|
||||
break;
|
||||
} else {
|
||||
return EXIT_STATUS::EXIT_NORMAL;
|
||||
if(clear_id) {
|
||||
while(true)
|
||||
{
|
||||
gui2::dialogs::editor_choose_addon choose(addon_id);
|
||||
if(choose.show()) {
|
||||
break;
|
||||
} else {
|
||||
return EXIT_STATUS::EXIT_NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(addon_id == "newaddon") {
|
||||
std::int64_t current_millis = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
|
||||
addon_id = "MyAwesomeAddon-"+std::to_string(current_millis);
|
||||
if(addon_id == "newaddon") {
|
||||
std::int64_t current_millis = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
|
||||
addon_id = "MyAwesomeAddon-"+std::to_string(current_millis);
|
||||
}
|
||||
} else {
|
||||
addon_id = editor_controller::current_addon_id_;
|
||||
}
|
||||
editor_controller editor(addon_id);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ enum EXIT_STATUS {
|
|||
* go back to the titlescreen or quit to desktop altogether)
|
||||
*/
|
||||
|
||||
EXIT_STATUS start(const std::string& filename = "", bool take_screenshot = false, const std::string& screenshot_filename = "map_screenshot.png");
|
||||
EXIT_STATUS start(bool clear_id, const std::string& filename = "", bool take_screenshot = false, const std::string& screenshot_filename = "map_screenshot.png");
|
||||
|
||||
void initialize_addon(const std::string& addon_id);
|
||||
|
||||
|
|
|
@ -644,7 +644,7 @@ bool game_launcher::play_screenshot_mode()
|
|||
|
||||
::init_textdomains(game_config_manager::get()->game_config());
|
||||
|
||||
editor::start(screenshot_map_, true, screenshot_filename_);
|
||||
editor::start(false, screenshot_map_, true, screenshot_filename_);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1045,12 +1045,13 @@ void game_launcher::play_replay()
|
|||
|
||||
editor::EXIT_STATUS game_launcher::start_editor(const std::string& filename)
|
||||
{
|
||||
editor::EXIT_STATUS res = editor::EXIT_STATUS::EXIT_NORMAL;
|
||||
while(true) {
|
||||
game_config_manager::get()->load_game_config_for_editor();
|
||||
|
||||
::init_textdomains(game_config_manager::get()->game_config());
|
||||
|
||||
editor::EXIT_STATUS res = editor::start(filename);
|
||||
res = editor::start(res != editor::EXIT_RELOAD_DATA, filename);
|
||||
|
||||
if(res != editor::EXIT_RELOAD_DATA) {
|
||||
return res;
|
||||
|
|
Loading…
Add table
Reference in a new issue