diff --git a/data/json/ascii_art/graveyard.json b/data/json/ascii_art/graveyard.json index 8877613d4a782..bf52626e6b436 100644 --- a/data/json/ascii_art/graveyard.json +++ b/data/json/ascii_art/graveyard.json @@ -8,7 +8,7 @@ " > _ _ (", " | |_) | |_) |", " | | \\ | | |", - " ______.__%_| |________ __", + " ______.__%_| |________ __", " _/ \\| |", "| <", "| |", @@ -20,11 +20,11 @@ " | |", " | _ |", " |__/ |", - " % / `--. |%", - " * .%%| -< @%%%", - " `\\%`@| |@@%@%%", - " .%%%@@@|% ` % @@@%%@%%%%", - " _.%%%%%%@@@@@@%%%__/\\%@@%%@@@@@@@%%%%%%" + " % / `--. |%", + " * .%%| -< @%%%", + " `\\%`@| |@@%@%%", + " .%%%@@@|% ` % @@@%%@%%%%", + " _.%%%%%%@@@@@@%%%__/\\%@@%%@@@@@@@%%%%%%" ] }, { @@ -34,8 +34,8 @@ " _________ ____ ", " _/ `/ \\_ ", " _/ _ _ \\_. ", - " _%\\ |_) | |_) \\_ ", - " _/ \/ | \\ | | \\_ ", + " _%\\ |_) | |_) \\_ ", + " _/ \\/ | \\ | | \\_ ", " _/ \\_ ", "| |", " ) < ", @@ -47,11 +47,11 @@ "| ( ", "| |", "| |", - "| % . |", - "| @` %% |", - "| %@%@%\\ * %`%@%|", - "%%@@@.%@%\\%% `\\ %%.%%@@%@", - "@%@@%%%%%@@@@@@%%%%%%%%@@%%@@@%%%@%%@" + "| % . |", + "| @` %% |", + "| %@%@%\\ * %`%@%|", + "%%@@@.%@%\\%% `\\ %%.%%@@%@", + "@%@@%%%%%@@@@@@%%%%%%%%@@%%@@@%%%@%%@" ] } ] diff --git a/src/end_screen.cpp b/src/end_screen.cpp index 7eea8434c5513..3d1c6507b4b17 100644 --- a/src/end_screen.cpp +++ b/src/end_screen.cpp @@ -29,6 +29,7 @@ void end_screen::load( const JsonObject &jo, std::string_view ) { mandatory( jo, was_loaded, "id", id ); mandatory( jo, was_loaded, "picture_id", picture_id ); + mandatory( jo, was_loaded, "priority", priority ); read_condition( jo, "condition", condition, false ); optional( jo, was_loaded, "added_info", added_info ); diff --git a/src/end_screen.h b/src/end_screen.h index 59ca80be57664..f9337125ce160 100644 --- a/src/end_screen.h +++ b/src/end_screen.h @@ -23,6 +23,7 @@ class end_screen end_screen_id id; ascii_art_id picture_id; std::function condition; + int priority; std::vector, std::string>> added_info; std::string last_words_label; }; diff --git a/src/game.cpp b/src/game.cpp index d5c5fb6df94f8..7ed9b1c03bfd9 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2846,7 +2846,15 @@ void end_screen_ui_impl::draw_controls() dialogue d( get_talker_for( u ), nullptr ); std::string input_label; std::vector, std::string>> added_info; - for( const end_screen &e_screen : end_screen::get_all() ) { + + //Sort end_screens in order of decreasing priority + std::vector sorted_screens = end_screen::get_all(); + std::sort( sorted_screens.begin(), sorted_screens.end(), []( end_screen const & a, + end_screen const & b ) { + return a.priority > b.priority; + } ); + + for( const end_screen &e_screen : sorted_screens ) { if( e_screen.condition( d ) ) { art = e_screen.picture_id; if( !e_screen.added_info.empty() ) { @@ -2855,6 +2863,7 @@ void end_screen_ui_impl::draw_controls() if( !e_screen.last_words_label.empty() ) { input_label = e_screen.last_words_label; } + break; } }