| 2845 | } |
| 2846 | |
| 2847 | void tutorial_msg(const char *key, bool end) |
| 2848 | { |
| 2849 | string text = getHintString(key); |
| 2850 | if (text.empty()) |
| 2851 | return mprf(MSGCH_ERROR, "Error, no message for '%s'.", key); |
| 2852 | |
| 2853 | _replace_static_tags(text); |
| 2854 | text = untag_tiles_console(text); |
| 2855 | |
| 2856 | // n.b. leaving the dungeon counts as "winning" here (and pops up the |
| 2857 | // tutorial summary) |
| 2858 | if (end) |
| 2859 | screen_end_game(text, you.hp <= 0 ? game_exit::death : game_exit::win); |
| 2860 | |
| 2861 | // "\n" to preserve indented parts, the rest is unwrapped, or split into |
| 2862 | // paragraphs by "\n\n", split_string() will ignore the empty line. |
| 2863 | for (const string &chunk : split_string("\n", text, false)) |
| 2864 | mprf(MSGCH_TUTORIAL, "%s", chunk.c_str()); |
| 2865 | |
| 2866 | // tutorial_msg can get called in an vault epilogue during --builddb, |
| 2867 | // which can lead to a crash on tiles builds in runrest::stop as |
| 2868 | // there is no `tiles`. This seemed like the best place to fix this. |
| 2869 | #ifdef USE_TILE_LOCAL |
| 2870 | if (!crawl_state.tiles_disabled) |
| 2871 | #endif |
| 2872 | stop_running(); |
| 2873 | } |
no test coverage detected